2017-09-18 10:47:33 +00:00
|
|
|
|
|
|
|
|
2017-05-17 12:19:44 +00:00
|
|
|
#![warn(nonminimal_bool, logic_bug)]
|
2016-03-23 13:50:47 +00:00
|
|
|
|
2016-03-24 14:37:17 +00:00
|
|
|
#[allow(unused, many_single_char_names)]
|
2016-03-23 13:50:47 +00:00
|
|
|
fn main() {
|
|
|
|
let a: bool = unimplemented!();
|
|
|
|
let b: bool = unimplemented!();
|
2016-03-24 09:54:48 +00:00
|
|
|
let c: bool = unimplemented!();
|
2016-03-24 14:37:17 +00:00
|
|
|
let d: bool = unimplemented!();
|
|
|
|
let e: bool = unimplemented!();
|
2017-02-08 13:58:07 +00:00
|
|
|
let _ = a && b || a;
|
2016-03-24 09:54:48 +00:00
|
|
|
let _ = !(a && b);
|
2017-02-08 13:58:07 +00:00
|
|
|
let _ = !true;
|
|
|
|
let _ = !false;
|
|
|
|
let _ = !!a;
|
|
|
|
let _ = false && a;
|
|
|
|
let _ = false || a;
|
2016-03-24 08:37:16 +00:00
|
|
|
// don't lint on cfgs
|
|
|
|
let _ = cfg!(you_shall_not_not_pass) && a;
|
2016-03-24 14:37:17 +00:00
|
|
|
let _ = a || !b || !c || !d || !e;
|
2016-03-24 09:54:48 +00:00
|
|
|
let _ = !(a && b || c);
|
2017-02-08 13:58:07 +00:00
|
|
|
let _ = !(!a && b);
|
2016-03-23 13:50:47 +00:00
|
|
|
}
|
2016-03-24 14:44:08 +00:00
|
|
|
|
|
|
|
#[allow(unused, many_single_char_names)]
|
|
|
|
fn equality_stuff() {
|
|
|
|
let a: i32 = unimplemented!();
|
|
|
|
let b: i32 = unimplemented!();
|
|
|
|
let c: i32 = unimplemented!();
|
|
|
|
let d: i32 = unimplemented!();
|
|
|
|
let e: i32 = unimplemented!();
|
2016-06-07 16:32:26 +00:00
|
|
|
let _ = a == b && a != b;
|
|
|
|
let _ = a == b && c == 5 && a == b;
|
|
|
|
let _ = a == b && c == 5 && b == a;
|
|
|
|
let _ = a < b && a >= b;
|
|
|
|
let _ = a > b && a <= b;
|
2016-03-24 14:44:08 +00:00
|
|
|
let _ = a > b && a == b;
|
2016-06-07 16:32:26 +00:00
|
|
|
let _ = a != b || !(a != b || c == d);
|
2016-03-24 14:44:08 +00:00
|
|
|
}
|
2017-11-07 21:43:24 +00:00
|
|
|
|
|
|
|
#[allow(unused, many_single_char_names)]
|
|
|
|
fn methods_with_negation() {
|
|
|
|
let a: Option<i32> = unimplemented!();
|
|
|
|
let b: Result<i32, i32> = unimplemented!();
|
|
|
|
let _ = a.is_some();
|
|
|
|
let _ = !a.is_some();
|
|
|
|
let _ = a.is_none();
|
|
|
|
let _ = !a.is_none();
|
|
|
|
let _ = b.is_err();
|
|
|
|
let _ = !b.is_err();
|
|
|
|
let _ = b.is_ok();
|
|
|
|
let _ = !b.is_ok();
|
2017-11-14 16:07:04 +00:00
|
|
|
let c = false;
|
|
|
|
let _ = !(a.is_some() && !c);
|
2017-11-07 21:43:24 +00:00
|
|
|
}
|