Skip to content

Commit 4ee0e07

Browse files
authored
chore: remove unreachable_patterns lint according to note
Remove some `#[allow(unreachable_patterns)]` with libp2p#5650 merged. Pull-Request: libp2p#5933.
1 parent 924321a commit 4ee0e07

File tree

29 files changed

+1
-116
lines changed

29 files changed

+1
-116
lines changed

misc/allow-block-list/src/lib.rs

-2
Original file line numberDiff line numberDiff line change
@@ -277,8 +277,6 @@ where
277277
_: ConnectionId,
278278
event: THandlerOutEvent<Self>,
279279
) {
280-
// TODO: remove when Rust 1.82 is MSRV
281-
#[allow(unreachable_patterns)]
282280
libp2p_core::util::unreachable(event)
283281
}
284282

misc/connection-limits/src/lib.rs

-4
Original file line numberDiff line numberDiff line change
@@ -390,8 +390,6 @@ impl NetworkBehaviour for Behaviour {
390390
_: ConnectionId,
391391
event: THandlerOutEvent<Self>,
392392
) {
393-
// TODO: remove when Rust 1.82 is MSRV
394-
#[allow(unreachable_patterns)]
395393
libp2p_core::util::unreachable(event)
396394
}
397395

@@ -722,8 +720,6 @@ mod tests {
722720
_connection_id: ConnectionId,
723721
event: THandlerOutEvent<Self>,
724722
) {
725-
// TODO: remove when Rust 1.82 is MSRV
726-
#[allow(unreachable_patterns)]
727723
libp2p_core::util::unreachable(event)
728724
}
729725

misc/memory-connection-limits/src/lib.rs

-2
Original file line numberDiff line numberDiff line change
@@ -196,8 +196,6 @@ impl NetworkBehaviour for Behaviour {
196196
_: ConnectionId,
197197
event: THandlerOutEvent<Self>,
198198
) {
199-
// TODO: remove when Rust 1.82 is MSRV
200-
#[allow(unreachable_patterns)]
201199
libp2p_core::util::unreachable(event)
202200
}
203201

misc/memory-connection-limits/tests/util/mod.rs

-2
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,6 @@ impl<const MEM_PENDING: usize, const MEM_ESTABLISHED: usize> NetworkBehaviour
118118
_: ConnectionId,
119119
event: THandlerOutEvent<Self>,
120120
) {
121-
// TODO: remove when Rust 1.82 is MSRV
122-
#[allow(unreachable_patterns)]
123121
libp2p_core::util::unreachable(event)
124122
}
125123

protocols/autonat/src/v2/client/handler/dial_back.rs

-2
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,6 @@ impl ConnectionHandler for Handler {
7676
tracing::warn!("Dial back request dropped, too many requests in flight");
7777
}
7878
}
79-
// TODO: remove when Rust 1.82 is MSRV
80-
#[allow(unreachable_patterns)]
8179
ConnectionEvent::ListenUpgradeError(ListenUpgradeError { error, .. }) => {
8280
libp2p_core::util::unreachable(error);
8381
}

protocols/autonat/src/v2/client/handler/dial_request.rs

-2
Original file line numberDiff line numberDiff line change
@@ -210,8 +210,6 @@ async fn start_stream_handle(
210210
.map_err(|e| match e {
211211
StreamUpgradeError::NegotiationFailed => Error::UnsupportedProtocol,
212212
StreamUpgradeError::Timeout => Error::Io(io::ErrorKind::TimedOut.into()),
213-
// TODO: remove when Rust 1.82 is MSRV
214-
#[allow(unreachable_patterns)]
215213
StreamUpgradeError::Apply(v) => libp2p_core::util::unreachable(v),
216214
StreamUpgradeError::Io(e) => Error::Io(e),
217215
})?;

protocols/autonat/src/v2/server/behaviour.rs

-2
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,6 @@ where
111111
Either::Left(Either::Left(Err(e))) => {
112112
tracing::debug!("dial back error: {e:?}");
113113
}
114-
// TODO: remove when Rust 1.82 is MSRV
115-
#[allow(unreachable_patterns)]
116114
Either::Left(Either::Right(v)) => libp2p_core::util::unreachable(v),
117115
Either::Right(Either::Left(cmd)) => {
118116
let addr = cmd.addr.clone();

protocols/autonat/src/v2/server/handler/dial_request.rs

-2
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,6 @@ where
137137
);
138138
}
139139
}
140-
// TODO: remove when Rust 1.82 is MSRV
141-
#[allow(unreachable_patterns)]
142140
ConnectionEvent::ListenUpgradeError(ListenUpgradeError { error, .. }) => {
143141
tracing::debug!("inbound request failed: {:?}", error);
144142
}

protocols/dcutr/src/behaviour.rs

-2
Original file line numberDiff line numberDiff line change
@@ -319,8 +319,6 @@ impl NetworkBehaviour for Behaviour {
319319
.or_default() += 1;
320320
self.queued_events.push_back(ToSwarm::Dial { opts });
321321
}
322-
// TODO: remove when Rust 1.82 is MSRV
323-
#[allow(unreachable_patterns)]
324322
Either::Right(never) => libp2p_core::util::unreachable(never),
325323
};
326324
}

protocols/dcutr/src/handler/relayed.rs

+1-8
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,7 @@ impl Handler {
117117
self.attempts += 1;
118118
}
119119
// A connection listener denies all incoming substreams, thus none can ever be fully
120-
// negotiated. TODO: remove when Rust 1.82 is MSRV
121-
#[allow(unreachable_patterns)]
120+
// negotiated.
122121
future::Either::Right(output) => libp2p_core::util::unreachable(output),
123122
}
124123
}
@@ -154,8 +153,6 @@ impl Handler {
154153
<Self as ConnectionHandler>::InboundProtocol,
155154
>,
156155
) {
157-
// TODO: remove when Rust 1.82 is MSRV
158-
#[allow(unreachable_patterns)]
159156
libp2p_core::util::unreachable(error.into_inner());
160157
}
161158

@@ -167,8 +164,6 @@ impl Handler {
167164
>,
168165
) {
169166
let error = match error {
170-
// TODO: remove when Rust 1.82 is MSRV
171-
#[allow(unreachable_patterns)]
172167
StreamUpgradeError::Apply(v) => libp2p_core::util::unreachable(v),
173168
StreamUpgradeError::NegotiationFailed => outbound::Error::Unsupported,
174169
StreamUpgradeError::Io(e) => outbound::Error::Io(e),
@@ -296,8 +291,6 @@ impl ConnectionHandler for Handler {
296291
ConnectionEvent::FullyNegotiatedOutbound(fully_negotiated_outbound) => {
297292
self.on_fully_negotiated_outbound(fully_negotiated_outbound)
298293
}
299-
// TODO: remove when Rust 1.82 is MSRV
300-
#[allow(unreachable_patterns)]
301294
ConnectionEvent::ListenUpgradeError(listen_upgrade_error) => {
302295
self.on_listen_upgrade_error(listen_upgrade_error)
303296
}

protocols/gossipsub/src/handler.rs

-4
Original file line numberDiff line numberDiff line change
@@ -516,8 +516,6 @@ impl ConnectionHandler for Handler {
516516
..
517517
}) => match protocol {
518518
Either::Left(protocol) => handler.on_fully_negotiated_inbound(protocol),
519-
// TODO: remove when Rust 1.82 is MSRV
520-
#[allow(unreachable_patterns)]
521519
Either::Right(v) => libp2p_core::util::unreachable(v),
522520
},
523521
ConnectionEvent::FullyNegotiatedOutbound(fully_negotiated_outbound) => {
@@ -529,8 +527,6 @@ impl ConnectionHandler for Handler {
529527
}) => {
530528
tracing::debug!("Dial upgrade error: Protocol negotiation timeout");
531529
}
532-
// TODO: remove when Rust 1.82 is MSRV
533-
#[allow(unreachable_patterns)]
534530
ConnectionEvent::DialUpgradeError(DialUpgradeError {
535531
error: StreamUpgradeError::Apply(e),
536532
..

protocols/kad/src/handler.rs

-2
Original file line numberDiff line numberDiff line change
@@ -503,8 +503,6 @@ impl Handler {
503503
// is a `Infallible`.
504504
let protocol = match protocol {
505505
future::Either::Left(p) => p,
506-
// TODO: remove when Rust 1.82 is MSRV
507-
#[allow(unreachable_patterns)]
508506
future::Either::Right(p) => libp2p_core::util::unreachable(p),
509507
};
510508

protocols/perf/src/client/handler.rs

-4
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,6 @@ impl ConnectionHandler for Handler {
109109
event: ConnectionEvent<Self::InboundProtocol, Self::OutboundProtocol>,
110110
) {
111111
match event {
112-
// TODO: remove when Rust 1.82 is MSRV
113-
#[allow(unreachable_patterns)]
114112
ConnectionEvent::FullyNegotiatedInbound(FullyNegotiatedInbound {
115113
protocol, ..
116114
}) => libp2p_core::util::unreachable(protocol),
@@ -143,8 +141,6 @@ impl ConnectionHandler for Handler {
143141
result: Err(error.into()),
144142
}));
145143
}
146-
// TODO: remove when Rust 1.82 is MSRV
147-
#[allow(unreachable_patterns)]
148144
ConnectionEvent::ListenUpgradeError(ListenUpgradeError { info: (), error }) => {
149145
libp2p_core::util::unreachable(error)
150146
}

protocols/perf/src/server/handler.rs

-8
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,6 @@ impl ConnectionHandler for Handler {
7575
}
7676

7777
fn on_behaviour_event(&mut self, v: Self::FromBehaviour) {
78-
// TODO: remove when Rust 1.82 is MSRV
79-
#[allow(unreachable_patterns)]
8078
libp2p_core::util::unreachable(v)
8179
}
8280

@@ -97,22 +95,16 @@ impl ConnectionHandler for Handler {
9795
tracing::warn!("Dropping inbound stream because we are at capacity");
9896
}
9997
}
100-
// TODO: remove when Rust 1.82 is MSRV
101-
#[allow(unreachable_patterns)]
10298
ConnectionEvent::FullyNegotiatedOutbound(FullyNegotiatedOutbound { info, .. }) => {
10399
libp2p_core::util::unreachable(info)
104100
}
105101

106-
// TODO: remove when Rust 1.82 is MSRV
107-
#[allow(unreachable_patterns)]
108102
ConnectionEvent::DialUpgradeError(DialUpgradeError { info, .. }) => {
109103
libp2p_core::util::unreachable(info)
110104
}
111105
ConnectionEvent::AddressChange(_)
112106
| ConnectionEvent::LocalProtocolsChange(_)
113107
| ConnectionEvent::RemoteProtocolsChange(_) => {}
114-
// TODO: remove when Rust 1.82 is MSRV
115-
#[allow(unreachable_patterns)]
116108
ConnectionEvent::ListenUpgradeError(ListenUpgradeError { info: (), error }) => {
117109
libp2p_core::util::unreachable(error)
118110
}

protocols/ping/src/handler.rs

-2
Original file line numberDiff line numberDiff line change
@@ -211,8 +211,6 @@ impl Handler {
211211
"ping protocol negotiation timed out",
212212
)),
213213
},
214-
// TODO: remove when Rust 1.82 is MSRV
215-
#[allow(unreachable_patterns)]
216214
StreamUpgradeError::Apply(e) => libp2p_core::util::unreachable(e),
217215
StreamUpgradeError::Io(e) => Failure::Other { error: Box::new(e) },
218216
};

protocols/relay/src/behaviour.rs

-2
Original file line numberDiff line numberDiff line change
@@ -379,8 +379,6 @@ impl NetworkBehaviour for Behaviour {
379379
) {
380380
let event = match event {
381381
Either::Left(e) => e,
382-
// TODO: remove when Rust 1.82 is MSRV
383-
#[allow(unreachable_patterns)]
384382
Either::Right(v) => libp2p_core::util::unreachable(v),
385383
};
386384

protocols/relay/src/behaviour/handler.rs

-2
Original file line numberDiff line numberDiff line change
@@ -455,8 +455,6 @@ impl Handler {
455455
StreamUpgradeError::Timeout => outbound_stop::Error::Io(io::ErrorKind::TimedOut.into()),
456456
StreamUpgradeError::NegotiationFailed => outbound_stop::Error::Unsupported,
457457
StreamUpgradeError::Io(e) => outbound_stop::Error::Io(e),
458-
// TODO: remove when Rust 1.82 is MSRV
459-
#[allow(unreachable_patterns)]
460458
StreamUpgradeError::Apply(v) => libp2p_core::util::unreachable(v),
461459
};
462460

protocols/relay/src/priv_client.rs

-2
Original file line numberDiff line numberDiff line change
@@ -237,8 +237,6 @@ impl NetworkBehaviour for Behaviour {
237237
) {
238238
let handler_event = match handler_event {
239239
Either::Left(e) => e,
240-
// TODO: remove when Rust 1.82 is MSRV
241-
#[allow(unreachable_patterns)]
242240
Either::Right(v) => libp2p_core::util::unreachable(v),
243241
};
244242

protocols/relay/src/priv_client/handler.rs

-6
Original file line numberDiff line numberDiff line change
@@ -444,8 +444,6 @@ impl ConnectionHandler for Handler {
444444
let _ = next.send(Ok(ev.protocol));
445445
}
446446
}
447-
// TODO: remove when Rust 1.82 is MSRV
448-
#[allow(unreachable_patterns)]
449447
ConnectionEvent::ListenUpgradeError(ev) => libp2p_core::util::unreachable(ev.error),
450448
ConnectionEvent::DialUpgradeError(ev) => {
451449
if let Some(next) = self.pending_streams.pop_front() {
@@ -584,8 +582,6 @@ fn into_reserve_error(e: StreamUpgradeError<Infallible>) -> outbound_hop::Reserv
584582
StreamUpgradeError::Timeout => {
585583
outbound_hop::ReserveError::Io(io::ErrorKind::TimedOut.into())
586584
}
587-
// TODO: remove when Rust 1.82 is MSRV
588-
#[allow(unreachable_patterns)]
589585
StreamUpgradeError::Apply(never) => libp2p_core::util::unreachable(never),
590586
StreamUpgradeError::NegotiationFailed => outbound_hop::ReserveError::Unsupported,
591587
StreamUpgradeError::Io(e) => outbound_hop::ReserveError::Io(e),
@@ -597,8 +593,6 @@ fn into_connect_error(e: StreamUpgradeError<Infallible>) -> outbound_hop::Connec
597593
StreamUpgradeError::Timeout => {
598594
outbound_hop::ConnectError::Io(io::ErrorKind::TimedOut.into())
599595
}
600-
// TODO: remove when Rust 1.82 is MSRV
601-
#[allow(unreachable_patterns)]
602596
StreamUpgradeError::Apply(never) => libp2p_core::util::unreachable(never),
603597
StreamUpgradeError::NegotiationFailed => outbound_hop::ConnectError::Unsupported,
604598
StreamUpgradeError::Io(e) => outbound_hop::ConnectError::Io(e),

protocols/request-response/src/cbor.rs

-2
Original file line numberDiff line numberDiff line change
@@ -179,8 +179,6 @@ pub mod codec {
179179

180180
fn decode_into_io_error(err: cbor4ii::serde::DecodeError<Infallible>) -> io::Error {
181181
match err {
182-
// TODO: remove when Rust 1.82 is MSRV
183-
#[allow(unreachable_patterns)]
184182
cbor4ii::serde::DecodeError::Core(DecodeError::Read(e)) => {
185183
io::Error::new(io::ErrorKind::Other, e)
186184
}

protocols/request-response/src/handler.rs

-6
Original file line numberDiff line numberDiff line change
@@ -236,8 +236,6 @@ where
236236
self.pending_events
237237
.push_back(Event::OutboundUnsupportedProtocols(message.request_id));
238238
}
239-
// TODO: remove when Rust 1.82 is MSRV
240-
#[allow(unreachable_patterns)]
241239
StreamUpgradeError::Apply(e) => libp2p_core::util::unreachable(e),
242240
StreamUpgradeError::Io(e) => {
243241
self.pending_events.push_back(Event::OutboundStreamFailed {
@@ -254,8 +252,6 @@ where
254252
<Self as ConnectionHandler>::InboundProtocol,
255253
>,
256254
) {
257-
// TODO: remove when Rust 1.82 is MSRV
258-
#[allow(unreachable_patterns)]
259255
libp2p_core::util::unreachable(error)
260256
}
261257
}
@@ -479,8 +475,6 @@ where
479475
ConnectionEvent::DialUpgradeError(dial_upgrade_error) => {
480476
self.on_dial_upgrade_error(dial_upgrade_error)
481477
}
482-
// TODO: remove when Rust 1.82 is MSRV
483-
#[allow(unreachable_patterns)]
484478
ConnectionEvent::ListenUpgradeError(listen_upgrade_error) => {
485479
self.on_listen_upgrade_error(listen_upgrade_error)
486480
}

protocols/stream/src/handler.rs

-4
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,6 @@ impl ConnectionHandler for Handler {
8989
}
9090

9191
fn on_behaviour_event(&mut self, event: Self::FromBehaviour) {
92-
// TODO: remove when Rust 1.82 is MSRV
93-
#[allow(unreachable_patterns)]
9492
libp2p_core::util::unreachable(event)
9593
}
9694

@@ -133,8 +131,6 @@ impl ConnectionHandler for Handler {
133131
swarm::StreamUpgradeError::Timeout => {
134132
OpenStreamError::Io(io::Error::from(io::ErrorKind::TimedOut))
135133
}
136-
// TODO: remove when Rust 1.82 is MSRV
137-
#[allow(unreachable_patterns)]
138134
swarm::StreamUpgradeError::Apply(v) => libp2p_core::util::unreachable(v),
139135
swarm::StreamUpgradeError::NegotiationFailed => {
140136
OpenStreamError::UnsupportedProtocol(p)

swarm/src/behaviour/toggle.rs

-4
Original file line numberDiff line numberDiff line change
@@ -212,8 +212,6 @@ where
212212
) {
213213
let out = match out {
214214
future::Either::Left(out) => out,
215-
// TODO: remove when Rust 1.82 is MSRV
216-
#[allow(unreachable_patterns)]
217215
future::Either::Right(v) => libp2p_core::util::unreachable(v),
218216
};
219217

@@ -254,8 +252,6 @@ where
254252

255253
let err = match err {
256254
Either::Left(e) => e,
257-
// TODO: remove when Rust 1.82 is MSRV
258-
#[allow(unreachable_patterns)]
259255
Either::Right(v) => libp2p_core::util::unreachable(v),
260256
};
261257

swarm/src/connection.rs

-10
Original file line numberDiff line numberDiff line change
@@ -1203,23 +1203,17 @@ mod tests {
12031203
event: ConnectionEvent<Self::InboundProtocol, Self::OutboundProtocol>,
12041204
) {
12051205
match event {
1206-
// TODO: remove when Rust 1.82 is MSRV
1207-
#[allow(unreachable_patterns)]
12081206
ConnectionEvent::FullyNegotiatedInbound(FullyNegotiatedInbound {
12091207
protocol,
12101208
..
12111209
}) => libp2p_core::util::unreachable(protocol),
1212-
// TODO: remove when Rust 1.82 is MSRV
1213-
#[allow(unreachable_patterns)]
12141210
ConnectionEvent::FullyNegotiatedOutbound(FullyNegotiatedOutbound {
12151211
protocol,
12161212
..
12171213
}) => libp2p_core::util::unreachable(protocol),
12181214
ConnectionEvent::DialUpgradeError(DialUpgradeError { error, .. }) => {
12191215
self.error = Some(error)
12201216
}
1221-
// TODO: remove when Rust 1.82 is MSRV
1222-
#[allow(unreachable_patterns)]
12231217
ConnectionEvent::AddressChange(_)
12241218
| ConnectionEvent::ListenUpgradeError(_)
12251219
| ConnectionEvent::LocalProtocolsChange(_)
@@ -1228,8 +1222,6 @@ mod tests {
12281222
}
12291223

12301224
fn on_behaviour_event(&mut self, event: Self::FromBehaviour) {
1231-
// TODO: remove when Rust 1.82 is MSRV
1232-
#[allow(unreachable_patterns)]
12331225
libp2p_core::util::unreachable(event)
12341226
}
12351227

@@ -1292,8 +1284,6 @@ mod tests {
12921284
}
12931285

12941286
fn on_behaviour_event(&mut self, event: Self::FromBehaviour) {
1295-
// TODO: remove when Rust 1.82 is MSRV
1296-
#[allow(unreachable_patterns)]
12971287
libp2p_core::util::unreachable(event)
12981288
}
12991289

swarm/src/connection/pool/task.rs

-4
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,6 @@ pub(crate) async fn new_for_pending_outgoing_connection(
106106
})
107107
.await;
108108
}
109-
// TODO: remove when Rust 1.82 is MSRV
110-
#[allow(unreachable_patterns)]
111109
Either::Left((Ok(v), _)) => libp2p_core::util::unreachable(v),
112110
Either::Right((Ok((address, output, errors)), _)) => {
113111
let _ = events
@@ -146,8 +144,6 @@ pub(crate) async fn new_for_pending_incoming_connection<TFut>(
146144
})
147145
.await;
148146
}
149-
// TODO: remove when Rust 1.82 is MSRV
150-
#[allow(unreachable_patterns)]
151147
Either::Left((Ok(v), _)) => libp2p_core::util::unreachable(v),
152148
Either::Right((Ok(output), _)) => {
153149
let _ = events

0 commit comments

Comments
 (0)