Closed
Description
Summary
When there are two or more range checks in &&
expressions Clippy only catches the first instance of them. Similar ||
expressions are not affected by this issue.
Lint Name
manual_range_contains
Reproducer
fn main() {
let (a, b) = (0, 0);
let _test_or = (a >= 0) && (a <= 10) || (b >= 0) && (b <= 10);
// ^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^
// (0..=10).contains(&a) (0..=10).contains(&b)
let _test_and = (a >= 0) && (a <= 10) && (b >= 0) && (b <= 10);
// ^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^
// (0..=10).contains(&a) Missing suggestion
}
Version
rustc 1.62.0-nightly (311e2683e 2022-04-18)
binary: rustc
commit-hash: 311e2683e1bad87715b1558f7900e294d24ce491
commit-date: 2022-04-18
host: x86_64-unknown-linux-gnu
release: 1.62.0-nightly
LLVM version: 14.0.1