1 use std::fmt::Write as _;
4 const NEG_ONE: i64 = -1;
9 impl std::ops::Shl<i32> for A {
11 fn shl(mut self, other: i32) -> Self {
12 let _ = write!(self.0, "{}", other);
20 impl core::ops::Mul<Meter> for u8 {
22 fn mul(self, _: Meter) -> Length {
30 clippy::unnecessary_operation,
34 #[warn(clippy::identity_op)]
44 x - ZERO; //no error, as we skip lookups (for now)
46 ((ZERO)) | x; //no error, as we skip lookups (for now)
50 x / ONE; //no error, as we skip lookups (for now)
52 x / 2; //no false positive
54 x & NEG_ONE; //no error, as we skip lookups (for now)
60 1 << 0; // no error, this case is allowed, see issue 3430
67 let mut a = A("".into());
68 let b = a << 0; // no error: non-integer
70 1 * Meter; // no error: non-integer
77 (x + 1) % 3; // no error
84 0 + if b { 1 } else { 2 };
85 0 + if b { 1 } else { 2 } + if b { 3 } else { 4 }; // no error
86 0 + match a { 0 => 10, _ => 20 };
87 0 + match a { 0 => 10, _ => 20 } + match a { 0 => 30, _ => 40 }; // no error
88 0 + if b { 1 } else { 2 } + match a { 0 => 30, _ => 40 }; // no error
89 0 + match a { 0 => 10, _ => 20 } + if b { 3 } else { 4 }; // no error
91 0 + if b { 0 + 1 } else { 2 };
92 0 + match a { 0 => 0 + 10, _ => 20 };
93 0 + if b { 0 + 1 } else { 2 } + match a { 0 => 0 + 30, _ => 40 };
95 let _ = 0 + if 0 + 1 > 0 { 1 } else { 2 } + if 0 + 1 > 0 { 3 } else { 4 };
96 let _ = 0 + match 0 + 1 { 0 => 10, _ => 20 } + match 0 + 1 { 0 => 30, _ => 40 };
98 0 + if b { 1 } else { 2 } + if b { 3 } else { 4 } + 0;
100 0 + { a } + 3; // no error
101 0 + loop { let mut c = 0; if c == 10 { break c; } c += 1; } + { a * 2 }; // no error
106 f(1 * a + { 8 * 5 });
107 f(0 + if b { 1 } else { 2 } + 3); // no error
108 const _: i32 = { 2 * 4 } + 0 + 3;
109 const _: i32 = 0 + { 1 + 2 * 3 } + 3; // no error