Skip to content

Commit 5434608

Browse files
committed
Sigh... more lints
1 parent c6ad891 commit 5434608

File tree

29 files changed

+20
-69
lines changed

29 files changed

+20
-69
lines changed

base_layer/common_types/src/encryption.rs

+1-5
Original file line numberDiff line numberDiff line change
@@ -109,11 +109,7 @@ pub fn encrypt_bytes_integral_nonce(
109109

110110
#[cfg(test)]
111111
mod test {
112-
use std::mem::size_of;
113-
114-
use chacha20poly1305::{Key, KeyInit, Tag, XChaCha20Poly1305, XNonce};
115-
use rand::{rngs::OsRng, RngCore};
116-
use tari_utilities::{ByteArray, Hidden};
112+
use chacha20poly1305::{Key, KeyInit};
117113

118114
use super::*;
119115

base_layer/mmr/src/merkle_mountain_range.rs

-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
use std::{
2424
cmp::{max, min},
2525
convert::TryInto,
26-
iter::IntoIterator,
2726
marker::PhantomData,
2827
};
2928

base_layer/mmr/src/sparse_merkle_tree/bit_utils.rs

-1
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,6 @@ pub fn traverse_direction(
9999
#[cfg(test)]
100100
mod test {
101101
use super::*;
102-
use crate::sparse_merkle_tree::{bit_utils::count_common_prefix, NodeKey};
103102

104103
#[test]
105104
fn test_common_prefix() {

base_layer/mmr/src/sparse_merkle_tree/node.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -510,8 +510,7 @@ impl<H: Digest<OutputSize = U32>> BranchNode<H> {
510510
#[cfg(test)]
511511
mod test {
512512
use blake2::Blake2b;
513-
use digest::consts::U32;
514-
use rand::{self, RngCore};
513+
use rand::RngCore;
515514

516515
use super::*;
517516
use crate::sparse_merkle_tree::bit_utils::TraverseDirection::{Left, Right};

base_layer/mmr/src/sparse_merkle_tree/proofs.rs

-1
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,6 @@ impl<H: Digest<OutputSize = U32>> MerkleProofDigest<H> for ExclusionProof<H> {
227227
#[cfg(test)]
228228
mod test {
229229
use blake2::Blake2b;
230-
use digest::consts::U32;
231230

232231
use super::*;
233232

base_layer/mmr/tests/tests/with_blake512_hash.rs

-2
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@
2020
// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
2121
// USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2222

23-
use std::string::ToString;
24-
2523
use blake2::Blake2b;
2624
use digest::consts::U64;
2725
use tari_crypto::{hash_domain, hashing::DomainSeparatedHasher};

base_layer/service_framework/src/context/handles.rs

-2
Original file line numberDiff line numberDiff line change
@@ -208,8 +208,6 @@ impl ServiceHandles {
208208

209209
#[cfg(test)]
210210
mod test {
211-
use tari_shutdown::Shutdown;
212-
213211
use super::*;
214212

215213
#[test]

base_layer/service_framework/src/context/lazy_service.rs

+3-6
Original file line numberDiff line numberDiff line change
@@ -95,12 +95,9 @@ where
9595

9696
#[cfg(test)]
9797
mod test {
98-
use std::{
99-
sync::{
100-
atomic::{AtomicBool, Ordering},
101-
Arc,
102-
},
103-
task::Poll,
98+
use std::sync::{
99+
atomic::{AtomicBool, Ordering},
100+
Arc,
104101
};
105102

106103
use futures::future::{self, poll_fn};

base_layer/service_framework/src/stack.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -97,12 +97,11 @@ mod test {
9797
};
9898

9999
use async_trait::async_trait;
100-
use futures::{executor::block_on, future};
100+
use futures::executor::block_on;
101101
use tari_shutdown::Shutdown;
102102
use tower::service_fn;
103103

104104
use super::*;
105-
use crate::{initializer::ServiceInitializer, ServiceInitializerContext};
106105

107106
#[tokio::test]
108107
async fn service_defn_simple() {

base_layer/service_framework/src/tower/service_ext.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ mod test {
9393
Arc,
9494
};
9595

96-
use futures::{future, FutureExt};
96+
use futures::future;
9797
use futures_test::task::panic_context;
9898
use tower::service_fn;
9999

common/src/configuration/name_server.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ impl FromStr for DnsNameServer {
6363

6464
#[cfg(test)]
6565
mod test {
66-
use std::net::{IpAddr, Ipv4Addr, SocketAddr};
66+
use std::net::{IpAddr, Ipv4Addr};
6767

6868
use super::*;
6969

comms/core/src/bounded_executor.rs

+1-4
Original file line numberDiff line numberDiff line change
@@ -156,10 +156,7 @@ impl BoundedExecutor {
156156
#[cfg(test)]
157157
mod test {
158158
use std::{
159-
sync::{
160-
atomic::{AtomicBool, Ordering},
161-
Arc,
162-
},
159+
sync::atomic::{AtomicBool, Ordering},
163160
time::Duration,
164161
};
165162

comms/core/src/connection_manager/dialer.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ use tokio::{
3939
time,
4040
};
4141
use tokio_stream::StreamExt;
42-
use tracing::{self, span, Instrument, Level};
42+
use tracing::{span, Instrument, Level};
4343

4444
use super::{direction::ConnectionDirection, error::ConnectionManagerError, peer_connection::PeerConnection};
4545
#[cfg(feature = "metrics")]

comms/core/src/connection_manager/liveness.rs

-2
Original file line numberDiff line numberDiff line change
@@ -190,8 +190,6 @@ where
190190

191191
#[cfg(test)]
192192
mod test {
193-
use futures::SinkExt;
194-
use tokio::{time, time::Duration};
195193
use tokio_stream::StreamExt;
196194

197195
use super::*;

comms/core/src/connection_manager/peer_connection.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ use tokio::{
3838
time,
3939
};
4040
use tokio_stream::StreamExt;
41-
use tracing::{self, span, Instrument, Level};
41+
use tracing::{span, Instrument, Level};
4242

4343
use super::{direction::ConnectionDirection, error::PeerConnectionError, manager::ConnectionManagerEvent};
4444
#[cfg(feature = "rpc")]

comms/core/src/multiplexing/yamux.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ use tokio::{
2828
sync::mpsc,
2929
};
3030
use tokio_util::compat::{Compat, FuturesAsyncReadCompatExt, TokioAsyncReadCompatExt};
31-
use tracing::{self, debug, error};
31+
use tracing::{debug, error};
3232
// Reexport
3333
pub use yamux::ConnectionError;
3434
use yamux::Mode;

comms/core/src/net_address/multiaddr_with_stats.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
use std::{
55
cmp,
6-
cmp::{Ord, Ordering},
6+
cmp::Ordering,
77
convert::{TryFrom, TryInto},
88
fmt,
99
fmt::{Display, Formatter},
@@ -375,8 +375,6 @@ impl PartialEq for PeerAddressSource {
375375
}
376376
#[cfg(test)]
377377
mod test {
378-
use std::time::Duration;
379-
380378
use super::*;
381379

382380
#[test]

comms/core/src/net_address/mutliaddresses_with_stats.rs

-2
Original file line numberDiff line numberDiff line change
@@ -291,8 +291,6 @@ impl Display for MultiaddressesWithStats {
291291

292292
#[cfg(test)]
293293
mod test {
294-
use multiaddr::Multiaddr;
295-
296294
use super::*;
297295

298296
#[test]

comms/core/src/noise/config.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
use std::{sync::Arc, time::Duration};
2626

2727
use log::*;
28-
use snow::{self, params::NoiseParams};
28+
use snow::params::NoiseParams;
2929
use tari_utilities::ByteArray;
3030
use tokio::io::{AsyncRead, AsyncWrite};
3131

comms/core/src/noise/socket.rs

-2
Original file line numberDiff line numberDiff line change
@@ -662,8 +662,6 @@ impl From<TransportState> for NoiseState {
662662

663663
#[cfg(test)]
664664
mod test {
665-
use std::io;
666-
667665
use futures::future::join;
668666
use snow::{params::NoiseParams, Builder, Error, Keypair};
669667

comms/core/src/peer_manager/manager.rs

-8
Original file line numberDiff line numberDiff line change
@@ -375,14 +375,6 @@ mod test {
375375
use tari_storage::HashmapDatabase;
376376

377377
use super::*;
378-
use crate::{
379-
net_address::MultiaddressesWithStats,
380-
peer_manager::{
381-
node_id::NodeId,
382-
peer::{Peer, PeerFlags},
383-
PeerFeatures,
384-
},
385-
};
386378

387379
fn create_test_peer(ban_flag: bool, features: PeerFeatures) -> Peer {
388380
let (_sk, pk) = RistrettoPublicKey::random_keypair(&mut OsRng);

comms/core/src/peer_manager/node_id.rs

+2-5
Original file line numberDiff line numberDiff line change
@@ -265,13 +265,10 @@ where D: Deserializer<'de> {
265265

266266
#[cfg(test)]
267267
mod test {
268-
use tari_crypto::{
269-
keys::{PublicKey, SecretKey},
270-
tari_utilities::byte_array::ByteArray,
271-
};
268+
use tari_crypto::keys::{PublicKey, SecretKey};
272269

273270
use super::*;
274-
use crate::types::{CommsPublicKey, CommsSecretKey};
271+
use crate::types::CommsSecretKey;
275272

276273
#[test]
277274
fn display() {

comms/core/src/peer_manager/peer.rs

-1
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,6 @@ mod test {
341341
};
342342

343343
use super::*;
344-
use crate::{net_address::MultiaddressesWithStats, peer_manager::NodeId, types::CommsPublicKey};
345344

346345
#[test]
347346
fn test_is_banned_and_ban_for() {

comms/core/src/peer_manager/peer_query.rs

+1-5
Original file line numberDiff line numberDiff line change
@@ -215,11 +215,7 @@ mod test {
215215
use super::*;
216216
use crate::{
217217
net_address::{MultiaddressesWithStats, PeerAddressSource},
218-
peer_manager::{
219-
node_id::NodeId,
220-
peer::{Peer, PeerFlags},
221-
PeerFeatures,
222-
},
218+
peer_manager::{peer::PeerFlags, PeerFeatures},
223219
};
224220

225221
fn create_test_peer(ban_flag: bool) -> Peer {

comms/core/src/peer_manager/peer_storage.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -538,7 +538,7 @@ mod test {
538538
use super::*;
539539
use crate::{
540540
net_address::{MultiaddrWithStats, MultiaddressesWithStats, PeerAddressSource},
541-
peer_manager::{peer::PeerFlags, PeerFeatures},
541+
peer_manager::peer::PeerFlags,
542542
};
543543

544544
#[test]

comms/core/src/peer_validator/helpers.rs

-1
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,6 @@ mod test {
200200
use multiaddr::multiaddr;
201201

202202
use super::*;
203-
use crate::peer_validator::error::PeerValidatorError;
204203

205204
#[test]
206205
fn validate_address_strict() {

comms/core/src/pipeline/inbound.rs

-3
Original file line numberDiff line numberDiff line change
@@ -137,12 +137,9 @@ where
137137

138138
#[cfg(test)]
139139
mod test {
140-
use std::time::Duration;
141-
142140
use futures::future;
143141
use tari_shutdown::Shutdown;
144142
use tari_test_utils::collect_recv;
145-
use tokio::{sync::mpsc, time};
146143
use tower::service_fn;
147144

148145
use super::*;

comms/core/src/pipeline/outbound.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -119,11 +119,9 @@ where
119119

120120
#[cfg(test)]
121121
mod test {
122-
use std::time::Duration;
123-
124122
use bytes::Bytes;
125123
use tari_test_utils::collect_recv;
126-
use tokio::{sync::mpsc, time};
124+
use tokio::sync::mpsc;
127125

128126
use super::*;
129127
use crate::{message::OutboundMessage, pipeline::SinkService, utils};

comms/core/src/tor/control_client/client.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ mod test {
279279
use tokio_stream::StreamExt;
280280

281281
use super::*;
282-
use crate::tor::control_client::{test_server, test_server::canned_responses, types::PrivateKey};
282+
use crate::tor::control_client::{test_server, test_server::canned_responses};
283283

284284
async fn setup_test() -> (TorControlPortClient, test_server::State) {
285285
let (_, mock_state, socket) = test_server::spawn().await;

0 commit comments

Comments
 (0)