2016-03-23 14:50:47 +01:00
|
|
|
#![feature(plugin)]
|
|
|
|
#![plugin(clippy)]
|
2016-03-24 10:45:24 +01:00
|
|
|
#![deny(nonminimal_bool, logic_bug)]
|
2016-03-23 14:50:47 +01:00
|
|
|
|
|
|
|
#[allow(unused)]
|
|
|
|
fn main() {
|
|
|
|
let a: bool = unimplemented!();
|
|
|
|
let b: bool = unimplemented!();
|
2016-03-24 10:54:48 +01:00
|
|
|
let c: bool = unimplemented!();
|
2016-03-24 10:45:24 +01:00
|
|
|
let _ = a && b || a; //~ ERROR this boolean expression contains a logic bug
|
2016-03-23 14:50:47 +01:00
|
|
|
//|~ HELP for further information visit
|
2016-03-24 10:45:24 +01:00
|
|
|
//|~ HELP this expression can be optimized out
|
|
|
|
//|~ HELP it would look like the following
|
2016-03-23 14:50:47 +01:00
|
|
|
//|~ SUGGESTION let _ = a;
|
2016-03-24 10:54:48 +01:00
|
|
|
let _ = !(a && b);
|
2016-03-23 14:50:47 +01:00
|
|
|
let _ = !true; //~ ERROR this boolean expression can be simplified
|
|
|
|
//|~ HELP for further information visit
|
|
|
|
//|~ SUGGESTION let _ = false;
|
|
|
|
let _ = !false; //~ ERROR this boolean expression can be simplified
|
|
|
|
//|~ HELP for further information visit
|
|
|
|
//|~ SUGGESTION let _ = true;
|
|
|
|
let _ = !!a; //~ ERROR this boolean expression can be simplified
|
|
|
|
//|~ HELP for further information visit
|
|
|
|
//|~ SUGGESTION let _ = a;
|
2016-03-24 09:36:46 +01:00
|
|
|
|
2016-03-24 10:45:24 +01:00
|
|
|
let _ = false && a; //~ ERROR this boolean expression contains a logic bug
|
2016-03-24 09:36:46 +01:00
|
|
|
//|~ HELP for further information visit
|
2016-03-24 10:45:24 +01:00
|
|
|
//|~ HELP this expression can be optimized out
|
|
|
|
//|~ HELP it would look like the following
|
2016-03-24 09:36:46 +01:00
|
|
|
//|~ SUGGESTION let _ = false;
|
|
|
|
|
|
|
|
let _ = false || a; //~ ERROR this boolean expression can be simplified
|
|
|
|
//|~ HELP for further information visit
|
|
|
|
//|~ SUGGESTION let _ = a;
|
2016-03-24 09:37:16 +01:00
|
|
|
|
|
|
|
// don't lint on cfgs
|
|
|
|
let _ = cfg!(you_shall_not_not_pass) && a;
|
2016-03-24 10:54:48 +01:00
|
|
|
|
|
|
|
let _ = !(a && b || c);
|
2016-03-23 14:50:47 +01:00
|
|
|
}
|