mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-28 20:16:58 +03:00
d160cb7313
Add checks for expressions such as `x != y && x >= y` and `x != y && x <= y`.
55 lines
1.1 KiB
Rust
55 lines
1.1 KiB
Rust
#![allow(clippy::needless_ifs)]
|
|
|
|
fn main() {
|
|
let x = 1;
|
|
let y = 2;
|
|
if x == y || x < y {
|
|
//~^ double_comparisons
|
|
// do something
|
|
}
|
|
if x < y || x == y {
|
|
//~^ double_comparisons
|
|
// do something
|
|
}
|
|
if x == y || x > y {
|
|
//~^ double_comparisons
|
|
// do something
|
|
}
|
|
if x > y || x == y {
|
|
//~^ double_comparisons
|
|
// do something
|
|
}
|
|
if x < y || x > y {
|
|
//~^ double_comparisons
|
|
// do something
|
|
}
|
|
if x > y || x < y {
|
|
//~^ double_comparisons
|
|
// do something
|
|
}
|
|
if x <= y && x >= y {
|
|
//~^ double_comparisons
|
|
// do something
|
|
}
|
|
if x >= y && x <= y {
|
|
//~^ double_comparisons
|
|
// do something
|
|
}
|
|
if x != y && x <= y {
|
|
//~^ double_comparisons
|
|
// do something
|
|
}
|
|
if x <= y && x != y {
|
|
//~^ double_comparisons
|
|
// do something
|
|
}
|
|
if x != y && x >= y {
|
|
//~^ double_comparisons
|
|
// do something
|
|
}
|
|
if x >= y && x != y {
|
|
//~^ double_comparisons
|
|
// do something
|
|
}
|
|
}
|