From 17acc0543d628b97eb5c9fceabb991bda8011cd2 Mon Sep 17 00:00:00 2001 From: Thomas Eizinger Date: Mon, 15 Jan 2024 20:08:28 -0800 Subject: [PATCH] chore: fix clippy lints Pull-Request: #5083. --- protocols/gossipsub/src/behaviour/tests.rs | 26 +++++++++++----------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/protocols/gossipsub/src/behaviour/tests.rs b/protocols/gossipsub/src/behaviour/tests.rs index 570cdf43f90..2bf1c90c5c8 100644 --- a/protocols/gossipsub/src/behaviour/tests.rs +++ b/protocols/gossipsub/src/behaviour/tests.rs @@ -162,7 +162,7 @@ fn inject_nodes1() -> InjectNodes fn add_peer( gs: &mut Behaviour, - topic_hashes: &Vec, + topic_hashes: &[TopicHash], outbound: bool, explicit: bool, ) -> PeerId @@ -175,7 +175,7 @@ where fn add_peer_with_addr( gs: &mut Behaviour, - topic_hashes: &Vec, + topic_hashes: &[TopicHash], outbound: bool, explicit: bool, address: Multiaddr, @@ -196,7 +196,7 @@ where fn add_peer_with_addr_and_kind( gs: &mut Behaviour, - topic_hashes: &Vec, + topic_hashes: &[TopicHash], outbound: bool, explicit: bool, address: Multiaddr, @@ -3165,7 +3165,7 @@ fn test_scoring_p1() { ); } -fn random_message(seq: &mut u64, topics: &Vec) -> RawMessage { +fn random_message(seq: &mut u64, topics: &[TopicHash]) -> RawMessage { let mut rng = rand::thread_rng(); *seq += 1; RawMessage { @@ -4027,20 +4027,20 @@ fn test_scoring_p6() { //create 5 peers with the same ip let addr = Multiaddr::from(Ipv4Addr::new(10, 1, 2, 3)); let peers = vec![ - add_peer_with_addr(&mut gs, &vec![], false, false, addr.clone()), - add_peer_with_addr(&mut gs, &vec![], false, false, addr.clone()), - add_peer_with_addr(&mut gs, &vec![], true, false, addr.clone()), - add_peer_with_addr(&mut gs, &vec![], true, false, addr.clone()), - add_peer_with_addr(&mut gs, &vec![], true, true, addr.clone()), + add_peer_with_addr(&mut gs, &[], false, false, addr.clone()), + add_peer_with_addr(&mut gs, &[], false, false, addr.clone()), + add_peer_with_addr(&mut gs, &[], true, false, addr.clone()), + add_peer_with_addr(&mut gs, &[], true, false, addr.clone()), + add_peer_with_addr(&mut gs, &[], true, true, addr.clone()), ]; //create 4 other peers with other ip let addr2 = Multiaddr::from(Ipv4Addr::new(10, 1, 2, 4)); let others = vec![ - add_peer_with_addr(&mut gs, &vec![], false, false, addr2.clone()), - add_peer_with_addr(&mut gs, &vec![], false, false, addr2.clone()), - add_peer_with_addr(&mut gs, &vec![], true, false, addr2.clone()), - add_peer_with_addr(&mut gs, &vec![], true, false, addr2.clone()), + add_peer_with_addr(&mut gs, &[], false, false, addr2.clone()), + add_peer_with_addr(&mut gs, &[], false, false, addr2.clone()), + add_peer_with_addr(&mut gs, &[], true, false, addr2.clone()), + add_peer_with_addr(&mut gs, &[], true, false, addr2.clone()), ]; //no penalties yet