rust/tests/compile-fail/booleans.rs

25 lines
922 B
Rust
Raw Normal View History

2016-03-23 14:50:47 +01:00
#![feature(plugin)]
#![plugin(clippy)]
#![deny(nonminimal_bool)]
#[allow(unused)]
fn main() {
let a: bool = unimplemented!();
let b: bool = unimplemented!();
let _ = a && b || a; //~ ERROR this boolean expression can be simplified
//|~ HELP for further information visit
//|~ SUGGESTION let _ = a;
let _ = !(a && b); //~ ERROR this boolean expression can be simplified
//|~ HELP for further information visit
//|~ SUGGESTION let _ = !b || !a;
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;
}