Fix Clippy (#2522)

* Import Clippy config from Polkadot

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Auto clippy fix

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* No tabs in comments

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Prefer matches

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Dont drop references

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Trivial

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Refactor

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* fmt

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* add clippy to ci

* Clippy reborrow

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Update client/pov-recovery/src/lib.rs

Co-authored-by: Bastian Köcher <git@kchr.de>

* Update client/pov-recovery/src/lib.rs

Co-authored-by: Bastian Köcher <git@kchr.de>

* Partially revert 'Prefer matches'

Using matches! instead of match does give less compiler
checks as per review from @chevdor.

Partially reverts 8c0609677f3ea040f77fffd5be6facf7c3fec95c

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Update .cargo/config.toml

Co-authored-by: Chevdor <chevdor@users.noreply.github.com>

* Revert revert 💩

Should be fine to use matches! macro since it is an explicit whitelist,
not wildcard matching.

---------

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Co-authored-by: alvicsam <alvicsam@gmail.com>
Co-authored-by: Bastian Köcher <git@kchr.de>
Co-authored-by: Chevdor <chevdor@users.noreply.github.com>
Co-authored-by: parity-processbot <>
This commit is contained in:
Oliver Tale-Yazdi
2023-05-06 08:01:03 +02:00
committed by GitHub
parent b72ae577a0
commit 299d25ba4b
92 changed files with 910 additions and 967 deletions
@@ -27,7 +27,7 @@ pub(crate) mod import_kusama_fellowship {
#[cfg(feature = "try-runtime")]
use sp_std::vec::Vec;
const TARGET: &'static str = "runtime::migration::import_fellowship";
const TARGET: &str = "runtime::migration::import_fellowship";
parameter_types! {
// The Fellowship addresses from Kusama state.
@@ -250,7 +250,7 @@ pub mod tests {
assert!(IdToIndex::<Runtime, Fellowship>::get(0, &who).is_some());
assert!(IdToIndex::<Runtime, Fellowship>::get(rank + 1, &who).is_none());
let index = IdToIndex::<Runtime, Fellowship>::get(rank, &who).unwrap();
assert_eq!(IndexToId::<Runtime, Fellowship>::get(rank, &index).unwrap(), who);
assert_eq!(IndexToId::<Runtime, Fellowship>::get(rank, index).unwrap(), who);
assert_eq!(
Members::<Runtime, Fellowship>::get(&who).unwrap(),
MemberRecord::new(rank)
@@ -54,7 +54,7 @@ impl pallet_referenda::TracksInfo<Balance, BlockNumber> for TracksInfo {
prepare_period: 30 * MINUTES,
decision_period: 7 * DAYS,
confirm_period: 30 * MINUTES,
min_enactment_period: 1 * MINUTES,
min_enactment_period: MINUTES,
min_approval: pallet_referenda::Curve::LinearDecreasing {
length: Perbill::from_percent(100),
floor: Perbill::from_percent(50),
@@ -76,7 +76,7 @@ impl pallet_referenda::TracksInfo<Balance, BlockNumber> for TracksInfo {
prepare_period: 30 * MINUTES,
decision_period: 7 * DAYS,
confirm_period: 30 * MINUTES,
min_enactment_period: 1 * MINUTES,
min_enactment_period: MINUTES,
min_approval: pallet_referenda::Curve::LinearDecreasing {
length: Perbill::from_percent(100),
floor: Perbill::from_percent(50),
@@ -98,7 +98,7 @@ impl pallet_referenda::TracksInfo<Balance, BlockNumber> for TracksInfo {
prepare_period: 30 * MINUTES,
decision_period: 7 * DAYS,
confirm_period: 30 * MINUTES,
min_enactment_period: 1 * MINUTES,
min_enactment_period: MINUTES,
min_approval: pallet_referenda::Curve::LinearDecreasing {
length: Perbill::from_percent(100),
floor: Perbill::from_percent(50),
@@ -120,7 +120,7 @@ impl pallet_referenda::TracksInfo<Balance, BlockNumber> for TracksInfo {
prepare_period: 30 * MINUTES,
decision_period: 7 * DAYS,
confirm_period: 30 * MINUTES,
min_enactment_period: 1 * MINUTES,
min_enactment_period: MINUTES,
min_approval: pallet_referenda::Curve::LinearDecreasing {
length: Perbill::from_percent(100),
floor: Perbill::from_percent(50),
@@ -142,7 +142,7 @@ impl pallet_referenda::TracksInfo<Balance, BlockNumber> for TracksInfo {
prepare_period: 30 * MINUTES,
decision_period: 7 * DAYS,
confirm_period: 30 * MINUTES,
min_enactment_period: 1 * MINUTES,
min_enactment_period: MINUTES,
min_approval: pallet_referenda::Curve::LinearDecreasing {
length: Perbill::from_percent(100),
floor: Perbill::from_percent(50),
@@ -160,11 +160,11 @@ impl pallet_referenda::TracksInfo<Balance, BlockNumber> for TracksInfo {
pallet_referenda::TrackInfo {
name: "experts",
max_deciding: 10,
decision_deposit: 1 * DOLLARS,
decision_deposit: DOLLARS,
prepare_period: 30 * MINUTES,
decision_period: 7 * DAYS,
confirm_period: 30 * MINUTES,
min_enactment_period: 1 * MINUTES,
min_enactment_period: MINUTES,
min_approval: pallet_referenda::Curve::LinearDecreasing {
length: Perbill::from_percent(100),
floor: Perbill::from_percent(50),
@@ -182,11 +182,11 @@ impl pallet_referenda::TracksInfo<Balance, BlockNumber> for TracksInfo {
pallet_referenda::TrackInfo {
name: "senior experts",
max_deciding: 10,
decision_deposit: 1 * DOLLARS,
decision_deposit: DOLLARS,
prepare_period: 30 * MINUTES,
decision_period: 7 * DAYS,
confirm_period: 30 * MINUTES,
min_enactment_period: 1 * MINUTES,
min_enactment_period: MINUTES,
min_approval: pallet_referenda::Curve::LinearDecreasing {
length: Perbill::from_percent(100),
floor: Perbill::from_percent(50),
@@ -204,11 +204,11 @@ impl pallet_referenda::TracksInfo<Balance, BlockNumber> for TracksInfo {
pallet_referenda::TrackInfo {
name: "masters",
max_deciding: 10,
decision_deposit: 1 * DOLLARS,
decision_deposit: DOLLARS,
prepare_period: 30 * MINUTES,
decision_period: 7 * DAYS,
confirm_period: 30 * MINUTES,
min_enactment_period: 1 * MINUTES,
min_enactment_period: MINUTES,
min_approval: pallet_referenda::Curve::LinearDecreasing {
length: Perbill::from_percent(100),
floor: Perbill::from_percent(50),
@@ -226,11 +226,11 @@ impl pallet_referenda::TracksInfo<Balance, BlockNumber> for TracksInfo {
pallet_referenda::TrackInfo {
name: "senior masters",
max_deciding: 10,
decision_deposit: 1 * DOLLARS,
decision_deposit: DOLLARS,
prepare_period: 30 * MINUTES,
decision_period: 7 * DAYS,
confirm_period: 30 * MINUTES,
min_enactment_period: 1 * MINUTES,
min_enactment_period: MINUTES,
min_approval: pallet_referenda::Curve::LinearDecreasing {
length: Perbill::from_percent(100),
floor: Perbill::from_percent(50),
@@ -248,11 +248,11 @@ impl pallet_referenda::TracksInfo<Balance, BlockNumber> for TracksInfo {
pallet_referenda::TrackInfo {
name: "grand masters",
max_deciding: 10,
decision_deposit: 1 * DOLLARS,
decision_deposit: DOLLARS,
prepare_period: 30 * MINUTES,
decision_period: 7 * DAYS,
confirm_period: 30 * MINUTES,
min_enactment_period: 1 * MINUTES,
min_enactment_period: MINUTES,
min_approval: pallet_referenda::Curve::LinearDecreasing {
length: Perbill::from_percent(100),
floor: Perbill::from_percent(50),
@@ -59,7 +59,7 @@ where
let pallet_acc: AccountIdOf<T> = PalletAccount::get();
let treasury_acc: AccountIdOf<T> = TreasuryAccount::get();
<pallet_balances::Pallet<T>>::resolve_creating(&pallet_acc.clone(), amount);
<pallet_balances::Pallet<T>>::resolve_creating(&pallet_acc, amount);
let result = <pallet_xcm::Pallet<T>>::teleport_assets(
<<T as frame_system::Config>::RuntimeOrigin>::signed(pallet_acc.into()),
@@ -73,10 +73,9 @@ where
0,
);
match result {
Err(err) => log::warn!("Failed to teleport slashed assets: {:?}", err),
_ => (),
};
if let Err(err) = result {
log::warn!("Failed to teleport slashed assets: {:?}", err);
}
}
}
@@ -216,7 +216,7 @@ impl pallet_balances::Config for Runtime {
parameter_types! {
/// Relay Chain `TransactionByteFee` / 10
pub const TransactionByteFee: Balance = 1 * MILLICENTS;
pub const TransactionByteFee: Balance = MILLICENTS;
}
impl pallet_transaction_payment::Config for Runtime {
@@ -843,7 +843,7 @@ impl_runtime_apis! {
list_benchmarks!(list, extra);
let storage_info = AllPalletsWithSystem::storage_info();
return (list, storage_info)
(list, storage_info)
}
fn dispatch_benchmark(
@@ -899,7 +899,7 @@ impl cumulus_pallet_parachain_system::CheckInherents<Block> for CheckInherents {
.create_inherent_data()
.expect("Could not create the timestamp inherent data");
inherent_data.check_extrinsics(&block)
inherent_data.check_extrinsics(block)
}
}
@@ -137,58 +137,54 @@ impl Contains<RuntimeCall> for SafeCallFilter {
}
}
match call {
matches!(
call,
RuntimeCall::System(
frame_system::Call::set_heap_pages { .. } |
frame_system::Call::set_code { .. } |
frame_system::Call::set_code_without_checks { .. } |
frame_system::Call::kill_prefix { .. },
) |
RuntimeCall::ParachainSystem(..) |
RuntimeCall::Timestamp(..) |
RuntimeCall::Balances(..) |
RuntimeCall::CollatorSelection(
pallet_collator_selection::Call::set_desired_candidates { .. } |
pallet_collator_selection::Call::set_candidacy_bond { .. } |
pallet_collator_selection::Call::register_as_candidate { .. } |
pallet_collator_selection::Call::leave_intent { .. },
) |
RuntimeCall::Session(pallet_session::Call::purge_keys { .. }) |
RuntimeCall::PolkadotXcm(pallet_xcm::Call::force_xcm_version { .. }) |
RuntimeCall::XcmpQueue(..) |
RuntimeCall::DmpQueue(..) |
RuntimeCall::Utility(pallet_utility::Call::as_derivative { .. }) |
RuntimeCall::Alliance(
// `init_members` accepts unbounded vecs as arguments,
// but the call can be initiated only by root origin.
pallet_alliance::Call::init_members { .. } |
pallet_alliance::Call::vote { .. } |
pallet_alliance::Call::disband { .. } |
pallet_alliance::Call::set_rule { .. } |
pallet_alliance::Call::announce { .. } |
pallet_alliance::Call::remove_announcement { .. } |
pallet_alliance::Call::join_alliance { .. } |
pallet_alliance::Call::nominate_ally { .. } |
pallet_alliance::Call::elevate_ally { .. } |
pallet_alliance::Call::give_retirement_notice { .. } |
pallet_alliance::Call::retire { .. } |
pallet_alliance::Call::kick_member { .. } |
pallet_alliance::Call::close { .. } |
pallet_alliance::Call::abdicate_fellow_status { .. },
) |
RuntimeCall::AllianceMotion(
frame_system::Call::set_code { .. } |
frame_system::Call::set_code_without_checks { .. } |
frame_system::Call::kill_prefix { .. },
) | RuntimeCall::ParachainSystem(..) |
RuntimeCall::Timestamp(..) |
RuntimeCall::Balances(..) |
RuntimeCall::CollatorSelection(
pallet_collator_selection::Call::set_desired_candidates { .. } |
pallet_collator_selection::Call::set_candidacy_bond { .. } |
pallet_collator_selection::Call::register_as_candidate { .. } |
pallet_collator_selection::Call::leave_intent { .. },
) | RuntimeCall::Session(pallet_session::Call::purge_keys { .. }) |
RuntimeCall::PolkadotXcm(pallet_xcm::Call::force_xcm_version { .. }) |
RuntimeCall::XcmpQueue(..) |
RuntimeCall::DmpQueue(..) |
RuntimeCall::Utility(pallet_utility::Call::as_derivative { .. }) |
RuntimeCall::Alliance(
// `init_members` accepts unbounded vecs as arguments,
// but the call can be initiated only by root origin.
pallet_alliance::Call::init_members { .. } |
pallet_alliance::Call::vote { .. } |
pallet_alliance::Call::disband { .. } |
pallet_alliance::Call::set_rule { .. } |
pallet_alliance::Call::announce { .. } |
pallet_alliance::Call::remove_announcement { .. } |
pallet_alliance::Call::join_alliance { .. } |
pallet_alliance::Call::nominate_ally { .. } |
pallet_alliance::Call::elevate_ally { .. } |
pallet_alliance::Call::give_retirement_notice { .. } |
pallet_alliance::Call::retire { .. } |
pallet_alliance::Call::kick_member { .. } |
pallet_alliance::Call::close { .. } |
pallet_alliance::Call::abdicate_fellow_status { .. },
) | RuntimeCall::AllianceMotion(
pallet_collective::Call::vote { .. } |
pallet_collective::Call::disapprove_proposal { .. } |
pallet_collective::Call::close { .. },
) |
RuntimeCall::FellowshipCollective(
pallet_collective::Call::disapprove_proposal { .. } |
pallet_collective::Call::close { .. },
) | RuntimeCall::FellowshipCollective(
pallet_ranked_collective::Call::add_member { .. } |
pallet_ranked_collective::Call::promote_member { .. } |
pallet_ranked_collective::Call::demote_member { .. } |
pallet_ranked_collective::Call::remove_member { .. },
) => true,
_ => false,
}
pallet_ranked_collective::Call::promote_member { .. } |
pallet_ranked_collective::Call::demote_member { .. } |
pallet_ranked_collective::Call::remove_member { .. },
)
)
}
}