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 -12
View File
@@ -57,7 +57,7 @@
pub use pallet::*;
const LOG_TARGET: &'static str = "runtime::state-trie-migration";
const LOG_TARGET: &str = "runtime::state-trie-migration";
#[macro_export]
macro_rules! log {
@@ -319,12 +319,12 @@ pub mod pallet {
let (maybe_current_child, child_root) = match (&self.progress_child, &self.progress_top)
{
(Progress::LastKey(last_child), Progress::LastKey(last_top)) => {
let child_root = Pallet::<T>::transform_child_key_or_halt(&last_top);
let maybe_current_child = child_io::next_key(child_root, &last_child);
let child_root = Pallet::<T>::transform_child_key_or_halt(last_top);
let maybe_current_child = child_io::next_key(child_root, last_child);
(maybe_current_child, child_root)
},
(Progress::ToStart, Progress::LastKey(last_top)) => {
let child_root = Pallet::<T>::transform_child_key_or_halt(&last_top);
let child_root = Pallet::<T>::transform_child_key_or_halt(last_top);
// Start with the empty key as first key.
(Some(Vec::new()), child_root)
},
@@ -336,7 +336,7 @@ pub mod pallet {
};
if let Some(current_child) = maybe_current_child.as_ref() {
let added_size = if let Some(data) = child_io::get(child_root, &current_child) {
let added_size = if let Some(data) = child_io::get(child_root, current_child) {
child_io::set(child_root, current_child, &data);
data.len() as u32
} else {
@@ -369,8 +369,8 @@ pub mod pallet {
};
if let Some(current_top) = maybe_current_top.as_ref() {
let added_size = if let Some(data) = sp_io::storage::get(&current_top) {
sp_io::storage::set(&current_top, &data);
let added_size = if let Some(data) = sp_io::storage::get(current_top) {
sp_io::storage::set(current_top, &data);
data.len() as u32
} else {
Zero::zero()
@@ -503,7 +503,7 @@ pub mod pallet {
) -> DispatchResult {
T::ControlOrigin::ensure_origin(origin)?;
AutoLimits::<T>::put(maybe_config);
Ok(().into())
Ok(())
}
/// Continue the migration for the given `limits`.
@@ -616,7 +616,7 @@ pub mod pallet {
let mut dyn_size = 0u32;
for key in &keys {
if let Some(data) = sp_io::storage::get(&key) {
if let Some(data) = sp_io::storage::get(key) {
dyn_size = dyn_size.saturating_add(data.len() as u32);
sp_io::storage::set(key, &data);
}
@@ -678,9 +678,9 @@ pub mod pallet {
let mut dyn_size = 0u32;
let transformed_child_key = Self::transform_child_key(&root).ok_or("bad child key")?;
for child_key in &child_keys {
if let Some(data) = child_io::get(transformed_child_key, &child_key) {
if let Some(data) = child_io::get(transformed_child_key, child_key) {
dyn_size = dyn_size.saturating_add(data.len() as u32);
child_io::set(transformed_child_key, &child_key, &data);
child_io::set(transformed_child_key, child_key, &data);
}
}
@@ -839,7 +839,7 @@ mod benchmarks {
// The size of the key seemingly makes no difference in the read/write time, so we make it
// constant.
const KEY: &'static [u8] = b"key";
const KEY: &[u8] = b"key";
frame_benchmarking::benchmarks! {
continue_migrate {