From b832cf008c9dbfc96b7e71a58b8be1d58cc07b18 Mon Sep 17 00:00:00 2001 From: ackintosh Date: Thu, 4 Jan 2024 11:34:13 +0900 Subject: [PATCH] Fix clippy warnings --- beacon_node/lighthouse_network/src/discovery/mod.rs | 5 ++--- consensus/types/src/subnet_id.rs | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/beacon_node/lighthouse_network/src/discovery/mod.rs b/beacon_node/lighthouse_network/src/discovery/mod.rs index 2945b796c8f..8477758cfcf 100644 --- a/beacon_node/lighthouse_network/src/discovery/mod.rs +++ b/beacon_node/lighthouse_network/src/discovery/mod.rs @@ -769,17 +769,16 @@ impl Discovery { DiscoveryTarget::Prefix(node_ids) => { let pos = prefix_query.retries % node_ids.len(); if let Some(id) = node_ids.get(pos) { - id.clone() + *id } else { warn!( self.log, "NodeIds were given for prefix search, but the offset was wrong. Choosing the first one instead."; "subnet" => ?prefix_query, ); - node_ids + *node_ids .first() .expect("Already checked that `node_ids` is not empty.") - .clone() } } }; diff --git a/consensus/types/src/subnet_id.rs b/consensus/types/src/subnet_id.rs index 68a07914710..905d8eb7166 100644 --- a/consensus/types/src/subnet_id.rs +++ b/consensus/types/src/subnet_id.rs @@ -282,7 +282,7 @@ mod tests { assert_eq!(mapping.len(), 64); for (_, node_ids) in mapping.into_iter() { - assert!(node_ids.len() > 0); + assert!(!node_ids.is_empty()); } } }