hobofan / cargo-nono

Check your crate for (possible) no_std compatibility
Apache License 2.0
209 stars 12 forks source link

cargo-nono does not detect `#![cfg_attr(not(any(test, doctest)), no_std)]` #61

Open abdes opened 3 years ago

abdes commented 3 years ago

A crate with #![cfg_attr(not(any(test, doctest)), no_std)] definitely does not need std for it to be used, although it uses std for some of its own tests.

Is there any reason why this pattern is considered not valid by cargo-nono?

laysakura commented 3 years ago

Similarly cannot detect #![cfg_attr(all(not(feature = "std"), not(test)), no_std)] https://github.com/mvdnes/spin-rs/blob/master/src/lib.rs#L1

kpp commented 3 years ago

Cannot detect #![cfg_attr(not(any(test, feature = "std")), no_std)]

john-anchor commented 2 years ago

Seeing this erroneously flag base64-0.13.0 due to #[cfg(any(feature = "std", test))]

hobofan commented 1 year ago

In case I/someone wants to include a robust solution for this: I just stumbled upon https://crates.io/crates/cfg-expr, which cargo-nono should be able to leverage.