Skip to content

Commit 5ae1965

Browse files
committed
Fix: Remove serde feature detection from declare_raft_types! macro
The `[cfg_attr(feature = "serde")]` feature detection for `RaftTypeConfig` implementation should not be evaluated in application crates when the `declare_raft_types!` macro is called. This detection logic should be removed from the macro and instead added to each type that uses `RaftTypeConfig`.
1 parent 6b94d62 commit 5ae1965

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

openraft/src/raft/declare_raft_types_test.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
//! Test the `declare_raft_types` macro with default values
22
3+
#![allow(dead_code)]
4+
35
use std::io::Cursor;
46

57
use crate::declare_raft_types;

openraft/src/raft/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,6 @@ macro_rules! declare_raft_types {
152152
($(#[$outer:meta])* $visibility:vis $id:ident: $($(#[$inner:meta])* $type_id:ident = $type:ty),* $(,)? ) => {
153153
$(#[$outer])*
154154
#[derive(Debug, Clone, Copy, Default, Eq, PartialEq, Ord, PartialOrd)]
155-
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
156155
$visibility struct $id {}
157156

158157
impl $crate::RaftTypeConfig for $id {

0 commit comments

Comments
 (0)