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
@@ -275,8 +275,8 @@ impl<B: BlockT + DeserializeOwned> Default for Builder<B> {
impl<B: BlockT + DeserializeOwned> Builder<B> {
fn as_online(&self) -> &OnlineConfig<B> {
match &self.mode {
Mode::Online(config) => &config,
Mode::OfflineOrElseOnline(_, config) => &config,
Mode::Online(config) => config,
Mode::OfflineOrElseOnline(_, config) => config,
_ => panic!("Unexpected mode: Online"),
}
}
@@ -380,7 +380,7 @@ impl<B: BlockT + DeserializeOwned> Builder<B> {
log::error!(
target: LOG_TARGET,
"failed to execute batch: {:?}. Error: {:?}",
chunk_keys.iter().map(|k| HexDisplay::from(k)).collect::<Vec<_>>(),
chunk_keys.iter().map(HexDisplay::from).collect::<Vec<_>>(),
e
);
"batch failed."
@@ -388,7 +388,7 @@ impl<B: BlockT + DeserializeOwned> Builder<B> {
assert_eq!(chunk_keys.len(), values.len());
for (idx, key) in chunk_keys.into_iter().enumerate() {
for (idx, key) in chunk_keys.iter().enumerate() {
let maybe_value = values[idx].clone();
let value = maybe_value.unwrap_or_else(|| {
log::warn!(target: LOG_TARGET, "key {:?} had none corresponding value.", &key);
@@ -452,7 +452,7 @@ impl<B: BlockT + DeserializeOwned> Builder<B> {
assert_eq!(batch_child_key.len(), batch_response.len());
for (idx, key) in batch_child_key.into_iter().enumerate() {
for (idx, key) in batch_child_key.iter().enumerate() {
let maybe_value = batch_response[idx].clone();
let value = maybe_value.unwrap_or_else(|| {
log::warn!(target: LOG_TARGET, "key {:?} had none corresponding value.", &key);
@@ -571,7 +571,7 @@ impl<B: BlockT + DeserializeOwned> Builder<B> {
&self,
top_kv: &[KeyValue],
) -> Result<ChildKeyValues, &'static str> {
let child_kv = self.load_child_remote(&top_kv).await?;
let child_kv = self.load_child_remote(top_kv).await?;
if let Some(c) = &self.as_online().state_snapshot {
self.save_child_snapshot(&child_kv, &c.path)?;
}
@@ -612,7 +612,7 @@ impl<B: BlockT + DeserializeOwned> Builder<B> {
},
};
child_kv.push((ChildInfo::new_default(&un_prefixed), child_kv_inner));
child_kv.push((ChildInfo::new_default(un_prefixed), child_kv_inner));
}
Ok(child_kv)
@@ -624,8 +624,7 @@ impl<B: BlockT + DeserializeOwned> Builder<B> {
let at = self
.as_online()
.at
.expect("online config must be initialized by this point; qed.")
.clone();
.expect("online config must be initialized by this point; qed.");
log::info!(target: LOG_TARGET, "scraping key-pairs from remote @ {:?}", at);
let mut keys_and_values = if config.pallets.len() > 0 {
@@ -848,7 +847,7 @@ impl<B: BlockT + DeserializeOwned> Builder<B> {
info!(
target: LOG_TARGET,
"injecting a total of {} child keys",
child_kv.iter().flat_map(|(_, kv)| kv).count(),
child_kv.iter().flat_map(|(_, kv)| kv).count()
);
for (info, key_values) in child_kv {