diff --git a/examples/raft-kv-memstore-network-v2/src/store.rs b/examples/raft-kv-memstore-network-v2/src/store.rs index a65e55b3b..089f9b323 100644 --- a/examples/raft-kv-memstore-network-v2/src/store.rs +++ b/examples/raft-kv-memstore-network-v2/src/store.rs @@ -49,7 +49,9 @@ pub struct StoredSnapshot { pub data: Box, } -/// Data contained in the Raft state machine. Note that we are using `serde` to serialize the +/// Data contained in the Raft state machine. +/// +/// Note that we are using `serde` to serialize the /// `data`, which has a implementation to be serialized. Note that for this test we set both the key /// and value as String, but you could set any type of value that has the serialization impl. #[derive(Serialize, Deserialize, Debug, Default, Clone)] diff --git a/examples/raft-kv-memstore-opendal-snapshot-data/src/store.rs b/examples/raft-kv-memstore-opendal-snapshot-data/src/store.rs index 56e4a14de..1f6603870 100644 --- a/examples/raft-kv-memstore-opendal-snapshot-data/src/store.rs +++ b/examples/raft-kv-memstore-opendal-snapshot-data/src/store.rs @@ -52,7 +52,9 @@ pub struct StoredSnapshot { pub data: Box, } -/// Data contained in the Raft state machine. Note that we are using `serde` to serialize the +/// Data contained in the Raft state machine. +/// +/// Note that we are using `serde` to serialize the /// `data`, which has a implementation to be serialized. Note that for this test we set both the key /// and value as String, but you could set any type of value that has the serialization impl. #[derive(Serialize, Deserialize, Debug, Default, Clone)] diff --git a/examples/raft-kv-memstore-singlethreaded/src/store.rs b/examples/raft-kv-memstore-singlethreaded/src/store.rs index afb3d3917..6ddb49437 100644 --- a/examples/raft-kv-memstore-singlethreaded/src/store.rs +++ b/examples/raft-kv-memstore-singlethreaded/src/store.rs @@ -78,7 +78,9 @@ pub struct StoredSnapshot { pub data: Vec, } -/// Data contained in the Raft state machine. Note that we are using `serde` to serialize the +/// Data contained in the Raft state machine. +/// +/// Note that we are using `serde` to serialize the /// `data`, which has a implementation to be serialized. Note that for this test we set both the key /// and value as String, but you could set any type of value that has the serialization impl. #[derive(Serialize, Deserialize, Debug, Default, Clone)] diff --git a/examples/raft-kv-memstore/src/store/mod.rs b/examples/raft-kv-memstore/src/store/mod.rs index ab6556e2f..d98dd855e 100644 --- a/examples/raft-kv-memstore/src/store/mod.rs +++ b/examples/raft-kv-memstore/src/store/mod.rs @@ -56,7 +56,9 @@ pub struct StoredSnapshot { pub data: Vec, } -/// Data contained in the Raft state machine. Note that we are using `serde` to serialize the +/// Data contained in the Raft state machine. +/// +/// Note that we are using `serde` to serialize the /// `data`, which has a implementation to be serialized. Note that for this test we set both the key /// and value as String, but you could set any type of value that has the serialization impl. #[derive(Serialize, Deserialize, Debug, Default, Clone)] diff --git a/openraft/src/error/streaming_error.rs b/openraft/src/error/streaming_error.rs index d5983c107..a7f754e96 100644 --- a/openraft/src/error/streaming_error.rs +++ b/openraft/src/error/streaming_error.rs @@ -66,6 +66,7 @@ impl From>> for ReplicationError 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), @@ -80,6 +81,7 @@ impl From> for StreamingError { impl From> for ReplicationError { fn from(e: StreamingError) -> Self { + #[allow(unreachable_patterns)] match e { StreamingError::Closed(e) => ReplicationError::Closed(e), StreamingError::StorageError(e) => ReplicationError::StorageError(e), diff --git a/openraft/src/raft/raft_inner.rs b/openraft/src/raft/raft_inner.rs index 2bbf6cdd2..3c190da40 100644 --- a/openraft/src/raft/raft_inner.rs +++ b/openraft/src/raft/raft_inner.rs @@ -166,11 +166,8 @@ where C: RaftTypeConfig message_summary.unwrap_or_default() ); - match core_res { - // A normal quit is still an unexpected "stop" to the caller. - Ok(_) => Fatal::Stopped, - Err(e) => e, - } + // Safe unwrap: core_res is always an error + core_res.unwrap_err() } /// Wait for `RaftCore` task to finish and record the returned value from the task.