Run cargo fmt on the whole code base (#9394)

* Run cargo fmt on the whole code base

* Second run

* Add CI check

* Fix compilation

* More unnecessary braces

* Handle weights

* Use --all

* Use correct attributes...

* Fix UI tests

* AHHHHHHHHH

* 🤦

* Docs

* Fix compilation

* 🤷

* Please stop

* 🤦 x 2

* More

* make rustfmt.toml consistent with polkadot

Co-authored-by: André Silva <andrerfosilva@gmail.com>
This commit is contained in:
Bastian Köcher
2021-07-21 16:32:32 +02:00
committed by GitHub
parent d451c38c1c
commit 7b56ab15b4
1010 changed files with 53339 additions and 51208 deletions
@@ -22,8 +22,7 @@
mod mock;
use sp_std::prelude::*;
use sp_std::vec;
use sp_std::{prelude::*, vec};
use frame_benchmarking::{benchmarks, impl_benchmark_test_suite};
use frame_support::{
@@ -41,7 +40,10 @@ use sp_runtime::traits::{One, StaticLookup};
const MAX_VALIDATORS: u32 = 1000;
pub struct Pallet<T: Config>(pallet_session::Module<T>);
pub trait Config: pallet_session::Config + pallet_session::historical::Config + pallet_staking::Config {}
pub trait Config:
pallet_session::Config + pallet_session::historical::Config + pallet_staking::Config
{
}
impl<T: Config> OnInitialize<T::BlockNumber> for Pallet<T> {
fn on_initialize(n: T::BlockNumber) -> frame_support::weights::Weight {
@@ -120,20 +122,12 @@ benchmarks! {
/// proof for the first authority and returns its key and the proof.
fn check_membership_proof_setup<T: Config>(
n: u32,
) -> (
(sp_runtime::KeyTypeId, &'static [u8; 32]),
sp_session::MembershipProof,
) {
) -> ((sp_runtime::KeyTypeId, &'static [u8; 32]), sp_session::MembershipProof) {
pallet_staking::ValidatorCount::<T>::put(n);
// create validators and set random session keys
for (n, who) in create_validators::<T>(n, 1000)
.unwrap()
.into_iter()
.enumerate()
{
use rand::RngCore;
use rand::SeedableRng;
for (n, who) in create_validators::<T>(n, 1000).unwrap().into_iter().enumerate() {
use rand::{RngCore, SeedableRng};
let validator = T::Lookup::lookup(who).unwrap();
let controller = pallet_staking::Pallet::<T>::bonded(validator).unwrap();
@@ -168,9 +162,4 @@ fn check_membership_proof_setup<T: Config>(
(key, Historical::<T>::prove(key).unwrap())
}
impl_benchmark_test_suite!(
Pallet,
crate::mock::new_test_ext(),
crate::mock::Test,
extra = false,
);
impl_benchmark_test_suite!(Pallet, crate::mock::new_test_ext(), crate::mock::Test, extra = false,);