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
+26 -16
View File
@@ -21,11 +21,11 @@
use super::*;
use frame_system::RawOrigin;
use frame_benchmarking::{benchmarks, account, whitelisted_caller, impl_benchmark_test_suite};
use sp_runtime::traits::Bounded;
use frame_support::{ensure, traits::Get};
use crate::Pallet as Identity;
use frame_benchmarking::{account, benchmarks, impl_benchmark_test_suite, whitelisted_caller};
use frame_support::{ensure, traits::Get};
use frame_system::RawOrigin;
use sp_runtime::traits::Bounded;
const SEED: u32 = 0;
@@ -39,11 +39,19 @@ fn add_registrars<T: Config>(r: u32) -> Result<(), &'static str> {
let registrar: T::AccountId = account("registrar", i, SEED);
let _ = T::Currency::make_free_balance_be(&registrar, BalanceOf::<T>::max_value());
Identity::<T>::add_registrar(RawOrigin::Root.into(), registrar.clone())?;
Identity::<T>::set_fee(RawOrigin::Signed(registrar.clone()).into(), i.into(), 10u32.into())?;
let fields = IdentityFields(
IdentityField::Display | IdentityField::Legal | IdentityField::Web | IdentityField::Riot
| IdentityField::Email | IdentityField::PgpFingerprint | IdentityField::Image | IdentityField::Twitter
);
Identity::<T>::set_fee(
RawOrigin::Signed(registrar.clone()).into(),
i.into(),
10u32.into(),
)?;
let fields =
IdentityFields(
IdentityField::Display |
IdentityField::Legal | IdentityField::Web |
IdentityField::Riot | IdentityField::Email |
IdentityField::PgpFingerprint |
IdentityField::Image | IdentityField::Twitter,
);
Identity::<T>::set_fields(RawOrigin::Signed(registrar.clone()).into(), i.into(), fields)?;
}
@@ -53,7 +61,10 @@ fn add_registrars<T: Config>(r: u32) -> Result<(), &'static str> {
// Create `s` sub-accounts for the identity of `who` and return them.
// Each will have 32 bytes of raw data added to it.
fn create_sub_accounts<T: Config>(who: &T::AccountId, s: u32) -> Result<Vec<(T::AccountId, Data)>, &'static str> {
fn create_sub_accounts<T: Config>(
who: &T::AccountId,
s: u32,
) -> Result<Vec<(T::AccountId, Data)>, &'static str> {
let mut subs = Vec::new();
let who_origin = RawOrigin::Signed(who.clone());
let data = Data::Raw(vec![0; 32].try_into().unwrap());
@@ -73,7 +84,10 @@ fn create_sub_accounts<T: Config>(who: &T::AccountId, s: u32) -> Result<Vec<(T::
// Adds `s` sub-accounts to the identity of `who`. Each will have 32 bytes of raw data added to it.
// This additionally returns the vector of sub-accounts so it can be modified if needed.
fn add_sub_accounts<T: Config>(who: &T::AccountId, s: u32) -> Result<Vec<(T::AccountId, Data)>, &'static str> {
fn add_sub_accounts<T: Config>(
who: &T::AccountId,
s: u32,
) -> Result<Vec<(T::AccountId, Data)>, &'static str> {
let who_origin = RawOrigin::Signed(who.clone());
let subs = create_sub_accounts::<T>(who, s)?;
@@ -399,8 +413,4 @@ benchmarks! {
}
impl_benchmark_test_suite!(
Identity,
crate::tests::new_test_ext(),
crate::tests::Test,
);
impl_benchmark_test_suite!(Identity, crate::tests::new_test_ext(), crate::tests::Test,);