From 2f1803f4c6f90c3edcf0289a7494d241d9312f58 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Mon, 23 May 2022 12:20:44 -0400 Subject: [PATCH 1/2] Suppress clippy warnings in tor-basic-utils. These are warnings that we've decided it's okay to suppress elsewhere. --- crates/tor-basic-utils/src/futures.rs | 1 + crates/tor-basic-utils/src/lib.rs | 1 + 2 files changed, 2 insertions(+) diff --git a/crates/tor-basic-utils/src/futures.rs b/crates/tor-basic-utils/src/futures.rs index e2c6f45e0..dbfb451dd 100644 --- a/crates/tor-basic-utils/src/futures.rs +++ b/crates/tor-basic-utils/src/futures.rs @@ -414,6 +414,7 @@ where #[cfg(test)] #[allow(clippy::unwrap_used)] // why is this not the default in tests +#[allow(clippy::print_stderr)] mod test { use super::*; use futures::channel::mpsc; diff --git a/crates/tor-basic-utils/src/lib.rs b/crates/tor-basic-utils/src/lib.rs index b5b782716..5c6d597d6 100644 --- a/crates/tor-basic-utils/src/lib.rs +++ b/crates/tor-basic-utils/src/lib.rs @@ -38,6 +38,7 @@ #![deny(clippy::unnecessary_wraps)] #![warn(clippy::unseparated_literal_suffix)] #![deny(clippy::unwrap_used)] +#![allow(clippy::let_unit_value)] use std::fmt; From 546ae3000eb179aedc97de30b0ccdb1d45b93395 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Mon, 23 May 2022 12:32:31 -0400 Subject: [PATCH 2/2] Resolve the new `derive_partial_eq_without_eq` lint. It's a little overzealous sometimes, but it's mostly to the good. --- crates/arti-client/examples/hook-tcp.rs | 2 +- crates/tor-circmgr/src/isolation.rs | 2 +- crates/tor-circmgr/src/mgr.rs | 6 +++--- crates/tor-circmgr/src/usage.rs | 2 +- crates/tor-events/src/events.rs | 2 +- crates/tor-linkspec/src/ls.rs | 2 +- crates/tor-netdir/src/weight.rs | 2 +- crates/tor-netdoc/src/doc/routerdesc.rs | 2 +- crates/tor-netdoc/src/err.rs | 2 +- crates/tor-netdoc/src/lib.rs | 2 +- crates/tor-netdoc/src/types/policy.rs | 2 +- crates/tor-socksproto/src/handshake.rs | 2 +- 12 files changed, 14 insertions(+), 14 deletions(-) diff --git a/crates/arti-client/examples/hook-tcp.rs b/crates/arti-client/examples/hook-tcp.rs index 0b4950f1b..f49b82a19 100644 --- a/crates/arti-client/examples/hook-tcp.rs +++ b/crates/arti-client/examples/hook-tcp.rs @@ -78,7 +78,7 @@ struct CustomTcpStream { } /// An enum representing states a TCP stream can be in. -#[derive(PartialEq)] +#[derive(PartialEq, Eq)] enum TcpState { /// Stream is open. Open, diff --git a/crates/tor-circmgr/src/isolation.rs b/crates/tor-circmgr/src/isolation.rs index 531584ced..e674b5b40 100644 --- a/crates/tor-circmgr/src/isolation.rs +++ b/crates/tor-circmgr/src/isolation.rs @@ -462,7 +462,7 @@ pub(crate) mod test { } } - #[derive(PartialEq, Clone, Copy, Debug)] + #[derive(PartialEq, Clone, Copy, Debug, Eq)] struct OtherIsolation(usize); impl IsolationHelper for OtherIsolation { diff --git a/crates/tor-circmgr/src/mgr.rs b/crates/tor-circmgr/src/mgr.rs index a1998b15e..5b202d673 100644 --- a/crates/tor-circmgr/src/mgr.rs +++ b/crates/tor-circmgr/src/mgr.rs @@ -273,7 +273,7 @@ pub(crate) trait AbstractCircBuilder: Send + Sync { /// All circuits start out "unused" and become "dirty" when their spec /// is first restricted -- that is, when they are first handed out to be /// used for a request. -#[derive(Debug, Clone, PartialEq)] +#[derive(Debug, Clone, PartialEq, Eq)] enum ExpirationInfo { /// The circuit has never been used. Unused { @@ -303,7 +303,7 @@ impl ExpirationInfo { } /// An entry for an open circuit held by an `AbstractCircMgr`. -#[derive(PartialEq, Debug, Clone)] +#[derive(PartialEq, Debug, Clone, Eq)] pub(crate) struct OpenEntry { /// Current AbstractCircSpec for this circuit's permitted usages. spec: S, @@ -1456,7 +1456,7 @@ mod test { } } - #[derive(Debug, PartialEq, Clone)] + #[derive(Debug, PartialEq, Clone, Eq)] struct FakeCirc { id: FakeId, } diff --git a/crates/tor-circmgr/src/usage.rs b/crates/tor-circmgr/src/usage.rs index fb8d7c4f1..3e5a9309b 100644 --- a/crates/tor-circmgr/src/usage.rs +++ b/crates/tor-circmgr/src/usage.rs @@ -18,7 +18,7 @@ use crate::mgr::{abstract_spec_find_supported, AbstractCirc, OpenEntry, Restrict use crate::Result; /// An exit policy, as supported by the last hop of a circuit. -#[derive(Clone, Debug, PartialEq)] +#[derive(Clone, Debug, PartialEq, Eq)] pub(crate) struct ExitPolicy { /// Permitted IPv4 ports. v4: Arc, diff --git a/crates/tor-events/src/events.rs b/crates/tor-events/src/events.rs index a65af8c49..4e4a910a7 100644 --- a/crates/tor-events/src/events.rs +++ b/crates/tor-events/src/events.rs @@ -2,7 +2,7 @@ use serde::{Deserialize, Serialize}; /// An event emitted by some Tor-related crate. -#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)] +#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)] #[non_exhaustive] pub enum TorEvent { /// An event with no data, used for testing purposes. diff --git a/crates/tor-linkspec/src/ls.rs b/crates/tor-linkspec/src/ls.rs index 0489ba824..bd52c6c75 100644 --- a/crates/tor-linkspec/src/ls.rs +++ b/crates/tor-linkspec/src/ls.rs @@ -11,7 +11,7 @@ use tor_llcrypto::pk::rsa::RsaIdentity; /// A piece of information about a relay and how to connect to it. #[non_exhaustive] -#[derive(Debug, Clone, PartialEq)] +#[derive(Debug, Clone, PartialEq, Eq)] pub enum LinkSpec { /// The TCP address of an OR Port for a relay OrPort(IpAddr, u16), diff --git a/crates/tor-netdir/src/weight.rs b/crates/tor-netdir/src/weight.rs index a1170bbe5..aab974e52 100644 --- a/crates/tor-netdir/src/weight.rs +++ b/crates/tor-netdir/src/weight.rs @@ -49,7 +49,7 @@ where /// Internal: how should we find the base bandwidth of each relay? This /// value is global over a whole directory, and depends on the bandwidth /// weights in the consensus. -#[derive(Copy, Clone, Debug, PartialEq)] +#[derive(Copy, Clone, Debug, PartialEq, Eq)] enum BandwidthFn { /// There are no weights at all in the consensus: weight every /// relay as 1. diff --git a/crates/tor-netdoc/src/doc/routerdesc.rs b/crates/tor-netdoc/src/doc/routerdesc.rs index 4713c23d9..1727c377b 100644 --- a/crates/tor-netdoc/src/doc/routerdesc.rs +++ b/crates/tor-netdoc/src/doc/routerdesc.rs @@ -150,7 +150,7 @@ pub struct RouterDesc { } /// Description of the software a relay is running. -#[derive(Debug, Clone, PartialEq)] +#[derive(Debug, Clone, PartialEq, Eq)] #[non_exhaustive] pub enum RelayPlatform { /// Software advertised to be some version of Tor, on some platform. diff --git a/crates/tor-netdoc/src/err.rs b/crates/tor-netdoc/src/err.rs index 6cda02300..0a77c7948 100644 --- a/crates/tor-netdoc/src/err.rs +++ b/crates/tor-netdoc/src/err.rs @@ -165,7 +165,7 @@ impl fmt::Display for Pos { } /// A variety of parsing error. -#[derive(Copy, Clone, Debug, derive_more::Display, PartialEq)] +#[derive(Copy, Clone, Debug, derive_more::Display, PartialEq, Eq)] #[non_exhaustive] pub enum ParseErrorKind { /// An internal error in the parser: these should never happen. diff --git a/crates/tor-netdoc/src/lib.rs b/crates/tor-netdoc/src/lib.rs index 3e0acf6e9..1732ece60 100644 --- a/crates/tor-netdoc/src/lib.rs +++ b/crates/tor-netdoc/src/lib.rs @@ -98,7 +98,7 @@ pub type BuildResult = std::result::Result; /// Indicates whether we should parse an annotated list of objects or a /// non-annotated list. -#[derive(PartialEq, Debug)] +#[derive(PartialEq, Debug, Eq)] #[allow(clippy::exhaustive_enums)] pub enum AllowAnnotations { /// Parsing a document where items might be annotated. diff --git a/crates/tor-netdoc/src/types/policy.rs b/crates/tor-netdoc/src/types/policy.rs index c953eec1b..42753fcb8 100644 --- a/crates/tor-netdoc/src/types/policy.rs +++ b/crates/tor-netdoc/src/types/policy.rs @@ -27,7 +27,7 @@ pub use addrpolicy::{AddrPolicy, AddrPortPattern, RuleKind}; pub use portpolicy::PortPolicy; /// Error from an unparsable or invalid policy. -#[derive(Debug, Error, Clone, PartialEq)] +#[derive(Debug, Error, Clone, PartialEq, Eq)] #[non_exhaustive] pub enum PolicyError { /// A port was not a number in the range 1..65535 diff --git a/crates/tor-socksproto/src/handshake.rs b/crates/tor-socksproto/src/handshake.rs index 51b04e057..5bbf4ec6d 100644 --- a/crates/tor-socksproto/src/handshake.rs +++ b/crates/tor-socksproto/src/handshake.rs @@ -30,7 +30,7 @@ pub struct SocksHandshake { /// Possible state for a Socks connection. /// /// Each completed message advances the state. -#[derive(Clone, Debug, Copy, PartialEq)] +#[derive(Clone, Debug, Copy, PartialEq, Eq)] enum State { /// Starting state: no messages have been handled yet. Initial,