diff --git a/polkadot/xcm/xcm-simulator/fuzzer/src/fuzz.rs b/polkadot/xcm/xcm-simulator/fuzzer/src/fuzz.rs index 489cecee38801..50d17655e1243 100644 --- a/polkadot/xcm/xcm-simulator/fuzzer/src/fuzz.rs +++ b/polkadot/xcm/xcm-simulator/fuzzer/src/fuzz.rs @@ -153,13 +153,13 @@ pub type ParachainPalletXcm = pallet_xcm::Pallet; // We check XCM messages recursively for blocklisted messages fn recursively_matches_blocklisted_messages(message: &Instruction<()>) -> bool { match message { - DepositReserveAsset { xcm, .. } - | ExportMessage { xcm, .. } - | InitiateReserveWithdraw { xcm, .. } - | InitiateTeleport { xcm, .. } - | TransferReserveAsset { xcm, .. } - | SetErrorHandler(xcm) - | SetAppendix(xcm) => xcm.iter().any(recursively_matches_blocklisted_messages), + DepositReserveAsset { xcm, .. } | + ExportMessage { xcm, .. } | + InitiateReserveWithdraw { xcm, .. } | + InitiateTeleport { xcm, .. } | + TransferReserveAsset { xcm, .. } | + SetErrorHandler(xcm) | + SetAppendix(xcm) => xcm.iter().any(recursively_matches_blocklisted_messages), // The blocklisted message is the Transact instruction. m => matches!(m, Transact { .. }), } diff --git a/substrate/frame/delegated-staking/src/mock.rs b/substrate/frame/delegated-staking/src/mock.rs index b9f3aeed998a2..f635d20da0f52 100644 --- a/substrate/frame/delegated-staking/src/mock.rs +++ b/substrate/frame/delegated-staking/src/mock.rs @@ -320,8 +320,8 @@ pub(crate) fn start_era(era: sp_staking::EraIndex) { } pub(crate) fn eq_stake(who: AccountId, total: Balance, active: Balance) -> bool { - Staking::stake(&who).unwrap() == Stake { total, active } - && get_agent(&who).ledger.stakeable_balance() == total + Staking::stake(&who).unwrap() == Stake { total, active } && + get_agent(&who).ledger.stakeable_balance() == total } pub(crate) fn get_agent(agent: &AccountId) -> Agent { diff --git a/substrate/frame/executive/src/lib.rs b/substrate/frame/executive/src/lib.rs index 4735ffd9ad456..a1764526efd33 100644 --- a/substrate/frame/executive/src/lib.rs +++ b/substrate/frame/executive/src/lib.rs @@ -89,8 +89,8 @@ //! ### Custom `TryState` logic //! //! You can add custom logic that should be called in your runtime on a try-state test. This is -//! done by setting an optional generic parameter after the `OnRuntimeUpgrade` type. The custom logic will be called before -//! the `try-state` logic of all modules is called. +//! done by setting an optional generic parameter after the `OnRuntimeUpgrade` type. The custom +//! logic will be called before the `try-state` logic of all modules is called. //! //! ``` //! # use sp_runtime::generic; @@ -678,9 +678,9 @@ impl< // Check that `parent_hash` is correct. let n = *header.number(); assert!( - n > BlockNumberFor::::zero() - && >::block_hash(n - BlockNumberFor::::one()) - == *header.parent_hash(), + n > BlockNumberFor::::zero() && + >::block_hash(n - BlockNumberFor::::one()) == + *header.parent_hash(), "Parent hash should be valid.", ); diff --git a/substrate/frame/executive/src/tests.rs b/substrate/frame/executive/src/tests.rs index 9584580b5eb99..926d53218ba3e 100644 --- a/substrate/frame/executive/src/tests.rs +++ b/substrate/frame/executive/src/tests.rs @@ -314,9 +314,9 @@ mod custom2 { // Inherent call is accepted for being dispatched fn pre_dispatch(call: &Self::Call) -> Result<(), TransactionValidityError> { match call { - Call::allowed_unsigned { .. } - | Call::optional_inherent { .. } - | Call::inherent { .. } => Ok(()), + Call::allowed_unsigned { .. } | + Call::optional_inherent { .. } | + Call::inherent { .. } => Ok(()), _ => Err(UnknownTransaction::NoUnsignedValidator.into()), } } @@ -538,8 +538,8 @@ fn balance_transfer_dispatch_works() { .assimilate_storage(&mut t) .unwrap(); let xt = TestXt::new(call_transfer(2, 69), sign_extra(1, 0, 0)); - let weight = xt.get_dispatch_info().weight - + ::BlockWeights::get() + let weight = xt.get_dispatch_info().weight + + ::BlockWeights::get() .get(DispatchClass::Normal) .base_extrinsic; let fee: Balance = @@ -726,8 +726,8 @@ fn block_weight_and_size_is_stored_per_tx() { let mut t = new_test_ext(1); t.execute_with(|| { // Block execution weight + on_initialize weight from custom module - let base_block_weight = Weight::from_parts(175, 0) - + ::BlockWeights::get().base_block; + let base_block_weight = Weight::from_parts(175, 0) + + ::BlockWeights::get().base_block; Executive::initialize_block(&Header::new_from_number(1)); @@ -739,8 +739,8 @@ fn block_weight_and_size_is_stored_per_tx() { assert!(Executive::apply_extrinsic(x2.clone()).unwrap().is_ok()); // default weight for `TestXt` == encoded length. - let extrinsic_weight = Weight::from_parts(len as u64, 0) - + ::BlockWeights::get() + let extrinsic_weight = Weight::from_parts(len as u64, 0) + + ::BlockWeights::get() .get(DispatchClass::Normal) .base_extrinsic; assert_eq!( @@ -997,10 +997,10 @@ fn all_weights_are_recorded_correctly() { // Weights are recorded correctly assert_eq!( frame_system::Pallet::::block_weight().total(), - custom_runtime_upgrade_weight - + runtime_upgrade_weight - + on_initialize_weight - + base_block_weight, + custom_runtime_upgrade_weight + + runtime_upgrade_weight + + on_initialize_weight + + base_block_weight, ); }); } diff --git a/substrate/frame/support/procedural/src/pallet/expand/hooks.rs b/substrate/frame/support/procedural/src/pallet/expand/hooks.rs index 19d6f8caf146c..e412581d11a6a 100644 --- a/substrate/frame/support/procedural/src/pallet/expand/hooks.rs +++ b/substrate/frame/support/procedural/src/pallet/expand/hooks.rs @@ -18,7 +18,8 @@ use crate::pallet::Def; /// * implement the individual traits using the Hooks trait -/// * implement the `TryStateLogic` and `IdentifiableTryStateLogic` traits, that are strictly dependent on the `TryState` hook +/// * implement the `TryStateLogic` and `IdentifiableTryStateLogic` traits, that are strictly +/// dependent on the `TryState` hook pub fn expand_hooks(def: &mut Def) -> proc_macro2::TokenStream { let (where_clause, span, has_runtime_upgrade) = match def.hooks.as_ref() { Some(hooks) => { diff --git a/substrate/frame/support/src/traits/try_runtime/mod.rs b/substrate/frame/support/src/traits/try_runtime/mod.rs index c5653eaafd298..5205c0cb4dc93 100644 --- a/substrate/frame/support/src/traits/try_runtime/mod.rs +++ b/substrate/frame/support/src/traits/try_runtime/mod.rs @@ -79,7 +79,7 @@ impl sp_std::str::FromStr for Select { match s { "all" | "All" => Ok(Select::All), "none" | "None" => Ok(Select::None), - _ => { + _ => if s.starts_with("rr-") { let count = s .split_once('-') @@ -89,8 +89,7 @@ impl sp_std::str::FromStr for Select { } else { let pallets = s.split(',').map(|x| x.as_bytes().to_vec()).collect::>(); Ok(Select::Only(pallets)) - } - }, + }, } } } @@ -172,7 +171,8 @@ where /// Logic executed when `try-state` filters are provided in the `try-runtime` CLI. /// -/// Returning `true` for the provided ID will include this `try-state` logic in the overall tests performed. +/// Returning `true` for the provided ID will include this `try-state` logic in the overall tests +/// performed. pub trait IdentifiableTryStateLogic: TryStateLogic { fn matches_id(_id: &[u8]) -> bool; }