From ececf02b48ad82375a7c3fb8e061d6b1a11bd740 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E7=82=8E=E6=B3=BC?= Date: Tue, 5 Mar 2024 19:58:27 +0800 Subject: [PATCH] Chore: fix lint warning --- openraft/src/core/raft_core.rs | 4 ++-- openraft/src/entry/mod.rs | 2 +- openraft/src/testing/suite.rs | 4 ++-- openraft/src/vote/leader_id/leader_id_adv.rs | 2 +- openraft/src/vote/leader_id/leader_id_std.rs | 4 ++-- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/openraft/src/core/raft_core.rs b/openraft/src/core/raft_core.rs index 921a08fb7..7bd6eb2b9 100644 --- a/openraft/src/core/raft_core.rs +++ b/openraft/src/core/raft_core.rs @@ -622,8 +622,8 @@ where /// Reject a request due to the Raft node being in a state which prohibits the request. #[tracing::instrument(level = "trace", skip(self, tx))] - pub(crate) fn reject_with_forward_to_leader(&self, tx: ResultSender) - where E: From> { + pub(crate) fn reject_with_forward_to_leader(&self, tx: ResultSender) + where E: From> + OptionalSend { let mut leader_id = self.current_leader(); let leader_node = self.get_leader_node(leader_id); diff --git a/openraft/src/entry/mod.rs b/openraft/src/entry/mod.rs index 342d09c34..f64b3f042 100644 --- a/openraft/src/entry/mod.rs +++ b/openraft/src/entry/mod.rs @@ -42,7 +42,7 @@ where impl Debug for Entry where C: RaftTypeConfig { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> std::fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.debug_struct("Entry").field("log_id", &self.log_id).field("payload", &self.payload).finish() } } diff --git a/openraft/src/testing/suite.rs b/openraft/src/testing/suite.rs index 49eb2a895..5038256cb 100644 --- a/openraft/src/testing/suite.rs +++ b/openraft/src/testing/suite.rs @@ -1098,8 +1098,8 @@ where } } -fn log_id_0(term: u64, index: u64) -> LogId -where NID: From { +fn log_id_0(term: u64, index: u64) -> LogId +where NID: NodeId + From { LogId { leader_id: CommittedLeaderId::new(term, NODE_ID.into()), index, diff --git a/openraft/src/vote/leader_id/leader_id_adv.rs b/openraft/src/vote/leader_id/leader_id_adv.rs index a738a5f90..0a849c269 100644 --- a/openraft/src/vote/leader_id/leader_id_adv.rs +++ b/openraft/src/vote/leader_id/leader_id_adv.rs @@ -47,7 +47,7 @@ impl LeaderId { } } -impl std::fmt::Display for LeaderId { +impl fmt::Display for LeaderId { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!(f, "{}-{}", self.term, self.node_id) } diff --git a/openraft/src/vote/leader_id/leader_id_std.rs b/openraft/src/vote/leader_id/leader_id_std.rs index f330183b4..f69a348fb 100644 --- a/openraft/src/vote/leader_id/leader_id_std.rs +++ b/openraft/src/vote/leader_id/leader_id_std.rs @@ -67,7 +67,7 @@ impl LeaderId { } } -impl std::fmt::Display for LeaderId { +impl fmt::Display for LeaderId { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!(f, "{}-{:?}", self.term, self.voted_for) } @@ -82,7 +82,7 @@ pub struct CommittedLeaderId { p: PhantomData, } -impl std::fmt::Display for CommittedLeaderId { +impl fmt::Display for CommittedLeaderId { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!(f, "{}", self.term) }