#[rustfmt::skip]
#[warn(clippy::eq_op)]
-#[allow(clippy::identity_op, clippy::double_parens, clippy::many_single_char_names)]
+#[allow(clippy::identity_op, clippy::double_parens)]
#[allow(clippy::no_effect, unused_variables, clippy::unnecessary_operation, clippy::short_circuit_statement)]
#[allow(clippy::nonminimal_bool)]
#[allow(unused)]
+#[allow(clippy::unnecessary_cast)]
fn main() {
// simple values and comparisons
1 == 1;
const B: u32 = 10;
const C: u32 = A / B; // ok, different named constants
const D: u32 = A / A;
-
- check_assert_identical_args();
}
#[rustfmt::skip]
!bool_macro!(1) && !bool_macro!("");
}
-macro_rules! assert_in_macro_def {
- () => {
- let a = 42;
- assert_eq!(a, a);
- assert_ne!(a, a);
- debug_assert_eq!(a, a);
- debug_assert_ne!(a, a);
- };
+struct Nested {
+ inner: ((i32,), (i32,), (i32,)),
}
-// lint identical args in assert-like macro invocations (see #3574)
-fn check_assert_identical_args() {
- // lint also in macro definition
- assert_in_macro_def!();
-
- let a = 1;
- let b = 2;
-
- // lint identical args in `assert_eq!`
- assert_eq!(a, a);
- assert_eq!(a + 1, a + 1);
- // ok
- assert_eq!(a, b);
- assert_eq!(a, a + 1);
- assert_eq!(a + 1, b + 1);
-
- // lint identical args in `assert_ne!`
- assert_ne!(a, a);
- assert_ne!(a + 1, a + 1);
- // ok
- assert_ne!(a, b);
- assert_ne!(a, a + 1);
- assert_ne!(a + 1, b + 1);
-
- // lint identical args in `debug_assert_eq!`
- debug_assert_eq!(a, a);
- debug_assert_eq!(a + 1, a + 1);
- // ok
- debug_assert_eq!(a, b);
- debug_assert_eq!(a, a + 1);
- debug_assert_eq!(a + 1, b + 1);
-
- // lint identical args in `debug_assert_ne!`
- debug_assert_ne!(a, a);
- debug_assert_ne!(a + 1, a + 1);
- // ok
- debug_assert_ne!(a, b);
- debug_assert_ne!(a, a + 1);
- debug_assert_ne!(a + 1, b + 1);
-
- let my_vec = vec![1; 5];
- let mut my_iter = my_vec.iter();
- assert_ne!(my_iter.next(), my_iter.next());
+fn check_nested(n1: &Nested, n2: &Nested) -> bool {
+ // `n2.inner.0.0` mistyped as `n1.inner.0.0`
+ (n1.inner.0).0 == (n1.inner.0).0 && (n1.inner.1).0 == (n2.inner.1).0 && (n1.inner.2).0 == (n2.inner.2).0
}