From a209c1f07db2bed6d2b0a944958ecb440047bc7c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E7=82=8E=E6=B3=BC?= Date: Mon, 20 Nov 2023 20:34:34 +0800 Subject: [PATCH] Fixup: remove needless unsafe impl Send|Sync for Raft --- openraft/src/raft/mod.rs | 35 ----------------------------------- 1 file changed, 35 deletions(-) diff --git a/openraft/src/raft/mod.rs b/openraft/src/raft/mod.rs index 56b569383..f585db347 100644 --- a/openraft/src/raft/mod.rs +++ b/openraft/src/raft/mod.rs @@ -133,41 +133,6 @@ where C: RaftTypeConfig inner: Arc>, } -#[cfg(feature = "singlethreaded")] -// SAFETY: Even for a single-threaded Raft, the API object is MT-capable. -// -// The API object just sends the requests to the Raft loop over a channel. If all the relevant -// types in the type config are `Send`, then it's safe to send the request across threads over -// the channel. -// -// Notably, the state machine, log storage and network factory DO NOT have to be `Send`, those -// are only used within Raft task(s) on a single thread. -unsafe impl Send for Raft -where - C: RaftTypeConfig, - C::D: Send, - C::Entry: Send, - C::Node: Send + Sync, - C::NodeId: Send + Sync, - C::R: Send, -{ -} - -#[cfg(feature = "singlethreaded")] -// SAFETY: Even for a single-threaded Raft, the API object is MT-capable. -// -// See above for details. -unsafe impl Sync for Raft -where - C: RaftTypeConfig + Send, - C::D: Send, - C::Entry: Send, - C::Node: Send + Sync, - C::NodeId: Send + Sync, - C::R: Send, -{ -} - impl Raft where C: RaftTypeConfig {