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
@@ -887,7 +887,7 @@ impl<Block: BlockT> Inner<Block> {
// any catch up requests until we import this one (either with a
// success or failure).
self.pending_catch_up = PendingCatchUp::Processing {
instant: instant.clone(),
instant: *instant,
};
// always discard catch up messages, they're point-to-point
@@ -1281,7 +1281,7 @@ impl<Block: BlockT> GossipValidator<Block> {
inner: parking_lot::RwLock::new(Inner::new(config)),
set_state,
report_sender: tx,
metrics: metrics,
metrics,
};
(val, rx)
@@ -236,16 +236,14 @@ impl<B: BlockT, N: Network<B>> NetworkBridge<B, N> {
let (neighbor_packet_worker, neighbor_packet_sender) = periodic::NeighborPacketWorker::new();
let bridge = NetworkBridge {
NetworkBridge {
service,
gossip_engine,
validator,
neighbor_sender: neighbor_packet_sender,
neighbor_packet_worker: Arc::new(Mutex::new(neighbor_packet_worker)),
gossip_validator_report_stream: Arc::new(Mutex::new(report_stream)),
};
bridge
}
}
/// Note the beginning of a new round to the `GossipValidator`.
@@ -304,7 +302,7 @@ impl<B: BlockT, N: Network<B>> NetworkBridge<B, N> {
match decoded {
Err(ref e) => {
debug!(target: "afg", "Skipping malformed message {:?}: {}", notification, e);
return future::ready(None);
future::ready(None)
}
Ok(GossipMessage::Vote(msg)) => {
// check signature.
@@ -343,7 +341,7 @@ impl<B: BlockT, N: Network<B>> NetworkBridge<B, N> {
}
_ => {
debug!(target: "afg", "Skipping unknown message type");
return future::ready(None);
future::ready(None)
}
}
});
@@ -666,7 +664,7 @@ impl<Block: BlockT> Sink<Message<Block>> for OutgoingMessages<Block>
// when locals exist, sign messages on import
if let Some((ref pair, _)) = self.locals {
let target_hash = msg.target().0.clone();
let target_hash = *(msg.target().0);
let signed = sp_finality_grandpa::sign_message(
msg,
pair,
@@ -86,7 +86,7 @@ impl <B: BlockT> Stream for NeighborPacketWorker<B> {
this.delay.reset(REBROADCAST_AFTER);
this.last = Some((to.clone(), packet.clone()));
return Poll::Ready(Some((to, GossipMessage::<B>::from(packet.clone()))));
return Poll::Ready(Some((to, GossipMessage::<B>::from(packet))));
}
// Don't return yet, maybe the timer fired.
Poll::Pending => {},
@@ -108,6 +108,6 @@ impl <B: BlockT> Stream for NeighborPacketWorker<B> {
return Poll::Ready(Some((to.clone(), GossipMessage::<B>::from(packet.clone()))));
}
return Poll::Pending;
Poll::Pending
}
}