3 #![warn(clippy::identity_op)]
7 clippy::unnecessary_operation,
13 use std::fmt::Write as _;
16 const NEG_ONE: i64 = -1;
21 impl std::ops::Shl<i32> for A {
23 fn shl(mut self, other: i32) -> Self {
24 let _ = write!(self.0, "{}", other);
32 impl core::ops::Mul<Meter> for u8 {
34 fn mul(self, _: Meter) -> Length {
48 x - ZERO; //no error, as we skip lookups (for now)
50 ((ZERO)) | x; //no error, as we skip lookups (for now)
54 x / ONE; //no error, as we skip lookups (for now)
56 x / 2; //no false positive
58 x & NEG_ONE; //no error, as we skip lookups (for now)
64 1 << 0; // no error, this case is allowed, see issue 3430
71 let mut a = A("".into());
72 let b = a << 0; // no error: non-integer
74 1 * Meter; // no error: non-integer
81 (x + 1) % 3; // no error
88 0 + if b { 1 } else { 2 };
89 0 + if b { 1 } else { 2 } + if b { 3 } else { 4 };
90 0 + match a { 0 => 10, _ => 20 };
91 0 + match a { 0 => 10, _ => 20 } + match a { 0 => 30, _ => 40 };
92 0 + if b { 1 } else { 2 } + match a { 0 => 30, _ => 40 };
93 0 + match a { 0 => 10, _ => 20 } + if b { 3 } else { 4 };
94 (if b { 1 } else { 2 }) + 0;
98 0 + loop { let mut c = 0; if c == 10 { break c; } c += 1; } + { a * 2 };
103 f(1 * a + { 8 * 5 });
104 f(0 + if b { 1 } else { 2 } + 3);
105 const _: i32 = { 2 * 4 } + 0 + 3;
106 const _: i32 = 0 + { 1 + 2 * 3 } + 3;
109 let _ = 0 + a as usize;
117 pub fn decide(a: bool, b: bool) -> u32 {
118 0 + if a { 1 } else { 2 } + if b { 3 } else { 5 }