Closed
Description
Clippy gives wrong suggestions if there's a bool comparison with a result of cfg!(...)
macro, e.g. testing for a feature flag:
error: inequality checks against false are unnecessary
--> safe_core/src/ipc/mod.rs:86:8
|
86 | if mock != cfg!(feature = "use-mock-routing") {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try simplifying it as shown: `mock`
|
If I try to compile with the future switched on (cargo build --features use-mock-routing
), it gives an opposite suggestion:
error: inequality checks against true can be replaced by a negation
--> safe_core/src/ipc/mod.rs:86:8
|
86 | if mock != cfg!(feature = "use-mock-routing") {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try simplifying it as shown: `!mock`
|
Version:
$ cargo clippy -V
clippy 0.0.212 (1fac380 2019-02-20)