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
+18 -18
View File
@@ -324,8 +324,8 @@ pub mod pallet {
/// - One event.
/// # </weight>
#[pallet::weight( T::WeightInfo::set_identity(
T::MaxRegistrars::get().into(), // R
T::MaxAdditionalFields::get().into(), // X
T::MaxRegistrars::get(), // R
T::MaxAdditionalFields::get(), // X
))]
pub fn set_identity(
origin: OriginFor<T>,
@@ -416,7 +416,7 @@ pub mod pallet {
let new_deposit = T::SubAccountDeposit::get() * <BalanceOf<T>>::from(subs.len() as u32);
let not_other_sub =
subs.iter().filter_map(|i| SuperOf::<T>::get(&i.0)).all(|i| &i.0 == &sender);
subs.iter().filter_map(|i| SuperOf::<T>::get(&i.0)).all(|i| i.0 == sender);
ensure!(not_other_sub, Error::<T>::AlreadyClaimed);
if old_deposit < new_deposit {
@@ -470,9 +470,9 @@ pub mod pallet {
/// - One event.
/// # </weight>
#[pallet::weight(T::WeightInfo::clear_identity(
T::MaxRegistrars::get().into(), // R
T::MaxSubAccounts::get().into(), // S
T::MaxAdditionalFields::get().into(), // X
T::MaxRegistrars::get(), // R
T::MaxSubAccounts::get(), // S
T::MaxAdditionalFields::get(), // X
))]
pub fn clear_identity(origin: OriginFor<T>) -> DispatchResultWithPostInfo {
let sender = ensure_signed(origin)?;
@@ -484,7 +484,7 @@ pub mod pallet {
<SuperOf<T>>::remove(sub);
}
let err_amount = T::Currency::unreserve(&sender, deposit.clone());
let err_amount = T::Currency::unreserve(&sender, deposit);
debug_assert!(err_amount.is_zero());
Self::deposit_event(Event::IdentityCleared { who: sender, deposit });
@@ -521,8 +521,8 @@ pub mod pallet {
/// - One event.
/// # </weight>
#[pallet::weight(T::WeightInfo::request_judgement(
T::MaxRegistrars::get().into(), // R
T::MaxAdditionalFields::get().into(), // X
T::MaxRegistrars::get(), // R
T::MaxAdditionalFields::get(), // X
))]
pub fn request_judgement(
origin: OriginFor<T>,
@@ -542,7 +542,7 @@ pub mod pallet {
match id.judgements.binary_search_by_key(&reg_index, |x| x.0) {
Ok(i) =>
if id.judgements[i].1.is_sticky() {
Err(Error::<T>::StickyJudgement)?
return Err(Error::<T>::StickyJudgement.into())
} else {
id.judgements[i] = item
},
@@ -583,8 +583,8 @@ pub mod pallet {
/// - One event
/// # </weight>
#[pallet::weight(T::WeightInfo::cancel_request(
T::MaxRegistrars::get().into(), // R
T::MaxAdditionalFields::get().into(), // X
T::MaxRegistrars::get(), // R
T::MaxAdditionalFields::get(), // X
))]
pub fn cancel_request(
origin: OriginFor<T>,
@@ -600,7 +600,7 @@ pub mod pallet {
let fee = if let Judgement::FeePaid(fee) = id.judgements.remove(pos).1 {
fee
} else {
Err(Error::<T>::JudgementGiven)?
return Err(Error::<T>::JudgementGiven.into())
};
let err_amount = T::Currency::unreserve(&sender, fee);
@@ -754,8 +754,8 @@ pub mod pallet {
/// - One event.
/// # </weight>
#[pallet::weight(T::WeightInfo::provide_judgement(
T::MaxRegistrars::get().into(), // R
T::MaxAdditionalFields::get().into(), // X
T::MaxRegistrars::get(), // R
T::MaxAdditionalFields::get(), // X
))]
pub fn provide_judgement(
origin: OriginFor<T>,
@@ -821,9 +821,9 @@ pub mod pallet {
/// - One event.
/// # </weight>
#[pallet::weight(T::WeightInfo::kill_identity(
T::MaxRegistrars::get().into(), // R
T::MaxSubAccounts::get().into(), // S
T::MaxAdditionalFields::get().into(), // X
T::MaxRegistrars::get(), // R
T::MaxSubAccounts::get(), // S
T::MaxAdditionalFields::get(), // X
))]
pub fn kill_identity(
origin: OriginFor<T>,