3 #[warn(clippy::manual_range_contains)]
5 #[allow(clippy::no_effect)]
6 #[allow(clippy::short_circuit_statement)]
7 #[allow(clippy::unnecessary_operation)]
11 // order shouldn't matter
13 (21..42).contains(&x);
14 (1..100).contains(&x);
16 // also with inclusive ranges
17 (9..=99).contains(&x);
18 (1..=33).contains(&x);
19 (1..=999).contains(&x);
22 !(8..12).contains(&x);
23 !(21..42).contains(&x);
24 !(1..100).contains(&x);
26 // also with the outside of inclusive ranges
27 !(9..=99).contains(&x);
28 !(1..=33).contains(&x);
29 !(1..=999).contains(&x);
31 // not a range.contains
32 x > 8 && x < 12; // lower bound not inclusive
33 x < 8 && x <= 12; // same direction
34 x >= 12 && 12 >= x; // same bounds
35 x < 8 && x > 12; // wrong direction
44 (0. ..1.).contains(&y);
45 !(0. ..=1.).contains(&y);
49 pub const fn in_range(a: i32) -> bool {