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 4dc50c8d89
commit c312f0b9a6
92 changed files with 910 additions and 967 deletions
+10 -12
View File
@@ -46,7 +46,7 @@ fn create_account_extrinsics(client: &Client, accounts: &[sr25519::Pair]) -> Vec
accounts
.iter()
.enumerate()
.map(|(i, a)| {
.flat_map(|(i, a)| {
vec![
// Reset the nonce by removing any funds
construct_extrinsic(
@@ -54,7 +54,7 @@ fn create_account_extrinsics(client: &Client, accounts: &[sr25519::Pair]) -> Vec
SudoCall::sudo {
call: Box::new(
BalancesCall::force_set_balance {
who: AccountId::from(a.public()).into(),
who: AccountId::from(a.public()),
new_free: 0,
}
.into(),
@@ -69,7 +69,7 @@ fn create_account_extrinsics(client: &Client, accounts: &[sr25519::Pair]) -> Vec
SudoCall::sudo {
call: Box::new(
BalancesCall::force_set_balance {
who: AccountId::from(a.public()).into(),
who: AccountId::from(a.public()),
new_free: 1_000_000_000_000 * ExistentialDeposit::get(),
}
.into(),
@@ -80,7 +80,6 @@ fn create_account_extrinsics(client: &Client, accounts: &[sr25519::Pair]) -> Vec
),
]
})
.flatten()
.map(OpaqueExtrinsic::from)
.collect()
}
@@ -92,20 +91,19 @@ fn create_benchmark_extrinsics(
) -> Vec<OpaqueExtrinsic> {
accounts
.iter()
.map(|account| {
.flat_map(|account| {
(0..extrinsics_per_account).map(move |nonce| {
construct_extrinsic(
client,
BalancesCall::transfer_allow_death {
dest: Bob.to_account_id().into(),
value: 1 * ExistentialDeposit::get(),
dest: Bob.to_account_id(),
value: ExistentialDeposit::get(),
},
account.clone(),
Some(nonce as u32),
)
})
})
.flatten()
.map(OpaqueExtrinsic::from)
.collect()
}
@@ -208,27 +206,27 @@ fn transaction_throughput_benchmarks(c: &mut Criterion) {
|b| {
b.iter_batched(
|| {
let prepare_extrinsics = create_account_extrinsics(&*dave.client, &accounts);
let prepare_extrinsics = create_account_extrinsics(&dave.client, &accounts);
benchmark_handle.block_on(future::join_all(
prepare_extrinsics.into_iter().map(|tx| {
submit_tx_and_wait_for_inclusion(
&dave.transaction_pool,
tx,
&*dave.client,
&dave.client,
true,
)
}),
));
create_benchmark_extrinsics(&*dave.client, &accounts, extrinsics_per_account)
create_benchmark_extrinsics(&dave.client, &accounts, extrinsics_per_account)
},
|extrinsics| {
benchmark_handle.block_on(future::join_all(extrinsics.into_iter().map(|tx| {
submit_tx_and_wait_for_inclusion(
&dave.transaction_pool,
tx,
&*dave.client,
&dave.client,
false,
)
})));