pub static UNEXPECTED_CFGS: &Lint
Expand description

The unexpected_cfgs lint detects unexpected conditional compilation conditions.

Example

rustc --check-cfg 'names()'
#[cfg(widnows)]
fn foo() {}

This will produce:

warning: unknown condition name used
 --> lint_example.rs:1:7
  |
1 | #[cfg(widnows)]
  |       ^^^^^^^
  |
  = note: `#[warn(unexpected_cfgs)]` on by default

Explanation

This lint is only active when a --check-cfg='names(...)' option has been passed to the compiler and triggers whenever an unknown condition name or value is used. The known condition include names or values passed in --check-cfg, --cfg, and some well-knows names and values built into the compiler.