3 #![feature(custom_inner_attributes)]
4 #![warn(clippy::manual_range_contains)]
6 #![allow(clippy::no_effect)]
7 #![allow(clippy::short_circuit_statement)]
8 #![allow(clippy::unnecessary_operation)]
13 // order shouldn't matter
18 // also with inclusive ranges
28 // also with the outside of inclusive ranges
33 // not a range.contains
34 x > 8 && x < 12; // lower bound not inclusive
35 x < 8 && x <= 12; // same direction
36 x >= 12 && 12 >= x; // same bounds
37 x < 8 && x > 12; // wrong direction
49 // handle negatives #8721
57 (x >= 0) && (x <= 10) && (z >= 0) && (z <= 10);
58 (x < 0) || (x >= 10) || (z < 0) || (z >= 10);
59 // Make sure operators in parens don't give a breaking suggestion
60 ((x % 2 == 0) || (x < 0)) || (x >= 10);
64 pub const fn in_range(a: i32) -> bool {
69 #![clippy::msrv = "1.34"]
76 #![clippy::msrv = "1.35"]