Open
Description
What it does
Checks if the value used with #[cfg(target_arch = "XXX")]
is valid.
Categories (optional)
- Kind: correctness
For example:
- Detects dead code that almost certainly shouldn't be dead
Drawbacks
Might not be forwards-compatible with architectures added by future compilers. For example, if Rust 1.75.0 adds support for itanium and a crate cfg-gates on that, Clippy 1.74.0 would falsely warn about it.
Example
A real-world example from the Nix crate: nix-rust/nix#1566
#[cfg(target_arch = "ppc")]
pub struct Foo{}
Should be written as:
#[cfg(any(target_arch = "powerpc", target_arch = "powerpc64"))]
pub struct Foo{}