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
+20 -13
View File
@@ -28,12 +28,12 @@ use sp_runtime::{
};
use frame_support::{
assert_noop, assert_ok, parameter_types,
traits::OnInitialize, PalletId, pallet_prelude::GenesisBuild,
assert_noop, assert_ok, pallet_prelude::GenesisBuild, parameter_types, traits::OnInitialize,
PalletId,
};
use crate as treasury;
use super::*;
use crate as treasury;
type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<Test>;
type Block = frame_system::mocking::MockBlock<Test>;
@@ -119,7 +119,7 @@ impl Config for Test {
type ProposalBondMinimum = ProposalBondMinimum;
type SpendPeriod = SpendPeriod;
type Burn = Burn;
type BurnDestination = (); // Just gets burned.
type BurnDestination = (); // Just gets burned.
type WeightInfo = ();
type SpendFunds = ();
type MaxApprovals = MaxApprovals;
@@ -127,10 +127,12 @@ impl Config for Test {
pub fn new_test_ext() -> sp_io::TestExternalities {
let mut t = frame_system::GenesisConfig::default().build_storage::<Test>().unwrap();
pallet_balances::GenesisConfig::<Test>{
pallet_balances::GenesisConfig::<Test> {
// Total issuance will be 200 with treasury account initialized at ED.
balances: vec![(0, 100), (1, 98), (2, 1)],
}.assimilate_storage(&mut t).unwrap();
}
.assimilate_storage(&mut t)
.unwrap();
GenesisBuild::<Test>::assimilate_storage(&crate::GenesisConfig, &mut t).unwrap();
t.into()
}
@@ -320,9 +322,9 @@ fn treasury_account_doesnt_get_deleted() {
#[test]
fn inexistent_account_works() {
let mut t = frame_system::GenesisConfig::default().build_storage::<Test>().unwrap();
pallet_balances::GenesisConfig::<Test>{
balances: vec![(0, 100), (1, 99), (2, 1)],
}.assimilate_storage(&mut t).unwrap();
pallet_balances::GenesisConfig::<Test> { balances: vec![(0, 100), (1, 99), (2, 1)] }
.assimilate_storage(&mut t)
.unwrap();
// Treasury genesis config is not build thus treasury account does not exist
let mut t: sp_io::TestExternalities = t.into();
@@ -353,10 +355,12 @@ fn inexistent_account_works() {
fn genesis_funding_works() {
let mut t = frame_system::GenesisConfig::default().build_storage::<Test>().unwrap();
let initial_funding = 100;
pallet_balances::GenesisConfig::<Test>{
pallet_balances::GenesisConfig::<Test> {
// Total issuance will be 200 with treasury account initialized with 100.
balances: vec![(0, 100), (Treasury::account_id(), initial_funding)],
}.assimilate_storage(&mut t).unwrap();
}
.assimilate_storage(&mut t)
.unwrap();
GenesisBuild::<Test>::assimilate_storage(&crate::GenesisConfig, &mut t).unwrap();
let mut t: sp_io::TestExternalities = t.into();
@@ -372,13 +376,16 @@ fn max_approvals_limited() {
Balances::make_free_balance_be(&Treasury::account_id(), u64::MAX);
Balances::make_free_balance_be(&0, u64::MAX);
for _ in 0 .. MaxApprovals::get() {
for _ in 0..MaxApprovals::get() {
assert_ok!(Treasury::propose_spend(Origin::signed(0), 100, 3));
assert_ok!(Treasury::approve_proposal(Origin::root(), 0));
}
// One too many will fail
assert_ok!(Treasury::propose_spend(Origin::signed(0), 100, 3));
assert_noop!(Treasury::approve_proposal(Origin::root(), 0), Error::<Test, _>::TooManyApprovals);
assert_noop!(
Treasury::approve_proposal(Origin::root(), 0),
Error::<Test, _>::TooManyApprovals
);
});
}