2016-02-09 20:10:22 +01:00
|
|
|
#![feature(plugin)]
|
|
|
|
#![plugin(clippy)]
|
|
|
|
|
|
|
|
#[deny(bool_comparison)]
|
|
|
|
fn main() {
|
|
|
|
let x = true;
|
2016-02-09 20:44:42 +01:00
|
|
|
if x == true { "yes" } else { "no" };
|
2016-03-19 15:06:56 +01:00
|
|
|
//~^ ERROR equality checks against true are unnecessary
|
2016-02-09 21:44:07 +01:00
|
|
|
//~| HELP try simplifying it as shown:
|
|
|
|
//~| SUGGESTION if x { "yes" } else { "no" };
|
2016-02-09 20:44:42 +01:00
|
|
|
if x == false { "yes" } else { "no" };
|
2016-02-09 21:44:07 +01:00
|
|
|
//~^ ERROR equality checks against false can be replaced by a negation
|
|
|
|
//~| HELP try simplifying it as shown:
|
|
|
|
//~| SUGGESTION if !x { "yes" } else { "no" };
|
2016-02-09 20:44:42 +01:00
|
|
|
if true == x { "yes" } else { "no" };
|
2016-03-19 15:06:56 +01:00
|
|
|
//~^ ERROR equality checks against true are unnecessary
|
2016-02-09 21:44:07 +01:00
|
|
|
//~| HELP try simplifying it as shown:
|
|
|
|
//~| SUGGESTION if x { "yes" } else { "no" };
|
2016-02-09 20:44:42 +01:00
|
|
|
if false == x { "yes" } else { "no" };
|
2016-02-09 21:44:07 +01:00
|
|
|
//~^ ERROR equality checks against false can be replaced by a negation
|
|
|
|
//~| HELP try simplifying it as shown:
|
|
|
|
//~| SUGGESTION if !x { "yes" } else { "no" };
|
2016-02-09 20:10:22 +01:00
|
|
|
}
|