Fix minor clippy lints in grandpa (#5988)

* grandpa: fix clippy lints about identity conversions

* grandpa: fix clippy lints about unwrap_or_default

* grandpa: fix clippy lints about explicit return

* grandpa: fix clippy lints about unnecessary intermediary

* grandpa: fix clippy lints about to_string

* grandpa: fix clippy lints about unused imports

* grandpa: fix clippy lints about increments

* grandpa: fix clippy lints about unnecessary matches

* grandpa: fix clippy lints about struct arguments

* Fix clippy::redundant_clone

* Fix clippy::clone_on_copy

* Fix clippy::or_fun_call

* Fix clippy::identity_conversion
This commit is contained in:
Jon Häggblad
2020-05-13 18:40:52 +02:00
committed by GitHub
parent 10492c0689
commit b99033368b
14 changed files with 53 additions and 58 deletions
@@ -258,7 +258,7 @@ impl<Block, BStatus, BSyncRequester, I, M> Stream for UntilImported<Block, BStat
Poll::Ready(Some(notification)) => {
// new block imported. queue up all messages tied to that hash.
if let Some((_, _, messages)) = this.pending.remove(&notification.hash) {
let canon_number = notification.header.number().clone();
let canon_number = *notification.header.number();
let ready_messages = messages.into_iter()
.filter_map(|m| m.wait_completed(canon_number));
@@ -359,7 +359,7 @@ impl<Block: BlockT> BlockUntilImported<Block> for SignedMessage<Block> {
}
}
return Ok(DiscardWaitOrReady::Wait(vec![(target_hash, target_number, msg)]))
Ok(DiscardWaitOrReady::Wait(vec![(target_hash, target_number, msg)]))
}
fn wait_completed(self, canon_number: NumberFor<Block>) -> Option<Self::Blocked> {
@@ -430,7 +430,7 @@ impl<Block: BlockT> BlockUntilImported<Block> for BlockGlobalMessage<Block> {
let mut query_known = |target_hash, perceived_number| -> Result<bool, Error> {
// check integrity: all votes for same hash have same number.
let canon_number = match checked_hashes.entry(target_hash) {
Entry::Occupied(entry) => entry.get().number().clone(),
Entry::Occupied(entry) => *entry.get().number(),
Entry::Vacant(entry) => {
if let Some(number) = status_check.block_number(target_hash)? {
entry.insert(KnownOrUnknown::Known(number));