Apply some clippy lints (#11154)

* Apply some clippy hints

* Revert clippy ci changes

* Update client/cli/src/commands/generate.rs

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>

* Update client/cli/src/commands/inspect_key.rs

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>

* Update client/db/src/bench.rs

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>

* Update client/db/src/bench.rs

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>

* Update client/service/src/client/block_rules.rs

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>

* Update client/service/src/client/block_rules.rs

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>

* Update client/network/src/transactions.rs

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>

* Update client/network/src/protocol.rs

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>

* Revert due to missing `or_default` function.

* Fix compilation and simplify code

* Undo change that corrupts benchmark.

* fix clippy

* Update client/service/test/src/lib.rs

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>

* Update client/state-db/src/noncanonical.rs

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>

* Update client/state-db/src/noncanonical.rs

remove leftovers!

* Update client/tracing/src/logging/directives.rs

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>

* Update utils/fork-tree/src/lib.rs

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>

* added needed ref

* Update frame/referenda/src/benchmarking.rs

* Simplify byte-vec creation

* let's just not overlap the ranges

* Correction

* cargo fmt

* Update utils/frame/benchmarking-cli/src/shared/stats.rs

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>

* Update utils/frame/benchmarking-cli/src/pallet/command.rs

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>

* Update utils/frame/benchmarking-cli/src/pallet/command.rs

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
Co-authored-by: Giles Cope <gilescope@gmail.com>
This commit is contained in:
Falco Hirschenberger
2022-04-30 23:28:27 +02:00
committed by GitHub
parent a990473cf9
commit b581604aa7
368 changed files with 1927 additions and 2236 deletions
+7 -7
View File
@@ -72,7 +72,7 @@ fn add_vesting_schedules<T: Config>(
T::Currency::make_free_balance_be(&source, BalanceOf::<T>::max_value());
}
Ok(total_locked.into())
Ok(total_locked)
}
benchmarks! {
@@ -91,7 +91,7 @@ benchmarks! {
assert_eq!(System::<T>::block_number(), T::BlockNumber::zero());
assert_eq!(
Vesting::<T>::vesting_balance(&caller),
Some(expected_balance.into()),
Some(expected_balance),
"Vesting schedule not added",
);
}: vest(RawOrigin::Signed(caller.clone()))
@@ -99,7 +99,7 @@ benchmarks! {
// Nothing happened since everything is still vested.
assert_eq!(
Vesting::<T>::vesting_balance(&caller),
Some(expected_balance.into()),
Some(expected_balance),
"Vesting schedule was removed",
);
}
@@ -156,7 +156,7 @@ benchmarks! {
// Nothing happened since everything is still vested.
assert_eq!(
Vesting::<T>::vesting_balance(&other),
Some(expected_balance.into()),
Some(expected_balance),
"Vesting schedule was removed",
);
}
@@ -260,7 +260,7 @@ benchmarks! {
);
assert_eq!(
Vesting::<T>::vesting_balance(&target),
Some(expected_balance.into()),
Some(expected_balance),
"Lock not correctly updated",
);
}
@@ -274,7 +274,7 @@ benchmarks! {
// Give target existing locks.
add_locks::<T>(&caller, l as u8);
// Add max vesting schedules.
let expected_balance = add_vesting_schedules::<T>(caller_lookup.clone(), s)?;
let expected_balance = add_vesting_schedules::<T>(caller_lookup, s)?;
// Schedules are not vesting at block 0.
assert_eq!(System::<T>::block_number(), T::BlockNumber::zero());
@@ -324,7 +324,7 @@ benchmarks! {
// Give target other locks.
add_locks::<T>(&caller, l as u8);
// Add max vesting schedules.
let total_transferred = add_vesting_schedules::<T>(caller_lookup.clone(), s)?;
let total_transferred = add_vesting_schedules::<T>(caller_lookup, s)?;
// Go to about half way through all the schedules duration. (They all start at 1, and have a duration of 20 or 21).
System::<T>::set_block_number(11u32.into());
+5 -5
View File
@@ -121,10 +121,10 @@ impl VestingAction {
}
/// Pick the schedules that this action dictates should continue vesting undisturbed.
fn pick_schedules<'a, T: Config>(
&'a self,
fn pick_schedules<T: Config>(
&self,
schedules: Vec<VestingInfo<BalanceOf<T>, T::BlockNumber>>,
) -> impl Iterator<Item = VestingInfo<BalanceOf<T>, T::BlockNumber>> + 'a {
) -> impl Iterator<Item = VestingInfo<BalanceOf<T>, T::BlockNumber>> + '_ {
schedules.into_iter().enumerate().filter_map(move |(index, schedule)| {
if self.should_remove(index) {
None
@@ -710,7 +710,7 @@ where
let (schedules, locked_now) =
Self::exec_action(schedules.to_vec(), VestingAction::Passive)?;
Self::write_vesting(&who, schedules)?;
Self::write_vesting(who, schedules)?;
Self::write_lock(who, locked_now);
Ok(())
@@ -744,7 +744,7 @@ where
let (schedules, locked_now) = Self::exec_action(schedules.to_vec(), remove_action)?;
Self::write_vesting(&who, schedules)?;
Self::write_vesting(who, schedules)?;
Self::write_lock(who, locked_now);
Ok(())
}