1 // does not test any rustfixable lints
5 #[allow(clippy::identity_op, clippy::double_parens, clippy::many_single_char_names)]
6 #[allow(clippy::no_effect, unused_variables, clippy::unnecessary_operation, clippy::short_circuit_statement)]
7 #[allow(clippy::nonminimal_bool)]
9 #[allow(clippy::unnecessary_cast)]
11 // simple values and comparisons
14 // even though I agree that no means no ;-)
19 // casts, methods, parentheses
20 (1 as u64) & (1 as u64);
23 // unary and binary operators
25 ((1 + 1) & (1 + 1) == (1 + 1) & (1 + 1));
26 (1 * 2) + (3 * 4) == 1 * 2 + 3 * 4;
28 // various other things
31 vec![1, 2, 3] == vec![1, 2, 3]; //no error yet, as we don't match macros
54 2*a.len() == 2*a.len(); // ok, functions
55 a.pop() == a.pop(); // ok, functions
62 const C: u32 = A / B; // ok, different named constants
67 macro_rules! check_if_named_foo {
68 ($expression:expr) => (
69 if stringify!($expression) == "foo" {
77 macro_rules! bool_macro {
78 ($expression:expr) => {
83 #[allow(clippy::short_circuit_statement)]
84 fn check_ignore_macro() {
85 check_if_named_foo!(foo);
86 // checks if the lint ignores macros with `!` operator
87 !bool_macro!(1) && !bool_macro!("");
91 inner: ((i32,), (i32,), (i32,)),
94 fn check_nested(n1: &Nested, n2: &Nested) -> bool {
95 // `n2.inner.0.0` mistyped as `n1.inner.0.0`
96 (n1.inner.0).0 == (n1.inner.0).0 && (n1.inner.1).0 == (n2.inner.1).0 && (n1.inner.2).0 == (n2.inner.2).0