Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion openraft/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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!(),
}
}
}
Expand Down
6 changes: 5 additions & 1 deletion openraft/src/error/into_ok.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@ where E: Into<Infallible>
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() {}
}
}
}
}
Expand Down
4 changes: 0 additions & 4 deletions openraft/src/error/streaming_error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,17 +48,13 @@ impl<C: RaftTypeConfig> From<StreamingError<C>> for ReplicationError<C> {

impl<C: RaftTypeConfig> From<RPCError<C>> for StreamingError<C> {
fn from(value: RPCError<C>) -> Self {
#[allow(unreachable_patterns)]
match value {
RPCError::Timeout(e) => StreamingError::Timeout(e),
RPCError::Unreachable(e) => StreamingError::Unreachable(e),
RPCError::PayloadTooLarge(_e) => {
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")
}
}
}
}
7 changes: 2 additions & 5 deletions rt-monoio/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
Loading