Skip to content

Commit 3a77975

Browse files
committed
Remove custom NeverOkResult trait and instead use new Rust 1.82 matching
1 parent 24b2e25 commit 3a77975

File tree

2 files changed

+1
-14
lines changed

2 files changed

+1
-14
lines changed

src/forward_traffic.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
use crate::NeverOkResult;
21
use err_context::BoxedErrorExt as _;
32
use err_context::ResultExt as _;
43
use futures::future::select;
@@ -41,7 +40,7 @@ pub async fn process_udp_over_tcp(
4140
}
4241
};
4342
let udp2tcp = async move {
44-
let error = process_udp2tcp(udp_in, tcp_out).await.into_error();
43+
let Err(error) = process_udp2tcp(udp_in, tcp_out).await;
4544
log::error!("Error: {}", error.display("\nCaused by: "));
4645
};
4746

src/lib.rs

-12
Original file line numberDiff line numberDiff line change
@@ -95,15 +95,3 @@ pub use tcp_options::{ApplyTcpOptionsError, ApplyTcpOptionsErrorKind, TcpOptions
9595

9696
/// Size of the header (in bytes) that is prepended to each datagram in the TCP stream.
9797
pub use forward_traffic::HEADER_LEN;
98-
99-
/// Helper trait for `Result<Infallible, E>` types. Allows getting the `E` value
100-
/// in a way that is guaranteed to not panic.
101-
pub trait NeverOkResult<E> {
102-
fn into_error(self) -> E;
103-
}
104-
105-
impl<E> NeverOkResult<E> for Result<std::convert::Infallible, E> {
106-
fn into_error(self) -> E {
107-
self.expect_err("Result<Infallible, _> can't be Ok variant")
108-
}
109-
}

0 commit comments

Comments
 (0)