Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unexpected cfg condition value: serde in declare_raft_types! #1301

Closed
sebadob opened this issue Jan 14, 2025 · 3 comments
Closed

unexpected cfg condition value: serde in declare_raft_types! #1301

sebadob opened this issue Jan 14, 2025 · 3 comments

Comments

@sebadob
Copy link

sebadob commented Jan 14, 2025

This is not really a bug (I guess), but clippy is complaining about a line in the openraft::declare_raft_types! macro.
I am usually checking pipelines with cargo clippy -- -D warnings which is why I ran into the issue.

It's most probably about the line

#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]

in the macro definition:

warning: unexpected `cfg` condition value: `serde`
  --> hiqlite/src/store/state_machine/sqlite/mod.rs:11:1
   |
11 | / openraft::declare_raft_types!(
12 | |     pub TypeConfigSqlite:
13 | |         D = QueryWrite,
14 | |         R = Response,
15 | |         Node = Node,
16 | |         SnapshotData = tokio::fs::File,
17 | | );
   | |_^
   |
   = note: expected values for `feature` are: `auto-heal`, `backup`, `cache`, `dashboard`, `default`, `dlock`, `full`, `listen_notify`, `listen_notify_local`, `s3`, `server`, `shutdown-handle`, `sqlite`, and `webpki-roots`
   = help: consider adding `serde` as a feature in `Cargo.toml`
   = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration
   = note: `#[warn(unexpected_cfgs)]` on by default
   = note: this warning originates in the macro `openraft::declare_raft_types` (in Nightly builds, run with -Z macro-backtrace for more info)

When clippy runs, it complains about the serde feature which does only exist for openraft, but not in any other project (most probably) like mine in this case. So I guess this line does not have the desired effect, or is this actually a clippy bug and it does what it should, even when the importing project doesn't have a serde feature?

I am currently using openraft-0.9.17, maybe this is even already gone for 0.10, don't know. I can allow this clippy warning and kind of get rid of the error, but I am not sure if it actually does what it should do in this scenario.

Copy link

👋 Thanks for opening this issue!

Get help or engage by:

  • /help : to print help messages.
  • /assignme : to assign this issue to you.

@SteveLauC
Copy link
Collaborator

This is a known issue, and it has been fixed in #1268

@sebadob
Copy link
Author

sebadob commented Jan 14, 2025

This is a #1270 issue, and it has been fixed in #1268

Thanks.

@sebadob sebadob closed this as completed Jan 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants