2015-05-02 00:35:49 +02:00
|
|
|
#![feature(plugin)]
|
|
|
|
#![plugin(clippy)]
|
|
|
|
|
|
|
|
#[deny(needless_bool)]
|
|
|
|
fn main() {
|
2015-08-11 20:22:20 +02:00
|
|
|
let x = true;
|
2015-08-13 08:12:07 +02:00
|
|
|
if x { true } else { true }; //~ERROR your if-then-else expression will always return true
|
|
|
|
if x { false } else { false }; //~ERROR your if-then-else expression will always return false
|
|
|
|
if x { true } else { false }; //~ERROR you can reduce your if statement to its predicate
|
|
|
|
if x { false } else { true }; //~ERROR you can reduce your if statement to `!` + its predicate
|
2015-08-11 20:22:20 +02:00
|
|
|
if x { x } else { false }; // would also be questionable, but we don't catch this yet
|
2015-05-02 00:35:49 +02:00
|
|
|
}
|