Skip to content

Commit

Permalink
chore: fix clippy lints
Browse files Browse the repository at this point in the history
Pull-Request: #5083.
  • Loading branch information
thomaseizinger authored Jan 16, 2024
1 parent b958897 commit 17acc05
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions protocols/gossipsub/src/behaviour/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ fn inject_nodes1() -> InjectNodes<IdentityTransform, AllowAllSubscriptionFilter>

fn add_peer<D, F>(
gs: &mut Behaviour<D, F>,
topic_hashes: &Vec<TopicHash>,
topic_hashes: &[TopicHash],
outbound: bool,
explicit: bool,
) -> PeerId
Expand All @@ -175,7 +175,7 @@ where

fn add_peer_with_addr<D, F>(
gs: &mut Behaviour<D, F>,
topic_hashes: &Vec<TopicHash>,
topic_hashes: &[TopicHash],
outbound: bool,
explicit: bool,
address: Multiaddr,
Expand All @@ -196,7 +196,7 @@ where

fn add_peer_with_addr_and_kind<D, F>(
gs: &mut Behaviour<D, F>,
topic_hashes: &Vec<TopicHash>,
topic_hashes: &[TopicHash],
outbound: bool,
explicit: bool,
address: Multiaddr,
Expand Down Expand Up @@ -3165,7 +3165,7 @@ fn test_scoring_p1() {
);
}

fn random_message(seq: &mut u64, topics: &Vec<TopicHash>) -> RawMessage {
fn random_message(seq: &mut u64, topics: &[TopicHash]) -> RawMessage {
let mut rng = rand::thread_rng();
*seq += 1;
RawMessage {
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 17acc05

Please sign in to comment.