mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-14 08:41:07 +00:00
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:
committed by
GitHub
parent
a990473cf9
commit
b581604aa7
@@ -123,8 +123,9 @@ impl<T: Config> Pallet<T> {
|
||||
.claimed_rewards
|
||||
.retain(|&x| x >= current_era.saturating_sub(history_depth));
|
||||
match ledger.claimed_rewards.binary_search(&era) {
|
||||
Ok(_) => Err(Error::<T>::AlreadyClaimed
|
||||
.with_weight(T::WeightInfo::payout_stakers_alive_staked(0)))?,
|
||||
Ok(_) =>
|
||||
return Err(Error::<T>::AlreadyClaimed
|
||||
.with_weight(T::WeightInfo::payout_stakers_alive_staked(0))),
|
||||
Err(pos) => ledger.claimed_rewards.insert(pos, era),
|
||||
}
|
||||
|
||||
@@ -146,8 +147,8 @@ impl<T: Config> Pallet<T> {
|
||||
let validator_reward_points = era_reward_points
|
||||
.individual
|
||||
.get(&ledger.stash)
|
||||
.map(|points| *points)
|
||||
.unwrap_or_else(|| Zero::zero());
|
||||
.copied()
|
||||
.unwrap_or_else(Zero::zero);
|
||||
|
||||
// Nothing to do if they have no reward points.
|
||||
if validator_reward_points.is_zero() {
|
||||
@@ -260,8 +261,7 @@ impl<T: Config> Pallet<T> {
|
||||
0
|
||||
});
|
||||
|
||||
let era_length =
|
||||
session_index.checked_sub(current_era_start_session_index).unwrap_or(0); // Must never happen.
|
||||
let era_length = session_index.saturating_sub(current_era_start_session_index); // Must never happen.
|
||||
|
||||
match ForceEra::<T>::get() {
|
||||
// Will be set to `NotForcing` again if a new era has been triggered.
|
||||
@@ -1036,7 +1036,7 @@ impl<T: Config> ElectionDataProvider for Pallet<T> {
|
||||
);
|
||||
Self::do_add_nominator(
|
||||
&v,
|
||||
Nominations { targets: t.try_into().unwrap(), submitted_in: 0, suppressed: false },
|
||||
Nominations { targets: t, submitted_in: 0, suppressed: false },
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -580,7 +580,7 @@ pub mod pallet {
|
||||
status
|
||||
);
|
||||
assert!(
|
||||
T::Currency::free_balance(&stash) >= balance,
|
||||
T::Currency::free_balance(stash) >= balance,
|
||||
"Stash does not have enough balance to bond."
|
||||
);
|
||||
frame_support::assert_ok!(<Pallet<T>>::bond(
|
||||
@@ -779,18 +779,18 @@ pub mod pallet {
|
||||
let stash = ensure_signed(origin)?;
|
||||
|
||||
if <Bonded<T>>::contains_key(&stash) {
|
||||
Err(Error::<T>::AlreadyBonded)?
|
||||
return Err(Error::<T>::AlreadyBonded.into())
|
||||
}
|
||||
|
||||
let controller = T::Lookup::lookup(controller)?;
|
||||
|
||||
if <Ledger<T>>::contains_key(&controller) {
|
||||
Err(Error::<T>::AlreadyPaired)?
|
||||
return Err(Error::<T>::AlreadyPaired.into())
|
||||
}
|
||||
|
||||
// Reject a bond which is considered to be _dust_.
|
||||
if value < T::Currency::minimum_balance() {
|
||||
Err(Error::<T>::InsufficientBond)?
|
||||
return Err(Error::<T>::InsufficientBond.into())
|
||||
}
|
||||
|
||||
frame_system::Pallet::<T>::inc_consumers(&stash).map_err(|_| Error::<T>::BadState)?;
|
||||
@@ -862,7 +862,7 @@ pub mod pallet {
|
||||
debug_assert_eq!(T::VoterList::sanity_check(), Ok(()));
|
||||
}
|
||||
|
||||
Self::deposit_event(Event::<T>::Bonded(stash.clone(), extra));
|
||||
Self::deposit_event(Event::<T>::Bonded(stash, extra));
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
@@ -1183,7 +1183,7 @@ pub mod pallet {
|
||||
let old_controller = Self::bonded(&stash).ok_or(Error::<T>::NotStash)?;
|
||||
let controller = T::Lookup::lookup(controller)?;
|
||||
if <Ledger<T>>::contains_key(&controller) {
|
||||
Err(Error::<T>::AlreadyPaired)?
|
||||
return Err(Error::<T>::AlreadyPaired.into())
|
||||
}
|
||||
if controller != old_controller {
|
||||
<Bonded<T>>::insert(&stash, &controller);
|
||||
@@ -1466,8 +1466,8 @@ pub mod pallet {
|
||||
ensure_root(origin)?;
|
||||
if let Some(current_era) = Self::current_era() {
|
||||
HistoryDepth::<T>::mutate(|history_depth| {
|
||||
let last_kept = current_era.checked_sub(*history_depth).unwrap_or(0);
|
||||
let new_last_kept = current_era.checked_sub(new_history_depth).unwrap_or(0);
|
||||
let last_kept = current_era.saturating_sub(*history_depth);
|
||||
let new_last_kept = current_era.saturating_sub(new_history_depth);
|
||||
for era_index in last_kept..new_last_kept {
|
||||
Self::clear_era_information(era_index);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user