Skip to content

Commit

Permalink
chore(ci): fix beta clippy lints
Browse files Browse the repository at this point in the history
  • Loading branch information
jxs committed Sep 20, 2024
1 parent fd4e1e1 commit 057b94c
Show file tree
Hide file tree
Showing 32 changed files with 119 additions and 0 deletions.
2 changes: 2 additions & 0 deletions misc/allow-block-list/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,8 @@ where
_: ConnectionId,
event: THandlerOutEvent<Self>,
) {
// TODO: remove when Rust 1.82 is MSRV
#[allow(unreachable_patterns)]
void::unreachable(event)
}

Expand Down
4 changes: 4 additions & 0 deletions misc/connection-limits/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,8 @@ impl NetworkBehaviour for Behaviour {
_: ConnectionId,
event: THandlerOutEvent<Self>,
) {
// TODO: remove when Rust 1.82 is MSRV
#[allow(unreachable_patterns)]
void::unreachable(event)
}

Expand Down Expand Up @@ -586,6 +588,8 @@ mod tests {
_connection_id: ConnectionId,
event: THandlerOutEvent<Self>,
) {
// TODO: remove when Rust 1.82 is MSRV
#[allow(unreachable_patterns)]
void::unreachable(event)
}

Expand Down
2 changes: 2 additions & 0 deletions misc/memory-connection-limits/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,8 @@ impl NetworkBehaviour for Behaviour {
_: ConnectionId,
event: THandlerOutEvent<Self>,
) {
// TODO: remove when Rust 1.82 is MSRV
#[allow(unreachable_patterns)]
void::unreachable(event)
}

Expand Down
2 changes: 2 additions & 0 deletions misc/memory-connection-limits/tests/util/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,8 @@ impl<const MEM_PENDING: usize, const MEM_ESTABLISHED: usize> NetworkBehaviour
_: ConnectionId,
event: THandlerOutEvent<Self>,
) {
// TODO: remove when Rust 1.82 is MSRV
#[allow(unreachable_patterns)]
void::unreachable(event)
}

Expand Down
1 change: 1 addition & 0 deletions misc/quick-protobuf-codec/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ mod generated;
pub use generated::test as proto;

/// [`Codec`] implements [`Encoder`] and [`Decoder`], uses [`unsigned_varint`]
///
/// to prefix messages with their length and uses [`quick_protobuf`] and a provided
/// `struct` implementing [`MessageRead`] and [`MessageWrite`] to do the encoding.
pub struct Codec<In, Out = In> {
Expand Down
2 changes: 2 additions & 0 deletions protocols/autonat/src/v2/client/handler/dial_back.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ impl ConnectionHandler for Handler {
tracing::warn!("Dial back request dropped, too many requests in flight");
}
}
// TODO: remove when Rust 1.82 is MSRVprotocols/autonat/src/v2/client/handler/dial_back.rs
#[allow(unreachable_patterns)]
ConnectionEvent::ListenUpgradeError(ListenUpgradeError { error, .. }) => {
void::unreachable(error);
}
Expand Down
2 changes: 2 additions & 0 deletions protocols/autonat/src/v2/client/handler/dial_request.rs
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,8 @@ async fn start_stream_handle(
.map_err(|e| match e {
StreamUpgradeError::NegotiationFailed => Error::UnsupportedProtocol,
StreamUpgradeError::Timeout => Error::Io(io::ErrorKind::TimedOut.into()),
// TODO: remove when Rust 1.82 is MSRV
#[allow(unreachable_patterns)]
StreamUpgradeError::Apply(v) => void::unreachable(v),
StreamUpgradeError::Io(e) => Error::Io(e),
})?;
Expand Down
2 changes: 2 additions & 0 deletions protocols/autonat/src/v2/server/behaviour.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@ where
Either::Left(Either::Left(Err(e))) => {
tracing::debug!("dial back error: {e:?}");
}
// TODO: remove when Rust 1.82 is MSRV
#[allow(unreachable_patterns)]
Either::Left(Either::Right(v)) => void::unreachable(v),
Either::Right(Either::Left(cmd)) => {
let addr = cmd.addr.clone();
Expand Down
2 changes: 2 additions & 0 deletions protocols/autonat/src/v2/server/handler/dial_request.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,8 @@ where
);
}
}
// TODO: remove when Rust 1.82 is MSRV
#[allow(unreachable_patterns)]
ConnectionEvent::ListenUpgradeError(ListenUpgradeError { error, .. }) => {
tracing::debug!("inbound request failed: {:?}", error);
}
Expand Down
2 changes: 2 additions & 0 deletions protocols/dcutr/src/behaviour.rs
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,8 @@ impl NetworkBehaviour for Behaviour {
.or_default() += 1;
self.queued_events.push_back(ToSwarm::Dial { opts });
}
// TODO: remove when Rust 1.82 is MSRV
#[allow(unreachable_patterns)]
Either::Right(never) => void::unreachable(never),
};
}
Expand Down
8 changes: 8 additions & 0 deletions protocols/dcutr/src/handler/relayed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,8 @@ impl Handler {
self.attempts += 1;
}
// A connection listener denies all incoming substreams, thus none can ever be fully negotiated.
// TODO: remove when Rust 1.82 is MSRV
#[allow(unreachable_patterns)]
future::Either::Right(output) => void::unreachable(output),
}
}
Expand Down Expand Up @@ -153,6 +155,8 @@ impl Handler {
<Self as ConnectionHandler>::InboundProtocol,
>,
) {
// TODO: remove when Rust 1.82 is MSRV
#[allow(unreachable_patterns)]
void::unreachable(error.into_inner());
}

Expand All @@ -164,6 +168,8 @@ impl Handler {
>,
) {
let error = match error {
// TODO: remove when Rust 1.82 is MSRV
#[allow(unreachable_patterns)]
StreamUpgradeError::Apply(v) => void::unreachable(v),
StreamUpgradeError::NegotiationFailed => outbound::Error::Unsupported,
StreamUpgradeError::Io(e) => outbound::Error::Io(e),
Expand Down Expand Up @@ -298,6 +304,8 @@ impl ConnectionHandler for Handler {
ConnectionEvent::FullyNegotiatedOutbound(fully_negotiated_outbound) => {
self.on_fully_negotiated_outbound(fully_negotiated_outbound)
}
// TODO: remove when Rust 1.82 is MSRV
#[allow(unreachable_patterns)]
ConnectionEvent::ListenUpgradeError(listen_upgrade_error) => {
self.on_listen_upgrade_error(listen_upgrade_error)
}
Expand Down
4 changes: 4 additions & 0 deletions protocols/gossipsub/src/handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -493,6 +493,8 @@ impl ConnectionHandler for Handler {
..
}) => match protocol {
Either::Left(protocol) => handler.on_fully_negotiated_inbound(protocol),
// TODO: remove when Rust 1.82 is MSRV
#[allow(unreachable_patterns)]
Either::Right(v) => void::unreachable(v),
},
ConnectionEvent::FullyNegotiatedOutbound(fully_negotiated_outbound) => {
Expand All @@ -504,6 +506,8 @@ impl ConnectionHandler for Handler {
}) => {
tracing::debug!("Dial upgrade error: Protocol negotiation timeout");
}
// TODO: remove when Rust 1.82 is MSRV
#[allow(unreachable_patterns)]
ConnectionEvent::DialUpgradeError(DialUpgradeError {
error: StreamUpgradeError::Apply(e),
..
Expand Down
1 change: 1 addition & 0 deletions protocols/gossipsub/src/transform.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
use crate::{Message, RawMessage, TopicHash};

/// A general trait of transforming a [`RawMessage`] into a [`Message`]. The
///
/// [`RawMessage`] is obtained from the wire and the [`Message`] is used to
/// calculate the [`crate::MessageId`] of the message and is what is sent to the application.
///
Expand Down
2 changes: 2 additions & 0 deletions protocols/kad/src/handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -501,6 +501,8 @@ impl Handler {
// is a `Void`.
let protocol = match protocol {
future::Either::Left(p) => p,
// TODO: remove when Rust 1.82 is MSRV
#[allow(unreachable_patterns)]
future::Either::Right(p) => void::unreachable(p),
};

Expand Down
4 changes: 4 additions & 0 deletions protocols/perf/src/client/handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@ impl ConnectionHandler for Handler {
>,
) {
match event {
// TODO: remove when Rust 1.82 is MSRV
#[allow(unreachable_patterns)]
ConnectionEvent::FullyNegotiatedInbound(FullyNegotiatedInbound {
protocol, ..
}) => void::unreachable(protocol),
Expand Down Expand Up @@ -144,6 +146,8 @@ impl ConnectionHandler for Handler {
result: Err(error.into()),
}));
}
// TODO: remove when Rust 1.82 is MSRV
#[allow(unreachable_patterns)]
ConnectionEvent::ListenUpgradeError(ListenUpgradeError { info: (), error }) => {
void::unreachable(error)
}
Expand Down
8 changes: 8 additions & 0 deletions protocols/perf/src/server/handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ impl ConnectionHandler for Handler {
}

fn on_behaviour_event(&mut self, v: Self::FromBehaviour) {
// TODO: remove when Rust 1.82 is MSRV
#[allow(unreachable_patterns)]
void::unreachable(v)
}

Expand All @@ -98,16 +100,22 @@ impl ConnectionHandler for Handler {
tracing::warn!("Dropping inbound stream because we are at capacity");
}
}
// TODO: remove when Rust 1.82 is MSRV
#[allow(unreachable_patterns)]
ConnectionEvent::FullyNegotiatedOutbound(FullyNegotiatedOutbound { info, .. }) => {
void::unreachable(info)
}

// TODO: remove when Rust 1.82 is MSRV
#[allow(unreachable_patterns)]
ConnectionEvent::DialUpgradeError(DialUpgradeError { info, .. }) => {
void::unreachable(info)
}
ConnectionEvent::AddressChange(_)
| ConnectionEvent::LocalProtocolsChange(_)
| ConnectionEvent::RemoteProtocolsChange(_) => {}
// TODO: remove when Rust 1.82 is MSRV
#[allow(unreachable_patterns)]
ConnectionEvent::ListenUpgradeError(ListenUpgradeError { info: (), error }) => {
void::unreachable(error)
}
Expand Down
2 changes: 2 additions & 0 deletions protocols/ping/src/handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,8 @@ impl Handler {
"ping protocol negotiation timed out",
)),
},
// TODO: remove when Rust 1.82 is MSRV
#[allow(unreachable_patterns)]
StreamUpgradeError::Apply(e) => void::unreachable(e),
StreamUpgradeError::Io(e) => Failure::Other { error: Box::new(e) },
};
Expand Down
2 changes: 2 additions & 0 deletions protocols/relay/src/behaviour.rs
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,8 @@ impl NetworkBehaviour for Behaviour {
) {
let event = match event {
Either::Left(e) => e,
// TODO: remove when Rust 1.82 is MSRV
#[allow(unreachable_patterns)]
Either::Right(v) => void::unreachable(v),
};

Expand Down
2 changes: 2 additions & 0 deletions protocols/relay/src/behaviour/handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -449,6 +449,8 @@ impl Handler {
StreamUpgradeError::Timeout => outbound_stop::Error::Io(io::ErrorKind::TimedOut.into()),
StreamUpgradeError::NegotiationFailed => outbound_stop::Error::Unsupported,
StreamUpgradeError::Io(e) => outbound_stop::Error::Io(e),
// TODO: remove when Rust 1.82 is MSRV
#[allow(unreachable_patterns)]
StreamUpgradeError::Apply(v) => void::unreachable(v),
};

Expand Down
2 changes: 2 additions & 0 deletions protocols/relay/src/priv_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,8 @@ impl NetworkBehaviour for Behaviour {
) {
let handler_event = match handler_event {
Either::Left(e) => e,
// TODO: remove when Rust 1.82 is MSRV
#[allow(unreachable_patterns)]
Either::Right(v) => void::unreachable(v),
};

Expand Down
6 changes: 6 additions & 0 deletions protocols/relay/src/priv_client/handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,8 @@ impl ConnectionHandler for Handler {
let _ = next.send(Ok(ev.protocol));
}
}
// TODO: remove when Rust 1.82 is MSRV
#[allow(unreachable_patterns)]
ConnectionEvent::ListenUpgradeError(ev) => void::unreachable(ev.error),
ConnectionEvent::DialUpgradeError(ev) => {
if let Some(next) = self.pending_streams.pop_front() {
Expand Down Expand Up @@ -583,6 +585,8 @@ fn into_reserve_error(e: StreamUpgradeError<Void>) -> outbound_hop::ReserveError
StreamUpgradeError::Timeout => {
outbound_hop::ReserveError::Io(io::ErrorKind::TimedOut.into())
}
// TODO: remove when Rust 1.82 is MSRV
#[allow(unreachable_patterns)]
StreamUpgradeError::Apply(never) => void::unreachable(never),
StreamUpgradeError::NegotiationFailed => outbound_hop::ReserveError::Unsupported,
StreamUpgradeError::Io(e) => outbound_hop::ReserveError::Io(e),
Expand All @@ -594,6 +598,8 @@ fn into_connect_error(e: StreamUpgradeError<Void>) -> outbound_hop::ConnectError
StreamUpgradeError::Timeout => {
outbound_hop::ConnectError::Io(io::ErrorKind::TimedOut.into())
}
// TODO: remove when Rust 1.82 is MSRV
#[allow(unreachable_patterns)]
StreamUpgradeError::Apply(never) => void::unreachable(never),
StreamUpgradeError::NegotiationFailed => outbound_hop::ConnectError::Unsupported,
StreamUpgradeError::Io(e) => outbound_hop::ConnectError::Io(e),
Expand Down
2 changes: 2 additions & 0 deletions protocols/request-response/src/cbor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,8 @@ mod codec {

fn decode_into_io_error(err: cbor4ii::serde::DecodeError<Infallible>) -> io::Error {
match err {
// TODO: remove when Rust 1.82 is MSRV
#[allow(unreachable_patterns)]
cbor4ii::serde::DecodeError::Core(DecodeError::Read(e)) => {
io::Error::new(io::ErrorKind::Other, e)
}
Expand Down
6 changes: 6 additions & 0 deletions protocols/request-response/src/handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,8 @@ where
self.pending_events
.push_back(Event::OutboundUnsupportedProtocols(message.request_id));
}
// TODO: remove when Rust 1.82 is MSRV
#[allow(unreachable_patterns)]
StreamUpgradeError::Apply(e) => void::unreachable(e),
StreamUpgradeError::Io(e) => {
self.pending_events.push_back(Event::OutboundStreamFailed {
Expand All @@ -256,6 +258,8 @@ where
<Self as ConnectionHandler>::InboundProtocol,
>,
) {
// TODO: remove when Rust 1.82 is MSRV
#[allow(unreachable_patterns)]
void::unreachable(error)
}
}
Expand Down Expand Up @@ -484,6 +488,8 @@ where
ConnectionEvent::DialUpgradeError(dial_upgrade_error) => {
self.on_dial_upgrade_error(dial_upgrade_error)
}
// TODO: remove when Rust 1.82 is MSRV
#[allow(unreachable_patterns)]
ConnectionEvent::ListenUpgradeError(listen_upgrade_error) => {
self.on_listen_upgrade_error(listen_upgrade_error)
}
Expand Down
4 changes: 4 additions & 0 deletions protocols/stream/src/handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@ impl ConnectionHandler for Handler {
}

fn on_behaviour_event(&mut self, event: Self::FromBehaviour) {
// TODO: remove when Rust 1.82 is MSRV
#[allow(unreachable_patterns)]
void::unreachable(event)
}

Expand Down Expand Up @@ -143,6 +145,8 @@ impl ConnectionHandler for Handler {
swarm::StreamUpgradeError::Timeout => {
OpenStreamError::Io(io::Error::from(io::ErrorKind::TimedOut))
}
// TODO: remove when Rust 1.82 is MSRV
#[allow(unreachable_patterns)]
swarm::StreamUpgradeError::Apply(v) => void::unreachable(v),
swarm::StreamUpgradeError::NegotiationFailed => {
OpenStreamError::UnsupportedProtocol(p)
Expand Down
4 changes: 4 additions & 0 deletions swarm/src/behaviour/toggle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,8 @@ where
) {
let out = match out {
future::Either::Left(out) => out,
// TODO: remove when Rust 1.82 is MSRV
#[allow(unreachable_patterns)]
future::Either::Right(v) => void::unreachable(v),
};

Expand Down Expand Up @@ -251,6 +253,8 @@ where

let err = match err {
Either::Left(e) => e,
// TODO: remove when Rust 1.82 is MSRV
#[allow(unreachable_patterns)]
Either::Right(v) => void::unreachable(v),
};

Expand Down
10 changes: 10 additions & 0 deletions swarm/src/connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1189,17 +1189,23 @@ mod tests {
>,
) {
match event {
// TODO: remove when Rust 1.82 is MSRV
#[allow(unreachable_patterns)]
ConnectionEvent::FullyNegotiatedInbound(FullyNegotiatedInbound {
protocol,
..
}) => void::unreachable(protocol),
// TODO: remove when Rust 1.82 is MSRV
#[allow(unreachable_patterns)]
ConnectionEvent::FullyNegotiatedOutbound(FullyNegotiatedOutbound {
protocol,
..
}) => void::unreachable(protocol),
ConnectionEvent::DialUpgradeError(DialUpgradeError { error, .. }) => {
self.error = Some(error)
}
// TODO: remove when Rust 1.82 is MSRV
#[allow(unreachable_patterns)]
ConnectionEvent::AddressChange(_)
| ConnectionEvent::ListenUpgradeError(_)
| ConnectionEvent::LocalProtocolsChange(_)
Expand All @@ -1208,6 +1214,8 @@ mod tests {
}

fn on_behaviour_event(&mut self, event: Self::FromBehaviour) {
// TODO: remove when Rust 1.82 is MSRV
#[allow(unreachable_patterns)]
void::unreachable(event)
}

Expand Down Expand Up @@ -1283,6 +1291,8 @@ mod tests {
}

fn on_behaviour_event(&mut self, event: Self::FromBehaviour) {
// TODO: remove when Rust 1.82 is MSRV
#[allow(unreachable_patterns)]
void::unreachable(event)
}

Expand Down
Loading

0 comments on commit 057b94c

Please sign in to comment.