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()); } } }