diff --git a/openraft/src/error.rs b/openraft/src/error.rs index 36788edca..d492e2baa 100644 --- a/openraft/src/error.rs +++ b/openraft/src/error.rs @@ -321,7 +321,6 @@ where C: RaftTypeConfig RPCError::Unreachable(e) => RPCError::Unreachable(e), RPCError::PayloadTooLarge(e) => RPCError::PayloadTooLarge(e), RPCError::Network(e) => RPCError::Network(e), - RPCError::RemoteError(_infallible) => unreachable!(), } } } diff --git a/openraft/src/error/into_ok.rs b/openraft/src/error/into_ok.rs index a023ef541..1b248683d 100644 --- a/openraft/src/error/into_ok.rs +++ b/openraft/src/error/into_ok.rs @@ -11,7 +11,11 @@ where E: Into fn into_ok(self) -> T { match self { Ok(t) => t, - Err(_) => unreachable!(), + Err(e) => { + // NOTE: `allow` required because of buggy reachability detection by rust compiler + #[allow(unreachable_code)] + match e.into() {} + } } } } diff --git a/openraft/src/error/streaming_error.rs b/openraft/src/error/streaming_error.rs index d3ab25f11..3c77e7ec1 100644 --- a/openraft/src/error/streaming_error.rs +++ b/openraft/src/error/streaming_error.rs @@ -48,7 +48,6 @@ impl From> for ReplicationError { impl From> for StreamingError { fn from(value: RPCError) -> Self { - #[allow(unreachable_patterns)] match value { RPCError::Timeout(e) => StreamingError::Timeout(e), RPCError::Unreachable(e) => StreamingError::Unreachable(e), @@ -56,9 +55,6 @@ impl From> for StreamingError { unreachable!("PayloadTooLarge should not be converted to StreamingError") } RPCError::Network(e) => StreamingError::Network(e), - RPCError::RemoteError(_e) => { - unreachable!("Infallible error should not be produced at all") - } } } } diff --git a/rt-monoio/src/lib.rs b/rt-monoio/src/lib.rs index d339ba348..68b398e7c 100644 --- a/rt-monoio/src/lib.rs +++ b/rt-monoio/src/lib.rs @@ -74,11 +74,8 @@ impl AsyncRuntime for MonoioRuntime { } #[inline] - fn is_panic(_join_error: &Self::JoinError) -> bool { - // Given that joining a task will never fail, i.e., `Self::JoinError` - // will never be constructed, and it is impossible to construct an - // enum like `Infallible`, this function could never be invoked. - unreachable!("unreachable since argument `join_error` could never be constructed") + fn is_panic(join_error: &Self::JoinError) -> bool { + match *join_error {} } #[inline]