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
+28 -14
View File
@@ -20,9 +20,13 @@
#![cfg(test)]
use super::*;
use sp_std::prelude::*;
use sp_runtime::{traits::{BlakeTwo256, IdentityLookup}, testing::{H256, Header}, BuildStorage};
use frame_support::parameter_types;
use sp_runtime::{
testing::{Header, H256},
traits::{BlakeTwo256, IdentityLookup},
BuildStorage,
};
use sp_std::prelude::*;
mod pallet_test {
use frame_support::pallet_prelude::Get;
@@ -59,7 +63,8 @@ mod pallet_test {
}
pub trait Config: frame_system::Config + OtherConfig
where Self::OtherEvent: Into<<Self as Config>::Event>
where
Self::OtherEvent: Into<<Self as Config>::Event>,
{
type Event;
type LowerBound: Get<u32>;
@@ -107,7 +112,7 @@ impl frame_system::Config for Test {
type OnSetCode = ();
}
parameter_types!{
parameter_types! {
pub const LowerBound: u32 = 1;
pub const UpperBound: u32 = 100;
}
@@ -127,16 +132,20 @@ fn new_test_ext() -> sp_io::TestExternalities {
}
mod benchmarks {
use sp_std::prelude::*;
use super::{
new_test_ext,
pallet_test::{self, Value},
Test,
};
use crate::{account, BenchmarkParameter, BenchmarkingSetup};
use frame_support::{assert_err, assert_ok, ensure, traits::Get, StorageValue};
use frame_system::RawOrigin;
use super::{Test, pallet_test::{self, Value}, new_test_ext};
use frame_support::{assert_ok, assert_err, ensure, traits::Get, StorageValue};
use crate::{BenchmarkingSetup, BenchmarkParameter, account};
use sp_std::prelude::*;
// Additional used internally by the benchmark macro.
use super::pallet_test::{Call, Config, Pallet};
crate::benchmarks!{
crate::benchmarks! {
where_clause {
where
<T as pallet_test::OtherConfig>::OtherEvent: Into<<T as pallet_test::Config>::Event> + Clone,
@@ -204,7 +213,8 @@ mod benchmarks {
&selected,
&[(BenchmarkParameter::b, 1)],
true,
).expect("failed to create closure");
)
.expect("failed to create closure");
new_test_ext().execute_with(|| {
assert_ok!(closure());
@@ -222,7 +232,8 @@ mod benchmarks {
&selected,
&[(BenchmarkParameter::b, 1)],
true,
).expect("failed to create closure");
)
.expect("failed to create closure");
new_test_ext().execute_with(|| {
assert_ok!(closure());
@@ -240,7 +251,8 @@ mod benchmarks {
&selected,
&[(BenchmarkParameter::x, 1)],
true,
).expect("failed to create closure");
)
.expect("failed to create closure");
assert_ok!(closure());
}
@@ -254,7 +266,8 @@ mod benchmarks {
&selected,
&[(BenchmarkParameter::b, 1)],
true,
).expect("failed to create closure");
)
.expect("failed to create closure");
new_test_ext().execute_with(|| {
assert_ok!(closure());
@@ -267,7 +280,8 @@ mod benchmarks {
&selected,
&[(BenchmarkParameter::x, 10000)],
true,
).expect("failed to create closure");
)
.expect("failed to create closure");
new_test_ext().execute_with(|| {
assert_err!(closure(), "You forgot to sort!");