Make clippy _a little_ more annoying (#10570)

* Clippy: +complexity

* Update client/cli/src/arg_enums.rs

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>

* Update bin/node/inspect/src/lib.rs

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>

* Update primitives/keystore/src/testing.rs

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>

* Update frame/elections/src/lib.rs

Co-authored-by: Keith Yeung <kungfukeith11@gmail.com>

* Update primitives/npos-elections/fuzzer/src/reduce.rs

Co-authored-by: Keith Yeung <kungfukeith11@gmail.com>

* Incorporating feedback

* No need for Ok

* Additional

* Needed slice

* Wigy's suggestions on less derefs

* fix count

* reverting changes brought in by option_map_unit_fn

* add --all-targets

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
Co-authored-by: Keith Yeung <kungfukeith11@gmail.com>
This commit is contained in:
Squirrel
2022-01-05 14:35:30 +00:00
committed by GitHub
parent 48444ffdc0
commit 3dd32d5255
88 changed files with 190 additions and 249 deletions
-1
View File
@@ -672,7 +672,6 @@ mod test {
assert_eq!(rw_tracker.1, 0);
assert_eq!(rw_tracker.2, 2);
assert_eq!(rw_tracker.3, 0);
drop(rw_tracker);
bench_state.wipe().unwrap();
}
}
+3 -3
View File
@@ -1993,7 +1993,7 @@ impl<Block: BlockT> sc_client_api::backend::Backend<Block> for Backend<Block> {
});
let database_cache = MemorySize::from_bytes(0);
let state_cache =
MemorySize::from_bytes((*&self.shared_cache).read().used_storage_cache_size());
MemorySize::from_bytes(self.shared_cache.read().used_storage_cache_size());
let state_db = self.storage.state_db.memory_info();
Some(UsageInfo {
@@ -2452,7 +2452,7 @@ pub(crate) mod tests {
let storage = vec![(vec![1, 3, 5], None), (vec![5, 5, 5], Some(vec![4, 5, 6]))];
let (root, overlay) = op.old_state.storage_root(
storage.iter().map(|(k, v)| (&k[..], v.as_ref().map(|v| &v[..]))),
storage.iter().map(|(k, v)| (k.as_slice(), v.as_ref().map(|v| &v[..]))),
state_version,
);
op.update_db_storage(overlay).unwrap();
@@ -3000,7 +3000,7 @@ pub(crate) mod tests {
let storage = vec![(b"test".to_vec(), Some(b"test2".to_vec()))];
let (root, overlay) = op.old_state.storage_root(
storage.iter().map(|(k, v)| (&k[..], v.as_ref().map(|v| &v[..]))),
storage.iter().map(|(k, v)| (k.as_slice(), v.as_ref().map(|v| &v[..]))),
state_version,
);
op.update_db_storage(overlay).unwrap();
+1 -1
View File
@@ -92,7 +92,7 @@ impl sp_core::offchain::OffchainStorage for LocalStorage {
{
let _key_guard = key_lock.lock();
let val = self.db.get(columns::OFFCHAIN, &key);
is_set = val.as_ref().map(|x| &**x) == old_value;
is_set = val.as_deref() == old_value;
if is_set {
self.set(prefix, item_key, new_value)