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
+12 -11
View File
@@ -77,7 +77,7 @@ const STORAGE_VERSION: StorageVersion = StorageVersion::new(4);
#[frame_support::pallet]
pub mod pallet {
use super::*;
use frame_support::pallet_prelude::*;
use frame_support::{dispatch::DispatchResult, pallet_prelude::*};
use frame_system::pallet_prelude::*;
#[pallet::pallet]
@@ -244,10 +244,11 @@ pub mod pallet {
origin: OriginFor<T>,
delay: T::BlockNumber,
best_finalized_block_number: T::BlockNumber,
) -> DispatchResultWithPostInfo {
) -> DispatchResult {
ensure_root(origin)?;
Ok(Self::on_stalled(delay, best_finalized_block_number).into())
Self::on_stalled(delay, best_finalized_block_number);
Ok(())
}
}
@@ -423,7 +424,7 @@ impl<T: Config> Pallet<T> {
Ok(())
} else {
Err(Error::<T>::PauseFailed)?
Err(Error::<T>::PauseFailed.into())
}
}
@@ -435,7 +436,7 @@ impl<T: Config> Pallet<T> {
Ok(())
} else {
Err(Error::<T>::ResumeFailed)?
Err(Error::<T>::ResumeFailed.into())
}
}
@@ -461,9 +462,9 @@ impl<T: Config> Pallet<T> {
if !<PendingChange<T>>::exists() {
let scheduled_at = <frame_system::Pallet<T>>::block_number();
if let Some(_) = forced {
if forced.is_some() {
if Self::next_forced().map_or(false, |next| next > scheduled_at) {
Err(Error::<T>::TooSoon)?
return Err(Error::<T>::TooSoon.into())
}
// only allow the next forced change when twice the window has passed since
@@ -488,7 +489,7 @@ impl<T: Config> Pallet<T> {
Ok(())
} else {
Err(Error::<T>::ChangePending)?
Err(Error::<T>::ChangePending.into())
}
}
@@ -544,14 +545,14 @@ impl<T: Config> Pallet<T> {
let previous_set_id_session_index = if set_id == 0 {
None
} else {
let session_index = Self::session_for_set(set_id - 1)
.ok_or_else(|| Error::<T>::InvalidEquivocationProof)?;
let session_index =
Self::session_for_set(set_id - 1).ok_or(Error::<T>::InvalidEquivocationProof)?;
Some(session_index)
};
let set_id_session_index =
Self::session_for_set(set_id).ok_or_else(|| Error::<T>::InvalidEquivocationProof)?;
Self::session_for_set(set_id).ok_or(Error::<T>::InvalidEquivocationProof)?;
// check that the session id for the membership proof is within the
// bounds of the set id reported in the equivocation.