mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-11 18:04:18 +00:00
Fix clippy's performance lints (#1286)
* Fix clippy perf lints * Cargo fmt * Add and to lint rule in Makefile * Fix some leftover clippy lints
This commit is contained in:
@@ -237,7 +237,7 @@ impl<T: BeaconChainTypes> AttestationService<T> {
|
||||
&mut self,
|
||||
_message_id: &MessageId,
|
||||
peer_id: &PeerId,
|
||||
subnet: &SubnetId,
|
||||
subnet: SubnetId,
|
||||
attestation: &Attestation<T::EthSpec>,
|
||||
) -> bool {
|
||||
// verify the attestation is on the correct subnet
|
||||
@@ -249,7 +249,7 @@ impl<T: BeaconChainTypes> AttestationService<T> {
|
||||
}
|
||||
};
|
||||
|
||||
if expected_subnet != *subnet {
|
||||
if expected_subnet != subnet {
|
||||
warn!(self.log, "Received an attestation on the wrong subnet"; "subnet_received" => format!("{:?}", subnet), "subnet_expected" => format!("{:?}",expected_subnet), "peer_id" => format!("{}", peer_id));
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -218,11 +218,9 @@ impl<T: BeaconChainTypes> Router<T> {
|
||||
match gossip_message {
|
||||
// Attestations should never reach the router.
|
||||
PubsubMessage::AggregateAndProofAttestation(aggregate_and_proof) => {
|
||||
if let Some(gossip_verified) =
|
||||
self.processor.verify_aggregated_attestation_for_gossip(
|
||||
peer_id.clone(),
|
||||
*aggregate_and_proof.clone(),
|
||||
)
|
||||
if let Some(gossip_verified) = self
|
||||
.processor
|
||||
.verify_aggregated_attestation_for_gossip(peer_id.clone(), *aggregate_and_proof)
|
||||
{
|
||||
self.propagate_message(id, peer_id.clone());
|
||||
self.processor
|
||||
|
||||
@@ -300,7 +300,7 @@ fn spawn_service<T: BeaconChainTypes>(
|
||||
if service.attestation_service.should_process_attestation(
|
||||
&id,
|
||||
&source,
|
||||
subnet,
|
||||
*subnet,
|
||||
attestation,
|
||||
) {
|
||||
let _ = service
|
||||
|
||||
@@ -529,7 +529,7 @@ impl<T: BeaconChainTypes> SyncManager<T> {
|
||||
|
||||
// otherwise, this is a range sync issue, notify the range sync
|
||||
self.range_sync
|
||||
.inject_error(&mut self.network, peer_id.clone(), request_id);
|
||||
.inject_error(&mut self.network, peer_id, request_id);
|
||||
}
|
||||
|
||||
fn peer_disconnect(&mut self, peer_id: &PeerId) {
|
||||
@@ -667,7 +667,7 @@ impl<T: BeaconChainTypes> SyncManager<T> {
|
||||
"last_peer" => format!("{:?}", parent_request.last_submitted_peer),
|
||||
);
|
||||
self.network
|
||||
.downvote_peer(parent_request.last_submitted_peer.clone());
|
||||
.downvote_peer(parent_request.last_submitted_peer);
|
||||
return;
|
||||
}
|
||||
Err(e) => {
|
||||
@@ -677,7 +677,7 @@ impl<T: BeaconChainTypes> SyncManager<T> {
|
||||
"last_peer" => format!("{:?}", parent_request.last_submitted_peer),
|
||||
);
|
||||
self.network
|
||||
.downvote_peer(parent_request.last_submitted_peer.clone());
|
||||
.downvote_peer(parent_request.last_submitted_peer);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user