rust/tests/ui/bool_comparison.rs

76 lines
1001 B
Rust
Raw Normal View History

2018-07-28 10:34:52 -05:00
#[warn(clippy::bool_comparison)]
fn main() {
let x = true;
2018-12-09 16:26:16 -06:00
if x == true {
"yes"
} else {
"no"
};
if x == false {
"yes"
} else {
"no"
};
if true == x {
"yes"
} else {
"no"
};
if false == x {
"yes"
} else {
"no"
};
if x != true {
"yes"
} else {
"no"
};
if x != false {
"yes"
} else {
"no"
};
if true != x {
"yes"
} else {
"no"
};
if false != x {
"yes"
} else {
"no"
};
if x < true {
"yes"
} else {
"no"
};
if false < x {
"yes"
} else {
"no"
};
if x > false {
"yes"
} else {
"no"
};
if true > x {
"yes"
} else {
"no"
};
let y = true;
if x < y {
"yes"
} else {
"no"
};
if x > y {
"yes"
} else {
"no"
};
}