rust-lang / rust-clippy

A bunch of lints to catch common mistakes and improve your Rust code. Book: https://doc.rust-lang.org/clippy/
https://rust-lang.github.io/rust-clippy/
Other
11.41k stars 1.54k forks source link

nonminimal_bool lint for meta items #1893

Open clarfonthey opened 7 years ago

clarfonthey commented 7 years ago

I found myself ctrl-replacing a bunch of meta items in a file and ended up with a few that said cfg(not(not(...))). This is obviously wrong and it would be nice if we linted this somehow.

We could potentially extend this from just double negatives to include other expressions which include too many nots, like any(not(A), not(B), not(C), ...) -> not(all(A, B, C)).

oli-obk commented 7 years ago

I'm not sure if we can do this. Items that are cfg'ed out are invisible to clippy