From b4a2be2338f44b2bdec18237ae1ef279ff9807d5 Mon Sep 17 00:00:00 2001 From: Boog900 <54e72d8a-345f-4599-bd90-c6b9bc7d0ec5@aleeas.com> Date: Fri, 26 Apr 2024 21:17:47 +0100 Subject: [PATCH] clippy --- p2p/address-book/src/peer_list/tests.rs | 6 +++--- p2p/monero-p2p/src/client.rs | 2 +- p2p/monero-p2p/src/client/connection.rs | 3 +-- p2p/monero-p2p/src/client/handshaker.rs | 2 +- p2p/monero-p2p/tests/handshake.rs | 2 +- 5 files changed, 7 insertions(+), 8 deletions(-) diff --git a/p2p/address-book/src/peer_list/tests.rs b/p2p/address-book/src/peer_list/tests.rs index ed9682eb..7aba0a20 100644 --- a/p2p/address-book/src/peer_list/tests.rs +++ b/p2p/address-book/src/peer_list/tests.rs @@ -87,7 +87,7 @@ fn peer_list_remove_specific_peer() { let mut peer_list = make_fake_peer_list_with_random_pruning_seeds(100); let peer = peer_list - .take_random_peer(&mut rand::thread_rng(), None) + .take_random_peer(&mut rand::thread_rng(), None, &HashSet::new()) .unwrap(); let pruning_idxs = peer_list.pruning_seeds; @@ -160,7 +160,7 @@ fn peer_list_get_peer_with_block() { peer_list.add_new_peer(make_fake_peer(101, Some(384))); let peer = peer_list - .take_random_peer(&mut r, Some(1)) + .take_random_peer(&mut r, Some(1), &HashSet::new()) .expect("We just added a peer with the correct seed"); assert!(peer @@ -173,7 +173,7 @@ fn peer_list_get_peer_with_block() { fn peer_list_ban_peers() { let mut peer_list = make_fake_peer_list_with_random_pruning_seeds(100); let peer = peer_list - .take_random_peer(&mut rand::thread_rng(), None) + .take_random_peer(&mut rand::thread_rng(), None, &HashSet::new()) .unwrap(); let ban_id = peer.adr.ban_id(); diff --git a/p2p/monero-p2p/src/client.rs b/p2p/monero-p2p/src/client.rs index 91ae16a9..d1ef125e 100644 --- a/p2p/monero-p2p/src/client.rs +++ b/p2p/monero-p2p/src/client.rs @@ -4,7 +4,7 @@ use std::{ task::{ready, Context, Poll}, }; -use futures::{channel::oneshot, FutureExt}; +use futures::channel::oneshot; use tokio::{ sync::{mpsc, OwnedSemaphorePermit, Semaphore}, task::JoinHandle, diff --git a/p2p/monero-p2p/src/client/connection.rs b/p2p/monero-p2p/src/client/connection.rs index bbf0b96e..11d8e11e 100644 --- a/p2p/monero-p2p/src/client/connection.rs +++ b/p2p/monero-p2p/src/client/connection.rs @@ -3,11 +3,10 @@ //! This module handles routing requests from a [`Client`](crate::client::Client) or a broadcast channel to //! a peer. This module also handles routing requests from the connected peer to a request handler. //! -use std::{pin::Pin, sync::Arc, time::Duration}; +use std::pin::Pin; use futures::{ channel::oneshot, - lock::{Mutex, OwnedMutexGuard}, stream::{Fuse, FusedStream}, SinkExt, Stream, StreamExt, }; diff --git a/p2p/monero-p2p/src/client/handshaker.rs b/p2p/monero-p2p/src/client/handshaker.rs index b834489d..03f3f563 100644 --- a/p2p/monero-p2p/src/client/handshaker.rs +++ b/p2p/monero-p2p/src/client/handshaker.rs @@ -475,7 +475,7 @@ where id: addr, handle, direction, - pruning_seed: pruning_seed.clone(), + pruning_seed, }; let semaphore = Arc::new(Semaphore::new(1)); diff --git a/p2p/monero-p2p/tests/handshake.rs b/p2p/monero-p2p/tests/handshake.rs index b8d8f34e..1d8b649c 100644 --- a/p2p/monero-p2p/tests/handshake.rs +++ b/p2p/monero-p2p/tests/handshake.rs @@ -107,7 +107,7 @@ async fn handshake_cuprate_to_cuprate() { .unwrap() }); - let (res1, res2) = futures::join!(p1, p2); + let (res1, res2) = tokio::join!(p1, p2); res1.unwrap(); res2.unwrap(); }