Skip to content

Commit

Permalink
chore: Enable the unused_trait_names lint (#2334)
Browse files Browse the repository at this point in the history
* chore: Enable the `unused_trait_names` lint

And fix all the warnings it generates.

* More

* More
  • Loading branch information
larseggert authored Jan 9, 2025
1 parent d84f14d commit 4713322
Show file tree
Hide file tree
Showing 52 changed files with 62 additions and 61 deletions.
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ pedantic = { level = "warn", priority = -1 }
if_then_some_else_none = "warn"
get_unwrap = "warn"
pathbuf_init_then_push = "warn"
unused_trait_names = "warn"

# Optimize build dependencies, because bindgen and proc macros / style
# compilation take more to run than to build otherwise.
Expand Down
2 changes: 1 addition & 1 deletion neqo-bin/benches/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

use std::{env, path::PathBuf, str::FromStr};
use std::{env, path::PathBuf, str::FromStr as _};

use criterion::{criterion_group, criterion_main, BatchSize, Criterion, Throughput};
use neqo_bin::{client, server};
Expand Down
2 changes: 1 addition & 1 deletion neqo-bin/src/bin/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

use clap::Parser;
use clap::Parser as _;

#[tokio::main]
async fn main() -> Result<(), neqo_bin::client::Error> {
Expand Down
2 changes: 1 addition & 1 deletion neqo-bin/src/bin/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

use clap::Parser;
use clap::Parser as _;

#[tokio::main]
async fn main() -> Result<(), neqo_bin::server::Error> {
Expand Down
4 changes: 2 additions & 2 deletions neqo-bin/src/client/http09.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ use std::{
cell::RefCell,
collections::{HashMap, VecDeque},
fs::File,
io::{BufWriter, Write},
io::{BufWriter, Write as _},
net::SocketAddr,
path::PathBuf,
rc::Rc,
time::Instant,
};

use neqo_common::{event::Provider, qdebug, qinfo, qwarn, Datagram};
use neqo_common::{event::Provider as _, qdebug, qinfo, qwarn, Datagram};
use neqo_crypto::{AuthenticationStatus, ResumptionToken};
use neqo_transport::{
CloseReason, Connection, ConnectionEvent, ConnectionIdGenerator, EmptyConnectionIdGenerator,
Expand Down
4 changes: 2 additions & 2 deletions neqo-bin/src/client/http3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ use std::{
collections::{HashMap, VecDeque},
fmt::Display,
fs::File,
io::{BufWriter, Write},
io::{BufWriter, Write as _},
net::SocketAddr,
path::PathBuf,
rc::Rc,
time::Instant,
};

use neqo_common::{event::Provider, hex, qdebug, qinfo, qwarn, Datagram, Header};
use neqo_common::{event::Provider as _, hex, qdebug, qinfo, qwarn, Datagram, Header};
use neqo_crypto::{AuthenticationStatus, ResumptionToken};
use neqo_http3::{Error, Http3Client, Http3ClientEvent, Http3Parameters, Http3State, Priority};
use neqo_transport::{
Expand Down
6 changes: 3 additions & 3 deletions neqo-bin/src/client/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use std::{
fmt::{self, Display},
fs::{create_dir_all, File, OpenOptions},
io::{self, BufWriter},
net::{IpAddr, Ipv4Addr, Ipv6Addr, SocketAddr, ToSocketAddrs},
net::{IpAddr, Ipv4Addr, Ipv6Addr, SocketAddr, ToSocketAddrs as _},
path::PathBuf,
pin::Pin,
process::exit,
Expand All @@ -21,7 +21,7 @@ use std::{
use clap::Parser;
use futures::{
future::{select, Either},
FutureExt, TryFutureExt,
FutureExt as _, TryFutureExt as _,
};
use neqo_common::{qdebug, qerror, qinfo, qlog::NeqoQlog, qwarn, Datagram, Role};
use neqo_crypto::{
Expand Down Expand Up @@ -181,7 +181,7 @@ impl Args {
#[cfg(any(test, feature = "bench"))]
#[allow(clippy::missing_panics_doc)]
pub fn new(requests: &[usize], upload: bool) -> Self {
use std::str::FromStr;
use std::str::FromStr as _;
Self {
shared: crate::SharedArgs::default(),
urls: requests
Expand Down
4 changes: 2 additions & 2 deletions neqo-bin/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

use std::{
fmt::{self, Display},
net::{SocketAddr, ToSocketAddrs},
net::{SocketAddr, ToSocketAddrs as _},
path::PathBuf,
time::Duration,
};
Expand Down Expand Up @@ -266,7 +266,7 @@ impl std::error::Error for Error {}

#[cfg(test)]
mod tests {
use std::{fs, path::PathBuf, str::FromStr, time::SystemTime};
use std::{fs, path::PathBuf, str::FromStr as _, time::SystemTime};

use crate::{client, server};

Expand Down
2 changes: 1 addition & 1 deletion neqo-bin/src/server/http09.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

use std::{borrow::Cow, cell::RefCell, collections::HashMap, fmt::Display, rc::Rc, time::Instant};

use neqo_common::{event::Provider, hex, qdebug, qerror, qinfo, qwarn, Datagram};
use neqo_common::{event::Provider as _, hex, qdebug, qerror, qinfo, qwarn, Datagram};
use neqo_crypto::{generate_ech_keys, random, AllowZeroRtt, AntiReplay};
use neqo_http3::Error;
use neqo_transport::{
Expand Down
2 changes: 1 addition & 1 deletion neqo-bin/src/server/http3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use std::{
time::Instant,
};

use neqo_common::{header::HeadersExt, hex, qdebug, qerror, qinfo, Datagram, Header};
use neqo_common::{header::HeadersExt as _, hex, qdebug, qerror, qinfo, Datagram, Header};
use neqo_crypto::{generate_ech_keys, random, AntiReplay};
use neqo_http3::{
Http3OrWebTransportStream, Http3Parameters, Http3Server, Http3ServerEvent, StreamId,
Expand Down
6 changes: 3 additions & 3 deletions neqo-bin/src/server/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use std::{
cell::RefCell,
fmt::{self, Display},
fs, io,
net::{SocketAddr, ToSocketAddrs},
net::{SocketAddr, ToSocketAddrs as _},
path::PathBuf,
pin::Pin,
process::exit,
Expand All @@ -21,7 +21,7 @@ use std::{
use clap::Parser;
use futures::{
future::{select, select_all, Either},
FutureExt,
FutureExt as _,
};
use neqo_common::{qdebug, qerror, qinfo, qwarn, Datagram};
use neqo_crypto::{
Expand Down Expand Up @@ -121,7 +121,7 @@ pub struct Args {
#[cfg(any(test, feature = "bench"))]
impl Default for Args {
fn default() -> Self {
use std::str::FromStr;
use std::str::FromStr as _;
Self {
shared: crate::SharedArgs::default(),
hosts: vec!["[::]:12345".to_string()],
Expand Down
2 changes: 1 addition & 1 deletion neqo-common/src/fuzz.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
use std::{
collections::hash_map::DefaultHasher,
fs::File,
hash::{Hash, Hasher},
hash::{Hash as _, Hasher as _},
io::Write,
path::Path,
};
Expand Down
2 changes: 1 addition & 1 deletion neqo-common/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ pub mod log;
pub mod qlog;
pub mod tos;

use std::fmt::Write;
use std::fmt::Write as _;

use enum_map::Enum;

Expand Down
2 changes: 1 addition & 1 deletion neqo-common/src/log.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#![allow(clippy::module_name_repetitions)]

use std::{
io::Write,
io::Write as _,
sync::{Once, OnceLock},
time::{Duration, Instant},
};
Expand Down
2 changes: 1 addition & 1 deletion neqo-http3/src/connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ use crate::{
qpack_decoder_receiver::DecoderRecvStream,
qpack_encoder_receiver::EncoderRecvStream,
recv_message::{RecvMessage, RecvMessageInfo},
request_target::{AsRequestTarget, RequestTarget},
request_target::{AsRequestTarget, RequestTarget as _},
send_message::SendMessage,
settings::{HSettingType, HSettings, HttpZeroRttChecker},
stream_type_reader::NewStreamHeadReader,
Expand Down
4 changes: 2 additions & 2 deletions neqo-http3/src/connection_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1280,7 +1280,7 @@ impl EventProvider for Http3Client {
mod tests {
use std::{mem, time::Duration};

use neqo_common::{event::Provider, qtrace, Datagram, Decoder, Encoder};
use neqo_common::{event::Provider as _, qtrace, Datagram, Decoder, Encoder};
use neqo_crypto::{AllowZeroRtt, AntiReplay, ResumptionToken};
use neqo_qpack::{encoder::QPackEncoder, QpackSettings};
use neqo_transport::{
Expand All @@ -1301,7 +1301,7 @@ mod tests {
frames::{HFrame, H3_FRAME_TYPE_SETTINGS, H3_RESERVED_FRAME_TYPES},
qpack_encoder_receiver::EncoderRecvStream,
settings::{HSetting, HSettingType, H3_RESERVED_SETTINGS},
Http3Server, Priority, PushId, RecvStream,
Http3Server, Priority, PushId, RecvStream as _,
};

fn assert_closed(client: &Http3Client, expected: &Error) {
Expand Down
2 changes: 1 addition & 1 deletion neqo-http3/src/connection_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

use std::{rc::Rc, time::Instant};

use neqo_common::{event::Provider, qdebug, qinfo, qtrace, Header, MessageType, Role};
use neqo_common::{event::Provider as _, qdebug, qinfo, qtrace, Header, MessageType, Role};
use neqo_transport::{
AppError, Connection, ConnectionEvent, DatagramTracking, StreamId, StreamType,
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ mod sessions;
mod streams;
use std::{cell::RefCell, rc::Rc, time::Duration};

use neqo_common::{event::Provider, header::HeadersExt};
use neqo_common::{event::Provider as _, header::HeadersExt as _};
use neqo_crypto::AuthenticationStatus;
use neqo_transport::{ConnectionParameters, Pmtud, StreamId, StreamType};
use test_fixture::{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

use std::time::Duration;

use neqo_common::{event::Provider, Encoder};
use neqo_common::{event::Provider as _, Encoder};
use neqo_crypto::AuthenticationStatus;
use neqo_transport::{CloseReason, Connection, StreamType};
use test_fixture::{default_server_h3, now};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

use std::mem;

use neqo_common::{event::Provider, header::HeadersExt, Encoder};
use neqo_common::{event::Provider as _, header::HeadersExt as _, Encoder};
use neqo_transport::StreamType;
use test_fixture::now;

Expand Down
2 changes: 1 addition & 1 deletion neqo-http3/src/frames/hframe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

use std::{fmt::Debug, io::Write};
use std::{fmt::Debug, io::Write as _};

use neqo_common::{Decoder, Encoder};
use neqo_crypto::random;
Expand Down
2 changes: 1 addition & 1 deletion neqo-http3/src/headers_checks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// except according to those terms.

use enumset::{enum_set, EnumSet, EnumSetType};
use neqo_common::{header::HeadersExt, Header};
use neqo_common::{header::HeadersExt as _, Header};

use crate::{Error, MessageType, Res};

Expand Down
2 changes: 1 addition & 1 deletion neqo-http3/src/recv_message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

use std::{cell::RefCell, cmp::min, collections::VecDeque, fmt::Debug, rc::Rc};

use neqo_common::{header::HeadersExt, qdebug, qinfo, qtrace, Header};
use neqo_common::{header::HeadersExt as _, qdebug, qinfo, qtrace, Header};
use neqo_qpack::decoder::QPackDecoder;
use neqo_transport::{Connection, StreamId};

Expand Down
2 changes: 1 addition & 1 deletion neqo-http3/src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ mod tests {
ops::{Deref, DerefMut},
};

use neqo_common::{event::Provider, Encoder};
use neqo_common::{event::Provider as _, Encoder};
use neqo_crypto::{AuthenticationStatus, ZeroRttCheckResult, ZeroRttChecker};
use neqo_qpack::{encoder::QPackEncoder, QpackSettings};
use neqo_transport::{
Expand Down
2 changes: 1 addition & 1 deletion neqo-http3/src/stream_type_reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ mod tests {
use crate::{
control_stream_local::HTTP3_UNI_STREAM_TYPE_CONTROL,
frames::{H3_FRAME_TYPE_HEADERS, H3_FRAME_TYPE_SETTINGS},
CloseType, Error, NewStreamType, PushId, ReceiveOutput, RecvStream, Res,
CloseType, Error, NewStreamType, PushId, ReceiveOutput, RecvStream as _, Res,
};

struct Test {
Expand Down
2 changes: 1 addition & 1 deletion neqo-http3/tests/httpconn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use std::{
time::{Duration, Instant},
};

use neqo_common::{event::Provider, qtrace, Datagram};
use neqo_common::{event::Provider as _, qtrace, Datagram};
use neqo_crypto::{AuthenticationStatus, ResumptionToken};
use neqo_http3::{
Header, Http3Client, Http3ClientEvent, Http3OrWebTransportStream, Http3Parameters, Http3Server,
Expand Down
2 changes: 1 addition & 1 deletion neqo-http3/tests/priority.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

use std::time::Instant;

use neqo_common::event::Provider;
use neqo_common::event::Provider as _;
use neqo_crypto::AuthenticationStatus;
use neqo_http3::{
Header, Http3Client, Http3ClientEvent, Http3Server, Http3ServerEvent, Http3State, Priority,
Expand Down
2 changes: 1 addition & 1 deletion neqo-http3/tests/send_message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

use std::sync::OnceLock;

use neqo_common::event::Provider;
use neqo_common::event::Provider as _;
use neqo_crypto::AuthenticationStatus;
use neqo_http3::{
Error, Header, Http3Client, Http3ClientEvent, Http3OrWebTransportStream, Http3Server,
Expand Down
2 changes: 1 addition & 1 deletion neqo-http3/tests/webtransport.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

use std::{cell::RefCell, rc::Rc};

use neqo_common::{event::Provider, header::HeadersExt};
use neqo_common::{event::Provider as _, header::HeadersExt as _};
use neqo_crypto::AuthenticationStatus;
use neqo_http3::{
Http3Client, Http3ClientEvent, Http3OrWebTransportStream, Http3Parameters, Http3Server,
Expand Down
2 changes: 1 addition & 1 deletion neqo-qpack/src/header_block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

use std::{
mem,
ops::{Deref, Div},
ops::{Deref, Div as _},
};

use neqo_common::{qtrace, Header};
Expand Down
2 changes: 1 addition & 1 deletion neqo-qpack/src/reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ mod tests {
use test_receiver::TestReceiver;

use super::{
parse_utf8, str, test_receiver, Error, IntReader, LiteralReader, ReadByte,
parse_utf8, str, test_receiver, Error, IntReader, LiteralReader, ReadByte as _,
ReceiverBufferWrapper, Res,
};

Expand Down
2 changes: 1 addition & 1 deletion neqo-transport/src/cc/tests/cubic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ use crate::{
convert_to_f64, Cubic, CUBIC_ALPHA, CUBIC_BETA_USIZE_DIVIDEND,
CUBIC_BETA_USIZE_DIVISOR, CUBIC_C, CUBIC_FAST_CONVERGENCE,
},
CongestionControl,
CongestionControl as _,
},
packet::PacketType,
pmtud::Pmtud,
Expand Down
2 changes: 1 addition & 1 deletion neqo-transport/src/cc/tests/new_reno.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use test_fixture::now;

use super::{IP_ADDR, MTU, RTT};
use crate::{
cc::{new_reno::NewReno, ClassicCongestionControl, CongestionControl},
cc::{new_reno::NewReno, ClassicCongestionControl, CongestionControl as _},
packet::PacketType,
pmtud::Pmtud,
recovery::SentPacket,
Expand Down
2 changes: 1 addition & 1 deletion neqo-transport/src/cid.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use std::{
borrow::Borrow,
cell::{Ref, RefCell},
cmp::{max, min},
ops::Deref,
ops::Deref as _,
rc::Rc,
};

Expand Down
2 changes: 1 addition & 1 deletion neqo-transport/src/connection/dump.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
// Enable just this file for logging to just see packets.
// e.g. "RUST_LOG=neqo_transport::dump neqo-client ..."

use std::fmt::Write;
use std::fmt::Write as _;

use neqo_common::{qdebug, Decoder, IpTos};

Expand Down
2 changes: 1 addition & 1 deletion neqo-transport/src/connection/tests/datagram.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

use std::{cell::RefCell, rc::Rc};

use neqo_common::event::Provider;
use neqo_common::event::Provider as _;
use static_assertions::const_assert;
use test_fixture::now;

Expand Down
Loading

0 comments on commit 4713322

Please sign in to comment.