Closed
Description
Test case:
#![warn(nonminimal_bool)]
fn main() {
let _ = !cfg!(windows);
}
Clippy will warn:
warning: this boolean expression can be simplified
--> src/main.rs:3:13
|
3 | let _ = !cfg!(windows);
| ^^^^^^^^^^^^^^ help: try `true`
|
note: lint level defined here
--> src/main.rs:1:9
|
1 | #![warn(nonminimal_bool)]
| ^^^^^^^^^^^^^^^
= help: for further information visit https://github.com/Manishearth/rust-clippy/wiki#nonminimal_bool
The suggestion (try `true`
) is wrong because the code will lose portability. Instead Clippy should suggest cfg!(not(windows))
or just don't emit the warning.
$ cargo clippy --version
0.0.143
Metadata
Metadata
Assignees
Labels
No labels