diff --git a/clippy_tests/examples/assign_ops.stderr b/clippy_tests/examples/assign_ops.stderr index dd36c5cad..fd88ca612 100644 --- a/clippy_tests/examples/assign_ops.stderr +++ b/clippy_tests/examples/assign_ops.stderr @@ -2,7 +2,7 @@ error: assign operation detected --> assign_ops.rs:8:5 | 8 | i += 2; - | ^^^^^^ help: replace it with `i = i + 2` + | ^^^^^^ help: replace it with: `i = i + 2` | = note: `-D assign-ops` implied by `-D warnings` @@ -10,79 +10,79 @@ error: assign operation detected --> assign_ops.rs:9:5 | 9 | i += 2 + 17; - | ^^^^^^^^^^^ help: replace it with `i = i + 2 + 17` + | ^^^^^^^^^^^ help: replace it with: `i = i + 2 + 17` error: assign operation detected --> assign_ops.rs:10:5 | 10 | i -= 6; - | ^^^^^^ help: replace it with `i = i - 6` + | ^^^^^^ help: replace it with: `i = i - 6` error: assign operation detected --> assign_ops.rs:11:5 | 11 | i -= 2 - 1; - | ^^^^^^^^^^ help: replace it with `i = i - (2 - 1)` + | ^^^^^^^^^^ help: replace it with: `i = i - (2 - 1)` error: assign operation detected --> assign_ops.rs:12:5 | 12 | i *= 5; - | ^^^^^^ help: replace it with `i = i * 5` + | ^^^^^^ help: replace it with: `i = i * 5` error: assign operation detected --> assign_ops.rs:13:5 | 13 | i *= 1+5; - | ^^^^^^^^ help: replace it with `i = i * (1+5)` + | ^^^^^^^^ help: replace it with: `i = i * (1+5)` error: assign operation detected --> assign_ops.rs:14:5 | 14 | i /= 32; - | ^^^^^^^ help: replace it with `i = i / 32` + | ^^^^^^^ help: replace it with: `i = i / 32` error: assign operation detected --> assign_ops.rs:15:5 | 15 | i /= 32 | 5; - | ^^^^^^^^^^^ help: replace it with `i = i / (32 | 5)` + | ^^^^^^^^^^^ help: replace it with: `i = i / (32 | 5)` error: assign operation detected --> assign_ops.rs:16:5 | 16 | i /= 32 / 5; - | ^^^^^^^^^^^ help: replace it with `i = i / (32 / 5)` + | ^^^^^^^^^^^ help: replace it with: `i = i / (32 / 5)` error: assign operation detected --> assign_ops.rs:17:5 | 17 | i %= 42; - | ^^^^^^^ help: replace it with `i = i % 42` + | ^^^^^^^ help: replace it with: `i = i % 42` error: assign operation detected --> assign_ops.rs:18:5 | 18 | i >>= i; - | ^^^^^^^ help: replace it with `i = i >> i` + | ^^^^^^^ help: replace it with: `i = i >> i` error: assign operation detected --> assign_ops.rs:19:5 | 19 | i <<= 9 + 6 - 7; - | ^^^^^^^^^^^^^^^ help: replace it with `i = i << (9 + 6 - 7)` + | ^^^^^^^^^^^^^^^ help: replace it with: `i = i << (9 + 6 - 7)` error: assign operation detected --> assign_ops.rs:20:5 | 20 | i += 1 << 5; - | ^^^^^^^^^^^ help: replace it with `i = i + (1 << 5)` + | ^^^^^^^^^^^ help: replace it with: `i = i + (1 << 5)` error: manual implementation of an assign operation --> assign_ops.rs:27:5 | 27 | a = a + 1; - | ^^^^^^^^^ help: replace it with `a += 1` + | ^^^^^^^^^ help: replace it with: `a += 1` | = note: `-D assign-op-pattern` implied by `-D warnings` @@ -90,49 +90,49 @@ error: manual implementation of an assign operation --> assign_ops.rs:28:5 | 28 | a = 1 + a; - | ^^^^^^^^^ help: replace it with `a += 1` + | ^^^^^^^^^ help: replace it with: `a += 1` error: manual implementation of an assign operation --> assign_ops.rs:29:5 | 29 | a = a - 1; - | ^^^^^^^^^ help: replace it with `a -= 1` + | ^^^^^^^^^ help: replace it with: `a -= 1` error: manual implementation of an assign operation --> assign_ops.rs:30:5 | 30 | a = a * 99; - | ^^^^^^^^^^ help: replace it with `a *= 99` + | ^^^^^^^^^^ help: replace it with: `a *= 99` error: manual implementation of an assign operation --> assign_ops.rs:31:5 | 31 | a = 42 * a; - | ^^^^^^^^^^ help: replace it with `a *= 42` + | ^^^^^^^^^^ help: replace it with: `a *= 42` error: manual implementation of an assign operation --> assign_ops.rs:32:5 | 32 | a = a / 2; - | ^^^^^^^^^ help: replace it with `a /= 2` + | ^^^^^^^^^ help: replace it with: `a /= 2` error: manual implementation of an assign operation --> assign_ops.rs:33:5 | 33 | a = a % 5; - | ^^^^^^^^^ help: replace it with `a %= 5` + | ^^^^^^^^^ help: replace it with: `a %= 5` error: manual implementation of an assign operation --> assign_ops.rs:34:5 | 34 | a = a & 1; - | ^^^^^^^^^ help: replace it with `a &= 1` + | ^^^^^^^^^ help: replace it with: `a &= 1` error: manual implementation of an assign operation --> assign_ops.rs:40:5 | 40 | s = s + "bla"; - | ^^^^^^^^^^^^^ help: replace it with `s += "bla"` + | ^^^^^^^^^^^^^ help: replace it with: `s += "bla"` error: aborting due to 22 previous errors diff --git a/clippy_tests/examples/assign_ops2.stderr b/clippy_tests/examples/assign_ops2.stderr index 049e2ab7b..2f7642100 100644 --- a/clippy_tests/examples/assign_ops2.stderr +++ b/clippy_tests/examples/assign_ops2.stderr @@ -2,7 +2,7 @@ error: variable appears on both sides of an assignment operation --> assign_ops2.rs:8:5 | 8 | a += a + 1; - | ^^^^^^^^^^ help: replace it with `a += 1` + | ^^^^^^^^^^ help: replace it with: `a += 1` | = note: `-D misrefactored-assign-op` implied by `-D warnings` @@ -10,43 +10,43 @@ error: variable appears on both sides of an assignment operation --> assign_ops2.rs:9:5 | 9 | a += 1 + a; - | ^^^^^^^^^^ help: replace it with `a += 1` + | ^^^^^^^^^^ help: replace it with: `a += 1` error: variable appears on both sides of an assignment operation --> assign_ops2.rs:10:5 | 10 | a -= a - 1; - | ^^^^^^^^^^ help: replace it with `a -= 1` + | ^^^^^^^^^^ help: replace it with: `a -= 1` error: variable appears on both sides of an assignment operation --> assign_ops2.rs:11:5 | 11 | a *= a * 99; - | ^^^^^^^^^^^ help: replace it with `a *= 99` + | ^^^^^^^^^^^ help: replace it with: `a *= 99` error: variable appears on both sides of an assignment operation --> assign_ops2.rs:12:5 | 12 | a *= 42 * a; - | ^^^^^^^^^^^ help: replace it with `a *= 42` + | ^^^^^^^^^^^ help: replace it with: `a *= 42` error: variable appears on both sides of an assignment operation --> assign_ops2.rs:13:5 | 13 | a /= a / 2; - | ^^^^^^^^^^ help: replace it with `a /= 2` + | ^^^^^^^^^^ help: replace it with: `a /= 2` error: variable appears on both sides of an assignment operation --> assign_ops2.rs:14:5 | 14 | a %= a % 5; - | ^^^^^^^^^^ help: replace it with `a %= 5` + | ^^^^^^^^^^ help: replace it with: `a %= 5` error: variable appears on both sides of an assignment operation --> assign_ops2.rs:15:5 | 15 | a &= a & 1; - | ^^^^^^^^^^ help: replace it with `a &= 1` + | ^^^^^^^^^^ help: replace it with: `a &= 1` error: aborting due to 8 previous errors diff --git a/clippy_tests/examples/block_in_if_condition.stderr b/clippy_tests/examples/block_in_if_condition.stderr index 77f36ce22..c7f403ac5 100644 --- a/clippy_tests/examples/block_in_if_condition.stderr +++ b/clippy_tests/examples/block_in_if_condition.stderr @@ -46,7 +46,7 @@ error: this boolean expression can be simplified --> block_in_if_condition.rs:67:8 | 67 | if true && x == 3 { - | ^^^^^^^^^^^^^^ help: try `x == 3` + | ^^^^^^^^^^^^^^ help: try: `x == 3` | = note: `-D nonminimal-bool` implied by `-D warnings` diff --git a/clippy_tests/examples/bool_comparison.stderr b/clippy_tests/examples/bool_comparison.stderr index 02b80cb96..b62f2e0c4 100644 --- a/clippy_tests/examples/bool_comparison.stderr +++ b/clippy_tests/examples/bool_comparison.stderr @@ -2,7 +2,7 @@ error: equality checks against true are unnecessary --> bool_comparison.rs:7:8 | 7 | if x == true { "yes" } else { "no" }; - | ^^^^^^^^^ help: try simplifying it as shown: `x` + | ^^^^^^^^^ help: try simplifying it as shown:: `x` | = note: `-D bool-comparison` implied by `-D warnings` @@ -10,19 +10,19 @@ error: equality checks against false can be replaced by a negation --> bool_comparison.rs:8:8 | 8 | if x == false { "yes" } else { "no" }; - | ^^^^^^^^^^ help: try simplifying it as shown: `!x` + | ^^^^^^^^^^ help: try simplifying it as shown:: `!x` error: equality checks against true are unnecessary --> bool_comparison.rs:9:8 | 9 | if true == x { "yes" } else { "no" }; - | ^^^^^^^^^ help: try simplifying it as shown: `x` + | ^^^^^^^^^ help: try simplifying it as shown:: `x` error: equality checks against false can be replaced by a negation --> bool_comparison.rs:10:8 | 10 | if false == x { "yes" } else { "no" }; - | ^^^^^^^^^^ help: try simplifying it as shown: `!x` + | ^^^^^^^^^^ help: try simplifying it as shown:: `!x` error: aborting due to 4 previous errors diff --git a/clippy_tests/examples/booleans.stderr b/clippy_tests/examples/booleans.stderr index 03fa72646..85cc80052 100644 --- a/clippy_tests/examples/booleans.stderr +++ b/clippy_tests/examples/booleans.stderr @@ -2,7 +2,7 @@ error: this boolean expression contains a logic bug --> booleans.rs:12:13 | 12 | let _ = a && b || a; - | ^^^^^^^^^^^ help: it would look like the following `a` + | ^^^^^^^^^^^ help: it would look like the following: `a` | = note: `-D logic-bug` implied by `-D warnings` help: this expression can be optimized out by applying boolean operations to the outer expression @@ -15,7 +15,7 @@ error: this boolean expression can be simplified --> booleans.rs:14:13 | 14 | let _ = !true; - | ^^^^^ help: try `false` + | ^^^^^ help: try: `false` | = note: `-D nonminimal-bool` implied by `-D warnings` @@ -23,19 +23,19 @@ error: this boolean expression can be simplified --> booleans.rs:15:13 | 15 | let _ = !false; - | ^^^^^^ help: try `true` + | ^^^^^^ help: try: `true` error: this boolean expression can be simplified --> booleans.rs:16:13 | 16 | let _ = !!a; - | ^^^ help: try `a` + | ^^^ help: try: `a` error: this boolean expression contains a logic bug --> booleans.rs:17:13 | 17 | let _ = false && a; - | ^^^^^^^^^^ help: it would look like the following `false` + | ^^^^^^^^^^ help: it would look like the following: `false` | help: this expression can be optimized out by applying boolean operations to the outer expression --> booleans.rs:17:22 @@ -47,19 +47,31 @@ error: this boolean expression can be simplified --> booleans.rs:18:13 | 18 | let _ = false || a; - | ^^^^^^^^^^ help: try `a` + | ^^^^^^^^^^ help: try: `a` + +error: this boolean expression contains a logic bug + --> booleans.rs:20:13 + | +20 | let _ = cfg!(you_shall_not_not_pass) && a; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: it would look like the following: `false` + | +help: this expression can be optimized out by applying boolean operations to the outer expression + --> booleans.rs:20:45 + | +20 | let _ = cfg!(you_shall_not_not_pass) && a; + | ^ error: this boolean expression can be simplified --> booleans.rs:23:13 | 23 | let _ = !(!a && b); - | ^^^^^^^^^^ help: try `!b || a` + | ^^^^^^^^^^ help: try: `!b || a` error: this boolean expression contains a logic bug --> booleans.rs:33:13 | 33 | let _ = a == b && a != b; - | ^^^^^^^^^^^^^^^^ help: it would look like the following `false` + | ^^^^^^^^^^^^^^^^ help: it would look like the following: `false` | help: this expression can be optimized out by applying boolean operations to the outer expression --> booleans.rs:33:13 @@ -97,7 +109,7 @@ error: this boolean expression contains a logic bug --> booleans.rs:36:13 | 36 | let _ = a < b && a >= b; - | ^^^^^^^^^^^^^^^ help: it would look like the following `false` + | ^^^^^^^^^^^^^^^ help: it would look like the following: `false` | help: this expression can be optimized out by applying boolean operations to the outer expression --> booleans.rs:36:13 @@ -109,7 +121,7 @@ error: this boolean expression contains a logic bug --> booleans.rs:37:13 | 37 | let _ = a > b && a <= b; - | ^^^^^^^^^^^^^^^ help: it would look like the following `false` + | ^^^^^^^^^^^^^^^ help: it would look like the following: `false` | help: this expression can be optimized out by applying boolean operations to the outer expression --> booleans.rs:37:13 @@ -130,7 +142,7 @@ help: try 39 | let _ = !(a == b && c == d); | ^^^^^^^^^^^^^^^^^^^ -error: aborting due to 13 previous errors +error: aborting due to 14 previous errors To learn more, run the command again with --verbose. diff --git a/clippy_tests/examples/borrow_box.stderr b/clippy_tests/examples/borrow_box.stderr index 90ab28afc..e494bdd21 100644 --- a/clippy_tests/examples/borrow_box.stderr +++ b/clippy_tests/examples/borrow_box.stderr @@ -2,7 +2,7 @@ error: you seem to be trying to use `&Box`. Consider using just `&T` --> borrow_box.rs:9:19 | 9 | pub fn test1(foo: &mut Box) { - | ^^^^^^^^^^^^^^ help: try `&mut bool` + | ^^^^^^^^^^^^^^ help: try: `&mut bool` | note: lint level defined here --> borrow_box.rs:4:9 @@ -14,19 +14,19 @@ error: you seem to be trying to use `&Box`. Consider using just `&T` --> borrow_box.rs:14:14 | 14 | let foo: &Box; - | ^^^^^^^^^^ help: try `&bool` + | ^^^^^^^^^^ help: try: `&bool` error: you seem to be trying to use `&Box`. Consider using just `&T` --> borrow_box.rs:18:10 | 18 | foo: &'a Box - | ^^^^^^^^^^^^^ help: try `&'a bool` + | ^^^^^^^^^^^^^ help: try: `&'a bool` error: you seem to be trying to use `&Box`. Consider using just `&T` --> borrow_box.rs:22:17 | 22 | fn test4(a: &Box); - | ^^^^^^^^^^ help: try `&bool` + | ^^^^^^^^^^ help: try: `&bool` error: aborting due to 4 previous errors diff --git a/clippy_tests/examples/cmp_owned.stderr b/clippy_tests/examples/cmp_owned.stderr index bf7e64291..067f1e68c 100644 --- a/clippy_tests/examples/cmp_owned.stderr +++ b/clippy_tests/examples/cmp_owned.stderr @@ -2,7 +2,7 @@ error: this creates an owned instance just for comparison --> cmp_owned.rs:8:14 | 8 | x != "foo".to_string(); - | ^^^^^^^^^^^^^^^^^ help: try `"foo"` + | ^^^^^^^^^^^^^^^^^ help: try: `"foo"` | = note: `-D cmp-owned` implied by `-D warnings` @@ -10,25 +10,25 @@ error: this creates an owned instance just for comparison --> cmp_owned.rs:10:9 | 10 | "foo".to_string() != x; - | ^^^^^^^^^^^^^^^^^ help: try `"foo"` + | ^^^^^^^^^^^^^^^^^ help: try: `"foo"` error: this creates an owned instance just for comparison --> cmp_owned.rs:17:10 | 17 | x != "foo".to_owned(); - | ^^^^^^^^^^^^^^^^ help: try `"foo"` + | ^^^^^^^^^^^^^^^^ help: try: `"foo"` error: this creates an owned instance just for comparison --> cmp_owned.rs:19:10 | 19 | x != String::from("foo"); - | ^^^^^^^^^^^^^^^^^^^ help: try `"foo"` + | ^^^^^^^^^^^^^^^^^^^ help: try: `"foo"` error: this creates an owned instance just for comparison --> cmp_owned.rs:23:5 | 23 | Foo.to_owned() == Foo; - | ^^^^^^^^^^^^^^ help: try `Foo` + | ^^^^^^^^^^^^^^ help: try: `Foo` error: this creates an owned instance just for comparison --> cmp_owned.rs:30:9 diff --git a/clippy_tests/examples/entry.stderr b/clippy_tests/examples/entry.stderr index de5c22e41..dd29d5e14 100644 --- a/clippy_tests/examples/entry.stderr +++ b/clippy_tests/examples/entry.stderr @@ -2,7 +2,7 @@ error: usage of `contains_key` followed by `insert` on a `HashMap` --> entry.rs:13:5 | 13 | if !m.contains_key(&k) { m.insert(k, v); } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `m.entry(k).or_insert(v)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `m.entry(k).or_insert(v)` | = note: `-D map-entry` implied by `-D warnings` @@ -10,37 +10,37 @@ error: usage of `contains_key` followed by `insert` on a `HashMap` --> entry.rs:17:5 | 17 | if !m.contains_key(&k) { foo(); m.insert(k, v); } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `m.entry(k)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `m.entry(k)` error: usage of `contains_key` followed by `insert` on a `HashMap` --> entry.rs:21:5 | 21 | if !m.contains_key(&k) { m.insert(k, v) } else { None }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `m.entry(k)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `m.entry(k)` error: usage of `contains_key` followed by `insert` on a `HashMap` --> entry.rs:25:5 | 25 | if m.contains_key(&k) { None } else { m.insert(k, v) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `m.entry(k)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `m.entry(k)` error: usage of `contains_key` followed by `insert` on a `HashMap` --> entry.rs:29:5 | 29 | if !m.contains_key(&k) { foo(); m.insert(k, v) } else { None }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `m.entry(k)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `m.entry(k)` error: usage of `contains_key` followed by `insert` on a `HashMap` --> entry.rs:33:5 | 33 | if m.contains_key(&k) { None } else { foo(); m.insert(k, v) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `m.entry(k)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `m.entry(k)` error: usage of `contains_key` followed by `insert` on a `BTreeMap` --> entry.rs:37:5 | 37 | if !m.contains_key(&k) { foo(); m.insert(k, v) } else { None }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `m.entry(k)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `m.entry(k)` error: aborting due to 7 previous errors diff --git a/clippy_tests/examples/eq_op.stderr b/clippy_tests/examples/eq_op.stderr index 530dfac79..87e0e8858 100644 --- a/clippy_tests/examples/eq_op.stderr +++ b/clippy_tests/examples/eq_op.stderr @@ -2,7 +2,7 @@ error: this boolean expression can be simplified --> eq_op.rs:37:5 | 37 | true && true; - | ^^^^^^^^^^^^ help: try `true` + | ^^^^^^^^^^^^ help: try: `true` | = note: `-D nonminimal-bool` implied by `-D warnings` @@ -10,31 +10,31 @@ error: this boolean expression can be simplified --> eq_op.rs:39:5 | 39 | true || true; - | ^^^^^^^^^^^^ help: try `true` + | ^^^^^^^^^^^^ help: try: `true` error: this boolean expression can be simplified --> eq_op.rs:45:5 | 45 | a == b && b == a; - | ^^^^^^^^^^^^^^^^ help: try `a == b` + | ^^^^^^^^^^^^^^^^ help: try: `a == b` error: this boolean expression can be simplified --> eq_op.rs:46:5 | 46 | a != b && b != a; - | ^^^^^^^^^^^^^^^^ help: try `a != b` + | ^^^^^^^^^^^^^^^^ help: try: `a != b` error: this boolean expression can be simplified --> eq_op.rs:47:5 | 47 | a < b && b > a; - | ^^^^^^^^^^^^^^ help: try `a < b` + | ^^^^^^^^^^^^^^ help: try: `a < b` error: this boolean expression can be simplified --> eq_op.rs:48:5 | 48 | a <= b && b >= a; - | ^^^^^^^^^^^^^^^^ help: try `a <= b` + | ^^^^^^^^^^^^^^^^ help: try: `a <= b` error: equal expressions as operands to `==` --> eq_op.rs:10:5 @@ -200,7 +200,7 @@ error: taken reference of right operand 89 | let z = x & &y; | ^^^^-- | | - | help: use the right value directly `y` + | help: use the right value directly: `y` | = note: `-D op-ref` implied by `-D warnings` diff --git a/clippy_tests/examples/eta.stderr b/clippy_tests/examples/eta.stderr index e6600be33..f23f98f2b 100644 --- a/clippy_tests/examples/eta.stderr +++ b/clippy_tests/examples/eta.stderr @@ -2,7 +2,7 @@ error: redundant closure found --> eta.rs:7:27 | 7 | let a = Some(1u8).map(|a| foo(a)); - | ^^^^^^^^^^ help: remove closure as shown: `foo` + | ^^^^^^^^^^ help: remove closure as shown:: `foo` | = note: `-D redundant-closure` implied by `-D warnings` @@ -10,13 +10,13 @@ error: redundant closure found --> eta.rs:8:10 | 8 | meta(|a| foo(a)); - | ^^^^^^^^^^ help: remove closure as shown: `foo` + | ^^^^^^^^^^ help: remove closure as shown:: `foo` error: redundant closure found --> eta.rs:9:27 | 9 | let c = Some(1u8).map(|a| {1+2; foo}(a)); - | ^^^^^^^^^^^^^^^^^ help: remove closure as shown: `{1+2; foo}` + | ^^^^^^^^^^^^^^^^^ help: remove closure as shown:: `{1+2; foo}` error: this expression borrows a reference that is immediately dereferenced by the compiler --> eta.rs:11:21 @@ -30,7 +30,7 @@ error: redundant closure found --> eta.rs:18:27 | 18 | let e = Some(1u8).map(|a| generic(a)); - | ^^^^^^^^^^^^^^ help: remove closure as shown: `generic` + | ^^^^^^^^^^^^^^ help: remove closure as shown:: `generic` error: aborting due to 5 previous errors diff --git a/clippy_tests/examples/float_cmp.stderr b/clippy_tests/examples/float_cmp.stderr index d0de1486e..476c94c8a 100644 --- a/clippy_tests/examples/float_cmp.stderr +++ b/clippy_tests/examples/float_cmp.stderr @@ -2,7 +2,7 @@ error: strict comparison of f32 or f64 --> float_cmp.rs:43:5 | 43 | ONE == 1f32; - | ^^^^^^^^^^^ help: consider comparing them within some error `(ONE - 1f32).abs() < error` + | ^^^^^^^^^^^ help: consider comparing them within some error: `(ONE - 1f32).abs() < error` | = note: `-D float-cmp` implied by `-D warnings` note: std::f32::EPSILON and std::f64::EPSILON are available. @@ -15,7 +15,7 @@ error: strict comparison of f32 or f64 --> float_cmp.rs:44:5 | 44 | ONE == 1.0 + 0.0; - | ^^^^^^^^^^^^^^^^ help: consider comparing them within some error `(ONE - (1.0 + 0.0)).abs() < error` + | ^^^^^^^^^^^^^^^^ help: consider comparing them within some error: `(ONE - (1.0 + 0.0)).abs() < error` | note: std::f32::EPSILON and std::f64::EPSILON are available. --> float_cmp.rs:44:5 @@ -27,7 +27,7 @@ error: strict comparison of f32 or f64 --> float_cmp.rs:45:5 | 45 | ONE + ONE == ZERO + ONE + ONE; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider comparing them within some error `(ONE + ONE - (ZERO + ONE + ONE)).abs() < error` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider comparing them within some error: `(ONE + ONE - (ZERO + ONE + ONE)).abs() < error` | note: std::f32::EPSILON and std::f64::EPSILON are available. --> float_cmp.rs:45:5 @@ -39,7 +39,7 @@ error: strict comparison of f32 or f64 --> float_cmp.rs:46:5 | 46 | ONE != 2.0; - | ^^^^^^^^^^ help: consider comparing them within some error `(ONE - 2.0).abs() < error` + | ^^^^^^^^^^ help: consider comparing them within some error: `(ONE - 2.0).abs() < error` | note: std::f32::EPSILON and std::f64::EPSILON are available. --> float_cmp.rs:46:5 @@ -51,7 +51,7 @@ error: strict comparison of f32 or f64 --> float_cmp.rs:48:5 | 48 | twice(ONE) != ONE; - | ^^^^^^^^^^^^^^^^^ help: consider comparing them within some error `(twice(ONE) - ONE).abs() < error` + | ^^^^^^^^^^^^^^^^^ help: consider comparing them within some error: `(twice(ONE) - ONE).abs() < error` | note: std::f32::EPSILON and std::f64::EPSILON are available. --> float_cmp.rs:48:5 @@ -63,7 +63,7 @@ error: strict comparison of f32 or f64 --> float_cmp.rs:49:5 | 49 | ONE as f64 != 2.0; - | ^^^^^^^^^^^^^^^^^ help: consider comparing them within some error `(ONE as f64 - 2.0).abs() < error` + | ^^^^^^^^^^^^^^^^^ help: consider comparing them within some error: `(ONE as f64 - 2.0).abs() < error` | note: std::f32::EPSILON and std::f64::EPSILON are available. --> float_cmp.rs:49:5 @@ -75,7 +75,7 @@ error: strict comparison of f32 or f64 --> float_cmp.rs:54:5 | 54 | x == 1.0; - | ^^^^^^^^ help: consider comparing them within some error `(x - 1.0).abs() < error` + | ^^^^^^^^ help: consider comparing them within some error: `(x - 1.0).abs() < error` | note: std::f32::EPSILON and std::f64::EPSILON are available. --> float_cmp.rs:54:5 @@ -87,7 +87,7 @@ error: strict comparison of f32 or f64 --> float_cmp.rs:57:5 | 57 | twice(x) != twice(ONE as f64); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider comparing them within some error `(twice(x) - twice(ONE as f64)).abs() < error` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider comparing them within some error: `(twice(x) - twice(ONE as f64)).abs() < error` | note: std::f32::EPSILON and std::f64::EPSILON are available. --> float_cmp.rs:57:5 diff --git a/clippy_tests/examples/for_loop.stderr b/clippy_tests/examples/for_loop.stderr index 06765f357..5cf8e611f 100644 --- a/clippy_tests/examples/for_loop.stderr +++ b/clippy_tests/examples/for_loop.stderr @@ -332,7 +332,7 @@ error: it is more idiomatic to loop over references to containers instead of usi --> for_loop.rs:203:15 | 203 | for _v in vec.iter() { } - | ^^^^^^^^^^ help: to write this more concisely, try `&vec` + | ^^^^^^^^^^ help: to write this more concisely, try: `&vec` | = note: `-D explicit-iter-loop` implied by `-D warnings` @@ -340,13 +340,13 @@ error: it is more idiomatic to loop over references to containers instead of usi --> for_loop.rs:205:15 | 205 | for _v in vec.iter_mut() { } - | ^^^^^^^^^^^^^^ help: to write this more concisely, try `&mut vec` + | ^^^^^^^^^^^^^^ help: to write this more concisely, try: `&mut vec` error: it is more idiomatic to loop over containers instead of using explicit iteration methods` --> for_loop.rs:208:15 | 208 | for _v in out_vec.into_iter() { } - | ^^^^^^^^^^^^^^^^^^^ help: to write this more concisely, try `out_vec` + | ^^^^^^^^^^^^^^^^^^^ help: to write this more concisely, try: `out_vec` | = note: `-D explicit-into-iter-loop` implied by `-D warnings` @@ -354,61 +354,61 @@ error: it is more idiomatic to loop over references to containers instead of usi --> for_loop.rs:211:15 | 211 | for _v in array.into_iter() {} - | ^^^^^^^^^^^^^^^^^ help: to write this more concisely, try `&array` + | ^^^^^^^^^^^^^^^^^ help: to write this more concisely, try: `&array` error: it is more idiomatic to loop over references to containers instead of using explicit iteration methods --> for_loop.rs:216:15 | 216 | for _v in [1, 2, 3].iter() { } - | ^^^^^^^^^^^^^^^^ help: to write this more concisely, try `&[1, 2, 3]` + | ^^^^^^^^^^^^^^^^ help: to write this more concisely, try: `&[1, 2, 3]` error: it is more idiomatic to loop over references to containers instead of using explicit iteration methods --> for_loop.rs:220:15 | 220 | for _v in [0; 32].iter() {} - | ^^^^^^^^^^^^^^ help: to write this more concisely, try `&[0; 32]` + | ^^^^^^^^^^^^^^ help: to write this more concisely, try: `&[0; 32]` error: it is more idiomatic to loop over references to containers instead of using explicit iteration methods --> for_loop.rs:225:15 | 225 | for _v in ll.iter() { } - | ^^^^^^^^^ help: to write this more concisely, try `&ll` + | ^^^^^^^^^ help: to write this more concisely, try: `&ll` error: it is more idiomatic to loop over references to containers instead of using explicit iteration methods --> for_loop.rs:228:15 | 228 | for _v in vd.iter() { } - | ^^^^^^^^^ help: to write this more concisely, try `&vd` + | ^^^^^^^^^ help: to write this more concisely, try: `&vd` error: it is more idiomatic to loop over references to containers instead of using explicit iteration methods --> for_loop.rs:231:15 | 231 | for _v in bh.iter() { } - | ^^^^^^^^^ help: to write this more concisely, try `&bh` + | ^^^^^^^^^ help: to write this more concisely, try: `&bh` error: it is more idiomatic to loop over references to containers instead of using explicit iteration methods --> for_loop.rs:234:15 | 234 | for _v in hm.iter() { } - | ^^^^^^^^^ help: to write this more concisely, try `&hm` + | ^^^^^^^^^ help: to write this more concisely, try: `&hm` error: it is more idiomatic to loop over references to containers instead of using explicit iteration methods --> for_loop.rs:237:15 | 237 | for _v in bt.iter() { } - | ^^^^^^^^^ help: to write this more concisely, try `&bt` + | ^^^^^^^^^ help: to write this more concisely, try: `&bt` error: it is more idiomatic to loop over references to containers instead of using explicit iteration methods --> for_loop.rs:240:15 | 240 | for _v in hs.iter() { } - | ^^^^^^^^^ help: to write this more concisely, try `&hs` + | ^^^^^^^^^ help: to write this more concisely, try: `&hs` error: it is more idiomatic to loop over references to containers instead of using explicit iteration methods --> for_loop.rs:243:15 | 243 | for _v in bs.iter() { } - | ^^^^^^^^^ help: to write this more concisely, try `&bs` + | ^^^^^^^^^ help: to write this more concisely, try: `&bs` error: you are iterating over `Iterator::next()` which is an Option; this will compile but is probably not what you want --> for_loop.rs:245:5 diff --git a/clippy_tests/examples/if_let_redundant_pattern_matching.stderr b/clippy_tests/examples/if_let_redundant_pattern_matching.stderr index afa7b20c8..aefe624a8 100644 --- a/clippy_tests/examples/if_let_redundant_pattern_matching.stderr +++ b/clippy_tests/examples/if_let_redundant_pattern_matching.stderr @@ -2,7 +2,7 @@ error: redundant pattern matching, consider using `is_ok()` --> if_let_redundant_pattern_matching.rs:9:12 | 9 | if let Ok(_) = Ok::(42) {} - | -------^^^^^--------------------- help: try this `if Ok::(42).is_ok()` + | -------^^^^^--------------------- help: try this: `if Ok::(42).is_ok()` | = note: `-D if-let-redundant-pattern-matching` implied by `-D warnings` @@ -10,19 +10,19 @@ error: redundant pattern matching, consider using `is_err()` --> if_let_redundant_pattern_matching.rs:11:12 | 11 | if let Err(_) = Err::(42) { - | -------^^^^^^---------------------- help: try this `if Err::(42).is_err()` + | -------^^^^^^---------------------- help: try this: `if Err::(42).is_err()` error: redundant pattern matching, consider using `is_none()` --> if_let_redundant_pattern_matching.rs:14:12 | 14 | if let None = None::<()> { - | -------^^^^------------- help: try this `if None::<()>.is_none()` + | -------^^^^------------- help: try this: `if None::<()>.is_none()` error: redundant pattern matching, consider using `is_some()` --> if_let_redundant_pattern_matching.rs:17:12 | 17 | if let Some(_) = Some(42) { - | -------^^^^^^^----------- help: try this `if Some(42).is_some()` + | -------^^^^^^^----------- help: try this: `if Some(42).is_some()` error: aborting due to 4 previous errors diff --git a/clippy_tests/examples/len_zero.stderr b/clippy_tests/examples/len_zero.stderr index 0ab65d468..a11130471 100644 --- a/clippy_tests/examples/len_zero.stderr +++ b/clippy_tests/examples/len_zero.stderr @@ -46,7 +46,7 @@ error: length comparison to zero --> len_zero.rs:130:8 | 130 | if x.len() == 0 { - | ^^^^^^^^^^^^ help: using `is_empty` is more concise: `x.is_empty()` + | ^^^^^^^^^^^^ help: using `is_empty` is more concise:: `x.is_empty()` | = note: `-D len-zero` implied by `-D warnings` @@ -54,37 +54,37 @@ error: length comparison to zero --> len_zero.rs:134:8 | 134 | if "".len() == 0 { - | ^^^^^^^^^^^^^ help: using `is_empty` is more concise: `"".is_empty()` + | ^^^^^^^^^^^^^ help: using `is_empty` is more concise:: `"".is_empty()` error: length comparison to zero --> len_zero.rs:148:8 | 148 | if has_is_empty.len() == 0 { - | ^^^^^^^^^^^^^^^^^^^^^^^ help: using `is_empty` is more concise: `has_is_empty.is_empty()` + | ^^^^^^^^^^^^^^^^^^^^^^^ help: using `is_empty` is more concise:: `has_is_empty.is_empty()` error: length comparison to zero --> len_zero.rs:151:8 | 151 | if has_is_empty.len() != 0 { - | ^^^^^^^^^^^^^^^^^^^^^^^ help: using `is_empty` is more concise: `!has_is_empty.is_empty()` + | ^^^^^^^^^^^^^^^^^^^^^^^ help: using `is_empty` is more concise:: `!has_is_empty.is_empty()` error: length comparison to zero --> len_zero.rs:154:8 | 154 | if has_is_empty.len() > 0 { - | ^^^^^^^^^^^^^^^^^^^^^^ help: using `is_empty` is more concise: `!has_is_empty.is_empty()` + | ^^^^^^^^^^^^^^^^^^^^^^ help: using `is_empty` is more concise:: `!has_is_empty.is_empty()` error: length comparison to zero --> len_zero.rs:160:8 | 160 | if with_is_empty.len() == 0 { - | ^^^^^^^^^^^^^^^^^^^^^^^^ help: using `is_empty` is more concise: `with_is_empty.is_empty()` + | ^^^^^^^^^^^^^^^^^^^^^^^^ help: using `is_empty` is more concise:: `with_is_empty.is_empty()` error: length comparison to zero --> len_zero.rs:172:8 | 172 | if b.len() != 0 { - | ^^^^^^^^^^^^ help: using `is_empty` is more concise: `!b.is_empty()` + | ^^^^^^^^^^^^ help: using `is_empty` is more concise:: `!b.is_empty()` error: aborting due to 11 previous errors diff --git a/clippy_tests/examples/let_if_seq.stderr b/clippy_tests/examples/let_if_seq.stderr index e33adf4fd..eda622942 100644 --- a/clippy_tests/examples/let_if_seq.stderr +++ b/clippy_tests/examples/let_if_seq.stderr @@ -5,7 +5,7 @@ error: `if _ { .. } else { .. }` is an expression 58 | | if f() { 59 | | foo = 42; 60 | | } - | |_____^ help: it is more idiomatic to write `let foo = if f() { 42 } else { 0 };` + | |_____^ help: it is more idiomatic to write: `let foo = if f() { 42 } else { 0 };` | = note: `-D useless-let-if-seq` implied by `-D warnings` = note: you might not need `mut` at all @@ -20,7 +20,7 @@ error: `if _ { .. } else { .. }` is an expression ... | 68 | | f(); 69 | | } - | |_____^ help: it is more idiomatic to write `let bar = if f() { ..; 42 } else { ..; 0 };` + | |_____^ help: it is more idiomatic to write: `let bar = if f() { ..; 42 } else { ..; 0 };` | = note: you might not need `mut` at all @@ -33,7 +33,7 @@ error: `if _ { .. } else { .. }` is an expression 74 | | } else { 75 | | quz = 0; 76 | | } - | |_____^ help: it is more idiomatic to write `let quz = if f() { 42 } else { 0 };` + | |_____^ help: it is more idiomatic to write: `let quz = if f() { 42 } else { 0 };` error: `if _ { .. } else { .. }` is an expression --> let_if_seq.rs:100:5 @@ -42,7 +42,7 @@ error: `if _ { .. } else { .. }` is an expression 101 | | if f() { 102 | | baz = 42; 103 | | } - | |_____^ help: it is more idiomatic to write `let baz = if f() { 42 } else { 0 };` + | |_____^ help: it is more idiomatic to write: `let baz = if f() { 42 } else { 0 };` | = note: you might not need `mut` at all diff --git a/clippy_tests/examples/matches.stderr b/clippy_tests/examples/matches.stderr index 59e63ff24..4a7491b8d 100644 --- a/clippy_tests/examples/matches.stderr +++ b/clippy_tests/examples/matches.stderr @@ -5,7 +5,7 @@ error: you seem to be trying to use match for destructuring a single pattern. Co 27 | | ExprNode::ExprAddrOf => Some(&NODE), 28 | | _ => { let x = 5; None }, 29 | | } - | |_____^ help: try this `if let ExprNode::ExprAddrOf = ExprNode::Butterflies { Some(&NODE) } else { let x = 5; None }` + | |_____^ help: try this: `if let ExprNode::ExprAddrOf = ExprNode::Butterflies { Some(&NODE) } else { let x = 5; None }` | = note: `-D single-match-else` implied by `-D warnings` @@ -16,7 +16,7 @@ error: you seem to be trying to use match for destructuring a single pattern. Co 36 | | Some(y) => { println!("{:?}", y); } 37 | | _ => () 38 | | }; - | |_____^ help: try this `if let Some(y) = x { println!("{:?}", y); }` + | |_____^ help: try this: `if let Some(y) = x { println!("{:?}", y); }` | = note: `-D single-match` implied by `-D warnings` @@ -27,7 +27,7 @@ error: you seem to be trying to use match for destructuring a single pattern. Co 42 | | (2...3, 7...9) => dummy(), 43 | | _ => {} 44 | | }; - | |_____^ help: try this `if let (2...3, 7...9) = z { dummy() }` + | |_____^ help: try this: `if let (2...3, 7...9) = z { dummy() }` error: you seem to be trying to use match for destructuring a single pattern. Consider using `if let` --> matches.rs:63:5 @@ -36,7 +36,7 @@ error: you seem to be trying to use match for destructuring a single pattern. Co 64 | | Some(y) => dummy(), 65 | | None => () 66 | | }; - | |_____^ help: try this `if let Some(y) = x { dummy() }` + | |_____^ help: try this: `if let Some(y) = x { dummy() }` error: you seem to be trying to use match for destructuring a single pattern. Consider using `if let` --> matches.rs:68:5 @@ -45,7 +45,7 @@ error: you seem to be trying to use match for destructuring a single pattern. Co 69 | | Ok(y) => dummy(), 70 | | Err(..) => () 71 | | }; - | |_____^ help: try this `if let Ok(y) = y { dummy() }` + | |_____^ help: try this: `if let Ok(y) = y { dummy() }` error: you seem to be trying to use match for destructuring a single pattern. Consider using `if let` --> matches.rs:75:5 @@ -54,7 +54,7 @@ error: you seem to be trying to use match for destructuring a single pattern. Co 76 | | Cow::Borrowed(..) => dummy(), 77 | | Cow::Owned(..) => (), 78 | | }; - | |_____^ help: try this `if let Cow::Borrowed(..) = c { dummy() }` + | |_____^ help: try this: `if let Cow::Borrowed(..) = c { dummy() }` error: you seem to be trying to match on a boolean expression --> matches.rs:96:5 @@ -63,7 +63,7 @@ error: you seem to be trying to match on a boolean expression 97 | | true => 0, 98 | | false => 42, 99 | | }; - | |_____^ help: consider using an if/else expression `if test { 0 } else { 42 }` + | |_____^ help: consider using an if/else expression: `if test { 0 } else { 42 }` | = note: `-D match-bool` implied by `-D warnings` @@ -74,7 +74,7 @@ error: you seem to be trying to match on a boolean expression 103 | | true => 1, 104 | | false => 0, 105 | | }; - | |_____^ help: consider using an if/else expression `if option == 1 { 1 } else { 0 }` + | |_____^ help: consider using an if/else expression: `if option == 1 { 1 } else { 0 }` error: you seem to be trying to match on a boolean expression --> matches.rs:107:5 @@ -83,7 +83,7 @@ error: you seem to be trying to match on a boolean expression 108 | | true => (), 109 | | false => { println!("Noooo!"); } 110 | | }; - | |_____^ help: consider using an if/else expression `if !test { println!("Noooo!"); }` + | |_____^ help: consider using an if/else expression: `if !test { println!("Noooo!"); }` error: you seem to be trying to match on a boolean expression --> matches.rs:112:5 @@ -92,7 +92,7 @@ error: you seem to be trying to match on a boolean expression 113 | | false => { println!("Noooo!"); } 114 | | _ => (), 115 | | }; - | |_____^ help: consider using an if/else expression `if !test { println!("Noooo!"); }` + | |_____^ help: consider using an if/else expression: `if !test { println!("Noooo!"); }` error: you seem to be trying to match on a boolean expression --> matches.rs:117:5 @@ -101,7 +101,7 @@ error: you seem to be trying to match on a boolean expression 118 | | false => { println!("Noooo!"); } 119 | | _ => (), 120 | | }; - | |_____^ help: consider using an if/else expression `if !(test && test) { println!("Noooo!"); }` + | |_____^ help: consider using an if/else expression: `if !(test && test) { println!("Noooo!"); }` error: equal expressions as operands to `&&` --> matches.rs:117:11 @@ -118,7 +118,7 @@ error: you seem to be trying to match on a boolean expression 123 | | false => { println!("Noooo!"); } 124 | | true => { println!("Yes!"); } 125 | | }; - | |_____^ help: consider using an if/else expression `if test { println!("Yes!"); } else { println!("Noooo!"); }` + | |_____^ help: consider using an if/else expression: `if test { println!("Yes!"); } else { println!("Noooo!"); }` error: you don't need to add `&` to all patterns --> matches.rs:138:9 @@ -156,7 +156,7 @@ error: you don't need to add `&` to both the expression and the patterns 155 | | &Some(v) => println!("{:?}", v), 156 | | &None => println!("none"), 157 | | } - | |_____^ help: try `match w { .. }` + | |_____^ help: try: `match w { .. }` error: you don't need to add `&` to all patterns --> matches.rs:165:5 @@ -177,7 +177,7 @@ error: you don't need to add `&` to both the expression and the patterns 170 | / if let &None = &b { 171 | | println!("none"); 172 | | } - | |_____^ help: try `if let .. = b { .. }` + | |_____^ help: try: `if let .. = b { .. }` error: some ranges overlap --> matches.rs:179:9 diff --git a/clippy_tests/examples/methods.stderr b/clippy_tests/examples/methods.stderr index 51cbf35a4..c45eab9f4 100644 --- a/clippy_tests/examples/methods.stderr +++ b/clippy_tests/examples/methods.stderr @@ -182,7 +182,7 @@ error: use of `unwrap_or` followed by a function call --> methods.rs:268:5 | 268 | with_constructor.unwrap_or(make()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this `with_constructor.unwrap_or_else(make)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `with_constructor.unwrap_or_else(make)` | = note: `-D or-fun-call` implied by `-D warnings` @@ -190,67 +190,67 @@ error: use of `unwrap_or` followed by a call to `new` --> methods.rs:271:5 | 271 | with_new.unwrap_or(Vec::new()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this `with_new.unwrap_or_default()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `with_new.unwrap_or_default()` error: use of `unwrap_or` followed by a function call --> methods.rs:274:5 | 274 | with_const_args.unwrap_or(Vec::with_capacity(12)); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this `with_const_args.unwrap_or_else(|| Vec::with_capacity(12))` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `with_const_args.unwrap_or_else(|| Vec::with_capacity(12))` error: use of `unwrap_or` followed by a function call --> methods.rs:277:5 | 277 | with_err.unwrap_or(make()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this `with_err.unwrap_or_else(|_| make())` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `with_err.unwrap_or_else(|_| make())` error: use of `unwrap_or` followed by a function call --> methods.rs:280:5 | 280 | with_err_args.unwrap_or(Vec::with_capacity(12)); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this `with_err_args.unwrap_or_else(|_| Vec::with_capacity(12))` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `with_err_args.unwrap_or_else(|_| Vec::with_capacity(12))` error: use of `unwrap_or` followed by a call to `default` --> methods.rs:283:5 | 283 | with_default_trait.unwrap_or(Default::default()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this `with_default_trait.unwrap_or_default()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `with_default_trait.unwrap_or_default()` error: use of `unwrap_or` followed by a call to `default` --> methods.rs:286:5 | 286 | with_default_type.unwrap_or(u64::default()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this `with_default_type.unwrap_or_default()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `with_default_type.unwrap_or_default()` error: use of `unwrap_or` followed by a function call --> methods.rs:289:5 | 289 | with_vec.unwrap_or(vec![]); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this `with_vec.unwrap_or_else(|| < [ _ ] > :: into_vec ( box [ $ ( $ x ) , * ] ))` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `with_vec.unwrap_or_else(|| < [ _ ] > :: into_vec ( box [ $ ( $ x ) , * ] ))` error: use of `unwrap_or` followed by a function call --> methods.rs:294:5 | 294 | without_default.unwrap_or(Foo::new()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this `without_default.unwrap_or_else(Foo::new)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `without_default.unwrap_or_else(Foo::new)` error: use of `or_insert` followed by a function call --> methods.rs:297:5 | 297 | map.entry(42).or_insert(String::new()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this `map.entry(42).or_insert_with(String::new)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `map.entry(42).or_insert_with(String::new)` error: use of `or_insert` followed by a function call --> methods.rs:300:5 | 300 | btree.entry(42).or_insert(String::new()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this `btree.entry(42).or_insert_with(String::new)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `btree.entry(42).or_insert_with(String::new)` error: use of `unwrap_or` followed by a function call --> methods.rs:303:13 | 303 | let _ = stringy.unwrap_or("".to_owned()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this `stringy.unwrap_or_else(|| "".to_owned())` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `stringy.unwrap_or_else(|| "".to_owned())` error: called `.iter().nth()` on a Vec. Calling `.get()` is both faster and more readable --> methods.rs:314:23 @@ -326,7 +326,7 @@ error: called `.get().unwrap()` on a slice. Using `[]` is more clear and more co --> methods.rs:369:17 | 369 | let _ = boxed_slice.get(1).unwrap(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this `&boxed_slice[1]` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `&boxed_slice[1]` | = note: `-D get-unwrap` implied by `-D warnings` @@ -334,55 +334,55 @@ error: called `.get().unwrap()` on a slice. Using `[]` is more clear and more co --> methods.rs:370:17 | 370 | let _ = some_slice.get(0).unwrap(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this `&some_slice[0]` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `&some_slice[0]` error: called `.get().unwrap()` on a Vec. Using `[]` is more clear and more concise --> methods.rs:371:17 | 371 | let _ = some_vec.get(0).unwrap(); - | ^^^^^^^^^^^^^^^^^^^^^^^^ help: try this `&some_vec[0]` + | ^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `&some_vec[0]` error: called `.get().unwrap()` on a VecDeque. Using `[]` is more clear and more concise --> methods.rs:372:17 | 372 | let _ = some_vecdeque.get(0).unwrap(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this `&some_vecdeque[0]` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `&some_vecdeque[0]` error: called `.get().unwrap()` on a HashMap. Using `[]` is more clear and more concise --> methods.rs:373:17 | 373 | let _ = some_hashmap.get(&1).unwrap(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this `&some_hashmap[&1]` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `&some_hashmap[&1]` error: called `.get().unwrap()` on a BTreeMap. Using `[]` is more clear and more concise --> methods.rs:374:17 | 374 | let _ = some_btreemap.get(&1).unwrap(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this `&some_btreemap[&1]` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `&some_btreemap[&1]` error: called `.get_mut().unwrap()` on a slice. Using `[]` is more clear and more concise --> methods.rs:379:10 | 379 | *boxed_slice.get_mut(0).unwrap() = 1; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this `&mut boxed_slice[0]` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `&mut boxed_slice[0]` error: called `.get_mut().unwrap()` on a slice. Using `[]` is more clear and more concise --> methods.rs:380:10 | 380 | *some_slice.get_mut(0).unwrap() = 1; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this `&mut some_slice[0]` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `&mut some_slice[0]` error: called `.get_mut().unwrap()` on a Vec. Using `[]` is more clear and more concise --> methods.rs:381:10 | 381 | *some_vec.get_mut(0).unwrap() = 1; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this `&mut some_vec[0]` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `&mut some_vec[0]` error: called `.get_mut().unwrap()` on a VecDeque. Using `[]` is more clear and more concise --> methods.rs:382:10 | 382 | *some_vecdeque.get_mut(0).unwrap() = 1; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this `&mut some_vecdeque[0]` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `&mut some_vecdeque[0]` error: used unwrap() on an Option value. If you don't want to handle the None case gracefully, consider using expect() to provide a better panic message --> methods.rs:396:13 @@ -436,7 +436,7 @@ error: you should use the `starts_with` method --> methods.rs:425:5 | 425 | "".chars().next() == Some(' '); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: like this `"".starts_with(' ')` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: like this: `"".starts_with(' ')` | = note: `-D chars-next-cmp` implied by `-D warnings` @@ -444,13 +444,13 @@ error: you should use the `starts_with` method --> methods.rs:426:5 | 426 | Some(' ') != "".chars().next(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: like this `!"".starts_with(' ')` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: like this: `!"".starts_with(' ')` error: calling `.extend(_.chars())` --> methods.rs:435:5 | 435 | s.extend(abc.chars()); - | ^^^^^^^^^^^^^^^^^^^^^ help: try this `s.push_str(abc)` + | ^^^^^^^^^^^^^^^^^^^^^ help: try this: `s.push_str(abc)` | = note: `-D string-extend-chars` implied by `-D warnings` @@ -458,19 +458,19 @@ error: calling `.extend(_.chars())` --> methods.rs:438:5 | 438 | s.extend("abc".chars()); - | ^^^^^^^^^^^^^^^^^^^^^^^ help: try this `s.push_str("abc")` + | ^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `s.push_str("abc")` error: calling `.extend(_.chars())` --> methods.rs:441:5 | 441 | s.extend(def.chars()); - | ^^^^^^^^^^^^^^^^^^^^^ help: try this `s.push_str(&def)` + | ^^^^^^^^^^^^^^^^^^^^^ help: try this: `s.push_str(&def)` error: using `clone` on a `Copy` type --> methods.rs:452:5 | 452 | 42.clone(); - | ^^^^^^^^^^ help: try removing the `clone` call `42` + | ^^^^^^^^^^ help: try removing the `clone` call: `42` | = note: `-D clone-on-copy` implied by `-D warnings` @@ -478,25 +478,25 @@ error: using `clone` on a `Copy` type --> methods.rs:456:5 | 456 | (&42).clone(); - | ^^^^^^^^^^^^^ help: try dereferencing it `*(&42)` + | ^^^^^^^^^^^^^ help: try dereferencing it: `*(&42)` error: using `clone` on a `Copy` type --> methods.rs:460:5 | 460 | t.clone(); - | ^^^^^^^^^ help: try removing the `clone` call `t` + | ^^^^^^^^^ help: try removing the `clone` call: `t` error: using `clone` on a `Copy` type --> methods.rs:462:5 | 462 | Some(t).clone(); - | ^^^^^^^^^^^^^^^ help: try removing the `clone` call `Some(t)` + | ^^^^^^^^^^^^^^^ help: try removing the `clone` call: `Some(t)` error: using `clone` on a double-reference; this will copy the reference instead of cloning the inner type --> methods.rs:468:22 | 468 | let z: &Vec<_> = y.clone(); - | ^^^^^^^^^ help: try dereferencing it `(*y).clone()` + | ^^^^^^^^^ help: try dereferencing it: `(*y).clone()` | = note: `-D clone-double-ref` implied by `-D warnings` @@ -504,7 +504,7 @@ error: single-character string constant used as pattern --> methods.rs:475:13 | 475 | x.split("x"); - | --------^^^- help: try using a char instead: `x.split('x')` + | --------^^^- help: try using a char instead:: `x.split('x')` | = note: `-D single-char-pattern` implied by `-D warnings` @@ -512,97 +512,97 @@ error: single-character string constant used as pattern --> methods.rs:492:16 | 492 | x.contains("x"); - | -----------^^^- help: try using a char instead: `x.contains('x')` + | -----------^^^- help: try using a char instead:: `x.contains('x')` error: single-character string constant used as pattern --> methods.rs:493:19 | 493 | x.starts_with("x"); - | --------------^^^- help: try using a char instead: `x.starts_with('x')` + | --------------^^^- help: try using a char instead:: `x.starts_with('x')` error: single-character string constant used as pattern --> methods.rs:494:17 | 494 | x.ends_with("x"); - | ------------^^^- help: try using a char instead: `x.ends_with('x')` + | ------------^^^- help: try using a char instead:: `x.ends_with('x')` error: single-character string constant used as pattern --> methods.rs:495:12 | 495 | x.find("x"); - | -------^^^- help: try using a char instead: `x.find('x')` + | -------^^^- help: try using a char instead:: `x.find('x')` error: single-character string constant used as pattern --> methods.rs:496:13 | 496 | x.rfind("x"); - | --------^^^- help: try using a char instead: `x.rfind('x')` + | --------^^^- help: try using a char instead:: `x.rfind('x')` error: single-character string constant used as pattern --> methods.rs:497:14 | 497 | x.rsplit("x"); - | ---------^^^- help: try using a char instead: `x.rsplit('x')` + | ---------^^^- help: try using a char instead:: `x.rsplit('x')` error: single-character string constant used as pattern --> methods.rs:498:24 | 498 | x.split_terminator("x"); - | -------------------^^^- help: try using a char instead: `x.split_terminator('x')` + | -------------------^^^- help: try using a char instead:: `x.split_terminator('x')` error: single-character string constant used as pattern --> methods.rs:499:25 | 499 | x.rsplit_terminator("x"); - | --------------------^^^- help: try using a char instead: `x.rsplit_terminator('x')` + | --------------------^^^- help: try using a char instead:: `x.rsplit_terminator('x')` error: single-character string constant used as pattern --> methods.rs:500:17 | 500 | x.splitn(0, "x"); - | ------------^^^- help: try using a char instead: `x.splitn(0, 'x')` + | ------------^^^- help: try using a char instead:: `x.splitn(0, 'x')` error: single-character string constant used as pattern --> methods.rs:501:18 | 501 | x.rsplitn(0, "x"); - | -------------^^^- help: try using a char instead: `x.rsplitn(0, 'x')` + | -------------^^^- help: try using a char instead:: `x.rsplitn(0, 'x')` error: single-character string constant used as pattern --> methods.rs:502:15 | 502 | x.matches("x"); - | ----------^^^- help: try using a char instead: `x.matches('x')` + | ----------^^^- help: try using a char instead:: `x.matches('x')` error: single-character string constant used as pattern --> methods.rs:503:16 | 503 | x.rmatches("x"); - | -----------^^^- help: try using a char instead: `x.rmatches('x')` + | -----------^^^- help: try using a char instead:: `x.rmatches('x')` error: single-character string constant used as pattern --> methods.rs:504:21 | 504 | x.match_indices("x"); - | ----------------^^^- help: try using a char instead: `x.match_indices('x')` + | ----------------^^^- help: try using a char instead:: `x.match_indices('x')` error: single-character string constant used as pattern --> methods.rs:505:22 | 505 | x.rmatch_indices("x"); - | -----------------^^^- help: try using a char instead: `x.rmatch_indices('x')` + | -----------------^^^- help: try using a char instead:: `x.rmatch_indices('x')` error: single-character string constant used as pattern --> methods.rs:506:25 | 506 | x.trim_left_matches("x"); - | --------------------^^^- help: try using a char instead: `x.trim_left_matches('x')` + | --------------------^^^- help: try using a char instead:: `x.trim_left_matches('x')` error: single-character string constant used as pattern --> methods.rs:507:26 | 507 | x.trim_right_matches("x"); - | ---------------------^^^- help: try using a char instead: `x.trim_right_matches('x')` + | ---------------------^^^- help: try using a char instead:: `x.trim_right_matches('x')` error: you are getting the inner pointer of a temporary `CString` --> methods.rs:517:5 diff --git a/clippy_tests/examples/needless_bool.stderr b/clippy_tests/examples/needless_bool.stderr index c521e1228..6d129777f 100644 --- a/clippy_tests/examples/needless_bool.stderr +++ b/clippy_tests/examples/needless_bool.stderr @@ -16,19 +16,19 @@ error: this if-then-else expression returns a bool literal --> needless_bool.rs:11:5 | 11 | if x { true } else { false }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: you can reduce it to `x` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: you can reduce it to: `x` error: this if-then-else expression returns a bool literal --> needless_bool.rs:12:5 | 12 | if x { false } else { true }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: you can reduce it to `!x` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: you can reduce it to: `!x` error: this if-then-else expression returns a bool literal --> needless_bool.rs:13:5 | 13 | if x && y { false } else { true }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: you can reduce it to `!(x && y)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: you can reduce it to: `!(x && y)` error: this if-then-else expression will always return true --> needless_bool.rs:25:5 @@ -46,25 +46,25 @@ error: this if-then-else expression returns a bool literal --> needless_bool.rs:35:5 | 35 | if x { return true } else { return false }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: you can reduce it to `return x` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: you can reduce it to: `return x` error: this if-then-else expression returns a bool literal --> needless_bool.rs:40:5 | 40 | if x && y { return true } else { return false }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: you can reduce it to `return x && y` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: you can reduce it to: `return x && y` error: this if-then-else expression returns a bool literal --> needless_bool.rs:45:5 | 45 | if x { return false } else { return true }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: you can reduce it to `return !x` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: you can reduce it to: `return !x` error: this if-then-else expression returns a bool literal --> needless_bool.rs:50:5 | 50 | if x && y { return false } else { return true }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: you can reduce it to `return !(x && y)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: you can reduce it to: `return !(x && y)` error: aborting due to 11 previous errors diff --git a/clippy_tests/examples/needless_pass_by_value.stderr b/clippy_tests/examples/needless_pass_by_value.stderr index 12a9640e7..15701d651 100644 --- a/clippy_tests/examples/needless_pass_by_value.stderr +++ b/clippy_tests/examples/needless_pass_by_value.stderr @@ -2,7 +2,7 @@ error: this argument is passed by value, but not consumed in the function body --> needless_pass_by_value.rs:9:23 | 9 | fn foo(v: Vec, w: Vec, mut x: Vec, y: Vec) -> Vec { - | ^^^^^^ help: consider changing the type to `&[T]` + | ^^^^^^ help: consider changing the type to: `&[T]` | = note: `-D needless-pass-by-value` implied by `-D warnings` @@ -10,19 +10,19 @@ error: this argument is passed by value, but not consumed in the function body --> needless_pass_by_value.rs:23:11 | 23 | fn bar(x: String, y: Wrapper) { - | ^^^^^^ help: consider changing the type to `&str` + | ^^^^^^ help: consider changing the type to: `&str` error: this argument is passed by value, but not consumed in the function body --> needless_pass_by_value.rs:23:22 | 23 | fn bar(x: String, y: Wrapper) { - | ^^^^^^^ help: consider taking a reference instead `&Wrapper` + | ^^^^^^^ help: consider taking a reference instead: `&Wrapper` error: this argument is passed by value, but not consumed in the function body --> needless_pass_by_value.rs:29:63 | 29 | fn test_borrow_trait, U>(t: T, u: U) { - | ^ help: consider taking a reference instead `&U` + | ^ help: consider taking a reference instead: `&U` error: this argument is passed by value, but not consumed in the function body --> needless_pass_by_value.rs:40:18 @@ -40,7 +40,7 @@ error: this argument is passed by value, but not consumed in the function body --> needless_pass_by_value.rs:53:24 | 53 | fn test_destructure(x: Wrapper, y: Wrapper, z: Wrapper) { - | ^^^^^^^ help: consider taking a reference instead `&Wrapper` + | ^^^^^^^ help: consider taking a reference instead: `&Wrapper` error: this argument is passed by value, but not consumed in the function body --> needless_pass_by_value.rs:53:36 diff --git a/clippy_tests/examples/needless_return.stderr b/clippy_tests/examples/needless_return.stderr index 8cd549c96..158f9c432 100644 --- a/clippy_tests/examples/needless_return.stderr +++ b/clippy_tests/examples/needless_return.stderr @@ -2,7 +2,7 @@ error: unneeded return statement --> needless_return.rs:11:5 | 11 | return true; - | ^^^^^^^^^^^^ help: remove `return` as shown: `true` + | ^^^^^^^^^^^^ help: remove `return` as shown:: `true` | = note: `-D needless-return` implied by `-D warnings` @@ -10,43 +10,43 @@ error: unneeded return statement --> needless_return.rs:15:5 | 15 | return true - | ^^^^^^^^^^^ help: remove `return` as shown: `true` + | ^^^^^^^^^^^ help: remove `return` as shown:: `true` error: unneeded return statement --> needless_return.rs:20:9 | 20 | return true; - | ^^^^^^^^^^^^ help: remove `return` as shown: `true` + | ^^^^^^^^^^^^ help: remove `return` as shown:: `true` error: unneeded return statement --> needless_return.rs:22:9 | 22 | return false; - | ^^^^^^^^^^^^^ help: remove `return` as shown: `false` + | ^^^^^^^^^^^^^ help: remove `return` as shown:: `false` error: unneeded return statement --> needless_return.rs:28:17 | 28 | true => return false, - | ^^^^^^^^^^^^ help: remove `return` as shown: `false` + | ^^^^^^^^^^^^ help: remove `return` as shown:: `false` error: unneeded return statement --> needless_return.rs:30:13 | 30 | return true; - | ^^^^^^^^^^^^ help: remove `return` as shown: `true` + | ^^^^^^^^^^^^ help: remove `return` as shown:: `true` error: unneeded return statement --> needless_return.rs:37:9 | 37 | return true; - | ^^^^^^^^^^^^ help: remove `return` as shown: `true` + | ^^^^^^^^^^^^ help: remove `return` as shown:: `true` error: unneeded return statement --> needless_return.rs:39:16 | 39 | let _ = || return true; - | ^^^^^^^^^^^ help: remove `return` as shown: `true` + | ^^^^^^^^^^^ help: remove `return` as shown:: `true` error: aborting due to 8 previous errors diff --git a/clippy_tests/examples/no_effect.stderr b/clippy_tests/examples/no_effect.stderr index 48ed82163..4d1c29ed0 100644 --- a/clippy_tests/examples/no_effect.stderr +++ b/clippy_tests/examples/no_effect.stderr @@ -154,7 +154,7 @@ error: statement can be reduced --> no_effect.rs:65:5 | 65 | Tuple(get_number()); - | ^^^^^^^^^^^^^^^^^^^^ help: replace it with `get_number();` + | ^^^^^^^^^^^^^^^^^^^^ help: replace it with: `get_number();` | = note: `-D unnecessary-operation` implied by `-D warnings` @@ -162,109 +162,109 @@ error: statement can be reduced --> no_effect.rs:66:5 | 66 | Struct { field: get_number() }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with `get_number();` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `get_number();` error: statement can be reduced --> no_effect.rs:67:5 | 67 | Struct { ..get_struct() }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with `get_struct();` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `get_struct();` error: statement can be reduced --> no_effect.rs:68:5 | 68 | Enum::Tuple(get_number()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with `get_number();` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `get_number();` error: statement can be reduced --> no_effect.rs:69:5 | 69 | Enum::Struct { field: get_number() }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with `get_number();` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `get_number();` error: statement can be reduced --> no_effect.rs:70:5 | 70 | 5 + get_number(); - | ^^^^^^^^^^^^^^^^^ help: replace it with `5;get_number();` + | ^^^^^^^^^^^^^^^^^ help: replace it with: `5;get_number();` error: statement can be reduced --> no_effect.rs:71:5 | 71 | *&get_number(); - | ^^^^^^^^^^^^^^^ help: replace it with `get_number();` + | ^^^^^^^^^^^^^^^ help: replace it with: `get_number();` error: statement can be reduced --> no_effect.rs:72:5 | 72 | &get_number(); - | ^^^^^^^^^^^^^^ help: replace it with `get_number();` + | ^^^^^^^^^^^^^^ help: replace it with: `get_number();` error: statement can be reduced --> no_effect.rs:73:5 | 73 | (5, 6, get_number()); - | ^^^^^^^^^^^^^^^^^^^^^ help: replace it with `5;6;get_number();` + | ^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `5;6;get_number();` error: statement can be reduced --> no_effect.rs:74:5 | 74 | box get_number(); - | ^^^^^^^^^^^^^^^^^ help: replace it with `get_number();` + | ^^^^^^^^^^^^^^^^^ help: replace it with: `get_number();` error: statement can be reduced --> no_effect.rs:75:5 | 75 | get_number()..; - | ^^^^^^^^^^^^^^^ help: replace it with `get_number();` + | ^^^^^^^^^^^^^^^ help: replace it with: `get_number();` error: statement can be reduced --> no_effect.rs:76:5 | 76 | ..get_number(); - | ^^^^^^^^^^^^^^^ help: replace it with `get_number();` + | ^^^^^^^^^^^^^^^ help: replace it with: `get_number();` error: statement can be reduced --> no_effect.rs:77:5 | 77 | 5..get_number(); - | ^^^^^^^^^^^^^^^^ help: replace it with `5;get_number();` + | ^^^^^^^^^^^^^^^^ help: replace it with: `5;get_number();` error: statement can be reduced --> no_effect.rs:78:5 | 78 | [42, get_number()]; - | ^^^^^^^^^^^^^^^^^^^ help: replace it with `42;get_number();` + | ^^^^^^^^^^^^^^^^^^^ help: replace it with: `42;get_number();` error: statement can be reduced --> no_effect.rs:79:5 | 79 | [42, 55][get_number() as usize]; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with `[42, 55];get_number() as usize;` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `[42, 55];get_number() as usize;` error: statement can be reduced --> no_effect.rs:80:5 | 80 | (42, get_number()).1; - | ^^^^^^^^^^^^^^^^^^^^^ help: replace it with `42;get_number();` + | ^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `42;get_number();` error: statement can be reduced --> no_effect.rs:81:5 | 81 | [get_number(); 55]; - | ^^^^^^^^^^^^^^^^^^^ help: replace it with `get_number();` + | ^^^^^^^^^^^^^^^^^^^ help: replace it with: `get_number();` error: statement can be reduced --> no_effect.rs:82:5 | 82 | [42; 55][get_number() as usize]; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with `[42; 55];get_number() as usize;` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `[42; 55];get_number() as usize;` error: statement can be reduced --> no_effect.rs:83:5 | 83 | {get_number()}; - | ^^^^^^^^^^^^^^^ help: replace it with `get_number();` + | ^^^^^^^^^^^^^^^ help: replace it with: `get_number();` error: aborting due to 44 previous errors diff --git a/clippy_tests/examples/precedence.stderr b/clippy_tests/examples/precedence.stderr index 516ddf562..945279092 100644 --- a/clippy_tests/examples/precedence.stderr +++ b/clippy_tests/examples/precedence.stderr @@ -2,7 +2,7 @@ error: operator precedence can trip the unwary --> precedence.rs:8:5 | 8 | 1 << 2 + 3; - | ^^^^^^^^^^ help: consider parenthesizing your expression `1 << (2 + 3)` + | ^^^^^^^^^^ help: consider parenthesizing your expression: `1 << (2 + 3)` | = note: `-D precedence` implied by `-D warnings` @@ -10,49 +10,49 @@ error: operator precedence can trip the unwary --> precedence.rs:9:5 | 9 | 1 + 2 << 3; - | ^^^^^^^^^^ help: consider parenthesizing your expression `(1 + 2) << 3` + | ^^^^^^^^^^ help: consider parenthesizing your expression: `(1 + 2) << 3` error: operator precedence can trip the unwary --> precedence.rs:10:5 | 10 | 4 >> 1 + 1; - | ^^^^^^^^^^ help: consider parenthesizing your expression `4 >> (1 + 1)` + | ^^^^^^^^^^ help: consider parenthesizing your expression: `4 >> (1 + 1)` error: operator precedence can trip the unwary --> precedence.rs:11:5 | 11 | 1 + 3 >> 2; - | ^^^^^^^^^^ help: consider parenthesizing your expression `(1 + 3) >> 2` + | ^^^^^^^^^^ help: consider parenthesizing your expression: `(1 + 3) >> 2` error: operator precedence can trip the unwary --> precedence.rs:12:5 | 12 | 1 ^ 1 - 1; - | ^^^^^^^^^ help: consider parenthesizing your expression `1 ^ (1 - 1)` + | ^^^^^^^^^ help: consider parenthesizing your expression: `1 ^ (1 - 1)` error: operator precedence can trip the unwary --> precedence.rs:13:5 | 13 | 3 | 2 - 1; - | ^^^^^^^^^ help: consider parenthesizing your expression `3 | (2 - 1)` + | ^^^^^^^^^ help: consider parenthesizing your expression: `3 | (2 - 1)` error: operator precedence can trip the unwary --> precedence.rs:14:5 | 14 | 3 & 5 - 2; - | ^^^^^^^^^ help: consider parenthesizing your expression `3 & (5 - 2)` + | ^^^^^^^^^ help: consider parenthesizing your expression: `3 & (5 - 2)` error: unary minus has lower precedence than method call --> precedence.rs:15:5 | 15 | -1i32.abs(); - | ^^^^^^^^^^^ help: consider adding parentheses to clarify your intent `-(1i32.abs())` + | ^^^^^^^^^^^ help: consider adding parentheses to clarify your intent: `-(1i32.abs())` error: unary minus has lower precedence than method call --> precedence.rs:16:5 | 16 | -1f32.abs(); - | ^^^^^^^^^^^ help: consider adding parentheses to clarify your intent `-(1f32.abs())` + | ^^^^^^^^^^^ help: consider adding parentheses to clarify your intent: `-(1f32.abs())` error: aborting due to 9 previous errors diff --git a/clippy_tests/examples/redundant_closure_call.stderr b/clippy_tests/examples/redundant_closure_call.stderr index 4b346d01e..0dc9672b1 100644 --- a/clippy_tests/examples/redundant_closure_call.stderr +++ b/clippy_tests/examples/redundant_closure_call.stderr @@ -16,7 +16,7 @@ error: Try not to call a closure in the expression where it is declared. --> redundant_closure_call.rs:7:10 | 7 | let a = (|| 42)(); - | ^^^^^^^^^ help: Try doing something like: `42` + | ^^^^^^^^^ help: Try doing something like: : `42` error: Try not to call a closure in the expression where it is declared. --> redundant_closure_call.rs:10:14 diff --git a/clippy_tests/examples/reference.stderr b/clippy_tests/examples/reference.stderr index acc6b033a..6e8bfedf4 100644 --- a/clippy_tests/examples/reference.stderr +++ b/clippy_tests/examples/reference.stderr @@ -2,7 +2,7 @@ error: immediately dereferencing a reference --> reference.rs:19:13 | 19 | let b = *&a; - | ^^^ help: try this `a` + | ^^^ help: try this: `a` | = note: `-D deref-addrof` implied by `-D warnings` @@ -10,61 +10,61 @@ error: immediately dereferencing a reference --> reference.rs:21:13 | 21 | let b = *&get_number(); - | ^^^^^^^^^^^^^^ help: try this `get_number()` + | ^^^^^^^^^^^^^^ help: try this: `get_number()` error: immediately dereferencing a reference --> reference.rs:26:13 | 26 | let b = *&bytes[1..2][0]; - | ^^^^^^^^^^^^^^^^ help: try this `bytes[1..2][0]` + | ^^^^^^^^^^^^^^^^ help: try this: `bytes[1..2][0]` error: immediately dereferencing a reference --> reference.rs:30:13 | 30 | let b = *&(a); - | ^^^^^ help: try this `(a)` + | ^^^^^ help: try this: `(a)` error: immediately dereferencing a reference --> reference.rs:32:13 | 32 | let b = *(&a); - | ^^^^^ help: try this `a` + | ^^^^^ help: try this: `a` error: immediately dereferencing a reference --> reference.rs:34:13 | 34 | let b = *((&a)); - | ^^^^^^^ help: try this `a` + | ^^^^^^^ help: try this: `a` error: immediately dereferencing a reference --> reference.rs:36:13 | 36 | let b = *&&a; - | ^^^^ help: try this `&a` + | ^^^^ help: try this: `&a` error: immediately dereferencing a reference --> reference.rs:38:14 | 38 | let b = **&aref; - | ^^^^^^ help: try this `aref` + | ^^^^^^ help: try this: `aref` error: immediately dereferencing a reference --> reference.rs:42:14 | 42 | let b = **&&a; - | ^^^^ help: try this `&a` + | ^^^^ help: try this: `&a` error: immediately dereferencing a reference --> reference.rs:46:17 | 46 | let y = *&mut x; - | ^^^^^^^ help: try this `x` + | ^^^^^^^ help: try this: `x` error: immediately dereferencing a reference --> reference.rs:53:18 | 53 | let y = **&mut &mut x; - | ^^^^^^^^^^^^ help: try this `&mut x` + | ^^^^^^^^^^^^ help: try this: `&mut x` error: aborting due to 11 previous errors diff --git a/clippy_tests/examples/short_circuit_statement.stderr b/clippy_tests/examples/short_circuit_statement.stderr index 8dcc43711..74976bfdc 100644 --- a/clippy_tests/examples/short_circuit_statement.stderr +++ b/clippy_tests/examples/short_circuit_statement.stderr @@ -2,7 +2,7 @@ error: boolean short circuit operator in statement may be clearer using an expli --> short_circuit_statement.rs:7:5 | 7 | f() && g(); - | ^^^^^^^^^^^ help: replace it with `if f() { g(); }` + | ^^^^^^^^^^^ help: replace it with: `if f() { g(); }` | = note: `-D short-circuit-statement` implied by `-D warnings` @@ -10,13 +10,13 @@ error: boolean short circuit operator in statement may be clearer using an expli --> short_circuit_statement.rs:8:5 | 8 | f() || g(); - | ^^^^^^^^^^^ help: replace it with `if !f() { g(); }` + | ^^^^^^^^^^^ help: replace it with: `if !f() { g(); }` error: boolean short circuit operator in statement may be clearer using an explicit test --> short_circuit_statement.rs:9:5 | 9 | 1 == 2 || g(); - | ^^^^^^^^^^^^^^ help: replace it with `if !(1 == 2) { g(); }` + | ^^^^^^^^^^^^^^ help: replace it with: `if !(1 == 2) { g(); }` error: aborting due to 3 previous errors diff --git a/clippy_tests/examples/strings.stderr b/clippy_tests/examples/strings.stderr index 6f2ed0353..fd2d749f4 100644 --- a/clippy_tests/examples/strings.stderr +++ b/clippy_tests/examples/strings.stderr @@ -2,7 +2,7 @@ error: manual implementation of an assign operation --> strings.rs:10:9 | 10 | x = x + "."; - | ^^^^^^^^^^^ help: replace it with `x += "."` + | ^^^^^^^^^^^ help: replace it with: `x += "."` | = note: `-D assign-op-pattern` implied by `-D warnings` @@ -32,7 +32,7 @@ error: manual implementation of an assign operation --> strings.rs:24:9 | 24 | x = x + "."; - | ^^^^^^^^^^^ help: replace it with `x += "."` + | ^^^^^^^^^^^ help: replace it with: `x += "."` error: you assigned the result of adding something to this string. Consider using `String::push_str()` instead --> strings.rs:38:9 @@ -44,7 +44,7 @@ error: manual implementation of an assign operation --> strings.rs:38:9 | 38 | x = x + "."; - | ^^^^^^^^^^^ help: replace it with `x += "."` + | ^^^^^^^^^^^ help: replace it with: `x += "."` error: you added something to a string. Consider using `String::push_str()` instead --> strings.rs:42:13 @@ -56,17 +56,23 @@ error: calling `as_bytes()` on a string literal --> strings.rs:50:14 | 50 | let bs = "hello there".as_bytes(); - | ^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using a byte string literal instead `b"hello there"` + | ^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using a byte string literal instead: `b"hello there"` | = note: `-D string-lit-as-bytes` implied by `-D warnings` +error: calling `as_bytes()` on a string literal + --> strings.rs:55:18 + | +55 | let strify = stringify!(foobar).as_bytes(); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using a byte string literal instead: `bstringify!(foobar)` + error: manual implementation of an assign operation --> strings.rs:65:7 | 65 | ; x = x + 1; - | ^^^^^^^^^ help: replace it with `x += 1` + | ^^^^^^^^^ help: replace it with: `x += 1` -error: aborting due to 10 previous errors +error: aborting due to 11 previous errors To learn more, run the command again with --verbose. diff --git a/clippy_tests/examples/swap.stderr b/clippy_tests/examples/swap.stderr index 99cf0aee3..c2e05ddc8 100644 --- a/clippy_tests/examples/swap.stderr +++ b/clippy_tests/examples/swap.stderr @@ -4,7 +4,7 @@ error: this looks like you are swapping elements of `foo` manually 11 | / let temp = foo[0]; 12 | | foo[0] = foo[1]; 13 | | foo[1] = temp; - | |_________________^ help: try `foo.swap(0, 1)` + | |_________________^ help: try: `foo.swap(0, 1)` | = note: `-D manual-swap` implied by `-D warnings` @@ -14,7 +14,7 @@ error: this looks like you are swapping elements of `foo` manually 20 | / let temp = foo[0]; 21 | | foo[0] = foo[1]; 22 | | foo[1] = temp; - | |_________________^ help: try `foo.swap(0, 1)` + | |_________________^ help: try: `foo.swap(0, 1)` error: this looks like you are swapping elements of `foo` manually --> swap.rs:29:5 @@ -22,7 +22,7 @@ error: this looks like you are swapping elements of `foo` manually 29 | / let temp = foo[0]; 30 | | foo[0] = foo[1]; 31 | | foo[1] = temp; - | |_________________^ help: try `foo.swap(0, 1)` + | |_________________^ help: try: `foo.swap(0, 1)` error: this looks like you are swapping `a` and `b` manually --> swap.rs:47:7 @@ -31,7 +31,7 @@ error: this looks like you are swapping `a` and `b` manually | _______^ 48 | | a = b; 49 | | b = t; - | |_________^ help: try `std::mem::swap(&mut a, &mut b)` + | |_________^ help: try: `std::mem::swap(&mut a, &mut b)` | = note: or maybe you should use `std::mem::replace`? @@ -42,7 +42,7 @@ error: this looks like you are swapping `c.0` and `a` manually | _______^ 57 | | c.0 = a; 58 | | a = t; - | |_________^ help: try `std::mem::swap(&mut c.0, &mut a)` + | |_________^ help: try: `std::mem::swap(&mut c.0, &mut a)` | = note: or maybe you should use `std::mem::replace`? @@ -51,7 +51,7 @@ error: this looks like you are trying to swap `a` and `b` | 44 | / a = b; 45 | | b = a; - | |_________^ help: try `std::mem::swap(&mut a, &mut b)` + | |_________^ help: try: `std::mem::swap(&mut a, &mut b)` | = note: `-D almost-swapped` implied by `-D warnings` = note: or maybe you should use `std::mem::replace`? @@ -61,7 +61,7 @@ error: this looks like you are trying to swap `c.0` and `a` | 53 | / c.0 = a; 54 | | a = c.0; - | |___________^ help: try `std::mem::swap(&mut c.0, &mut a)` + | |___________^ help: try: `std::mem::swap(&mut c.0, &mut a)` | = note: or maybe you should use `std::mem::replace`? diff --git a/clippy_tests/examples/toplevel_ref_arg.stderr b/clippy_tests/examples/toplevel_ref_arg.stderr index fd55e3901..59cb6448b 100644 --- a/clippy_tests/examples/toplevel_ref_arg.stderr +++ b/clippy_tests/examples/toplevel_ref_arg.stderr @@ -10,25 +10,25 @@ error: `ref` on an entire `let` pattern is discouraged, take a reference with `& --> toplevel_ref_arg.rs:18:7 | 18 | let ref x = 1; - | ----^^^^^----- help: try `let x = &1;` + | ----^^^^^----- help: try: `let x = &1;` error: `ref` on an entire `let` pattern is discouraged, take a reference with `&` instead --> toplevel_ref_arg.rs:20:7 | 20 | let ref y: (&_, u8) = (&1, 2); - | ----^^^^^--------------------- help: try `let y: &(&_, u8) = &(&1, 2);` + | ----^^^^^--------------------- help: try: `let y: &(&_, u8) = &(&1, 2);` error: `ref` on an entire `let` pattern is discouraged, take a reference with `&` instead --> toplevel_ref_arg.rs:22:7 | 22 | let ref z = 1 + 2; - | ----^^^^^--------- help: try `let z = &(1 + 2);` + | ----^^^^^--------- help: try: `let z = &(1 + 2);` error: `ref` on an entire `let` pattern is discouraged, take a reference with `&` instead --> toplevel_ref_arg.rs:24:7 | 24 | let ref mut z = 1 + 2; - | ----^^^^^^^^^--------- help: try `let z = &mut (1 + 2);` + | ----^^^^^^^^^--------- help: try: `let z = &mut (1 + 2);` error: aborting due to 5 previous errors diff --git a/clippy_tests/examples/vec.stderr b/clippy_tests/examples/vec.stderr index d4ad4b560..968e2ad8d 100644 --- a/clippy_tests/examples/vec.stderr +++ b/clippy_tests/examples/vec.stderr @@ -2,7 +2,7 @@ error: useless use of `vec!` --> vec.rs:24:14 | 24 | on_slice(&vec![]); - | ^^^^^^^ help: you can use a slice directly `&[]` + | ^^^^^^^ help: you can use a slice directly: `&[]` | = note: `-D useless-vec` implied by `-D warnings` @@ -10,31 +10,31 @@ error: useless use of `vec!` --> vec.rs:27:14 | 27 | on_slice(&vec![1, 2]); - | ^^^^^^^^^^^ help: you can use a slice directly `&[1, 2]` + | ^^^^^^^^^^^ help: you can use a slice directly: `&[1, 2]` error: useless use of `vec!` --> vec.rs:30:14 | 30 | on_slice(&vec ![1, 2]); - | ^^^^^^^^^^^^ help: you can use a slice directly `&[1, 2]` + | ^^^^^^^^^^^^ help: you can use a slice directly: `&[1, 2]` error: useless use of `vec!` --> vec.rs:33:14 | 33 | on_slice(&vec!(1, 2)); - | ^^^^^^^^^^^ help: you can use a slice directly `&[1, 2]` + | ^^^^^^^^^^^ help: you can use a slice directly: `&[1, 2]` error: useless use of `vec!` --> vec.rs:36:14 | 36 | on_slice(&vec![1; 2]); - | ^^^^^^^^^^^ help: you can use a slice directly `&[1; 2]` + | ^^^^^^^^^^^ help: you can use a slice directly: `&[1; 2]` error: useless use of `vec!` --> vec.rs:49:14 | 49 | for a in vec![1, 2, 3] { - | ^^^^^^^^^^^^^ help: you can use a slice directly `&[1, 2, 3]` + | ^^^^^^^^^^^^^ help: you can use a slice directly: `&[1, 2, 3]` error: aborting due to 6 previous errors diff --git a/clippy_tests/examples/while_loop.stderr b/clippy_tests/examples/while_loop.stderr index c41e42d9e..f84b55267 100644 --- a/clippy_tests/examples/while_loop.stderr +++ b/clippy_tests/examples/while_loop.stderr @@ -8,7 +8,7 @@ error: this loop could be written as a `while let` loop 13 | | break 14 | | } 15 | | } - | |_____^ help: try `while let Some(_x) = y { .. }` + | |_____^ help: try: `while let Some(_x) = y { .. }` | = note: `-D while-let-loop` implied by `-D warnings` @@ -21,7 +21,7 @@ error: this loop could be written as a `while let` loop 25 | | None => break 26 | | }; 27 | | } - | |_____^ help: try `while let Some(_x) = y { .. }` + | |_____^ help: try: `while let Some(_x) = y { .. }` error: this loop could be written as a `while let` loop --> while_loop.rs:28:5 @@ -33,7 +33,7 @@ error: this loop could be written as a `while let` loop ... | 34 | | let _str = "foo"; 35 | | } - | |_____^ help: try `while let Some(x) = y { .. }` + | |_____^ help: try: `while let Some(x) = y { .. }` error: this loop could be written as a `while let` loop --> while_loop.rs:36:5 @@ -45,7 +45,7 @@ error: this loop could be written as a `while let` loop ... | 42 | | { let _b = "foobar"; } 43 | | } - | |_____^ help: try `while let Some(x) = y { .. }` + | |_____^ help: try: `while let Some(x) = y { .. }` error: this loop could be written as a `while let` loop --> while_loop.rs:58:5 @@ -57,7 +57,7 @@ error: this loop could be written as a `while let` loop ... | 64 | | let _ = (e, l); 65 | | } - | |_____^ help: try `while let Some(word) = "".split_whitespace().next() { .. }` + | |_____^ help: try: `while let Some(word) = "".split_whitespace().next() { .. }` error: this loop could be written as a `for` loop --> while_loop.rs:68:5 @@ -65,7 +65,7 @@ error: this loop could be written as a `for` loop 68 | / while let Option::Some(x) = iter.next() { 69 | | println!("{}", x); 70 | | } - | |_____^ help: try `for x in iter { .. }` + | |_____^ help: try: `for x in iter { .. }` | = note: `-D while-let-on-iterator` implied by `-D warnings` @@ -75,13 +75,13 @@ error: this loop could be written as a `for` loop 73 | / while let Some(x) = iter.next() { 74 | | println!("{}", x); 75 | | } - | |_____^ help: try `for x in iter { .. }` + | |_____^ help: try: `for x in iter { .. }` error: this loop could be written as a `for` loop --> while_loop.rs:78:5 | 78 | while let Some(_) = iter.next() {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try `for _ in iter { .. }` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `for _ in iter { .. }` error: this loop could be written as a `while let` loop --> while_loop.rs:118:5 @@ -93,7 +93,7 @@ error: this loop could be written as a `while let` loop 122 | | }; 123 | | loop {} 124 | | } - | |_____^ help: try `while let Some(ele) = iter.next() { .. }` + | |_____^ help: try: `while let Some(ele) = iter.next() { .. }` error: empty `loop {}` detected. You may want to either use `panic!()` or add `std::thread::sleep(..);` to the loop body. --> while_loop.rs:123:9 diff --git a/tests/ui/transmute.stderr b/tests/ui/transmute.stderr index f878b6ad1..7a1e4e867 100644 --- a/tests/ui/transmute.stderr +++ b/tests/ui/transmute.stderr @@ -10,25 +10,25 @@ warning: transmute from a reference to a pointer --> $DIR/transmute.rs:26:23 | 26 | let _: *const T = core::intrinsics::transmute(t); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try `t as *const T` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `t as *const T` warning: transmute from a reference to a pointer --> $DIR/transmute.rs:28:21 | 28 | let _: *mut T = core::intrinsics::transmute(t); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try `t as *const T as *mut T` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `t as *const T as *mut T` warning: transmute from a reference to a pointer --> $DIR/transmute.rs:30:23 | 30 | let _: *const U = core::intrinsics::transmute(t); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try `t as *const T as *const U` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `t as *const T as *const U` warning: transmute from a pointer type (`*const T`) to a reference type (`&T`) --> $DIR/transmute.rs:35:17 | 35 | let _: &T = std::mem::transmute(p); - | ^^^^^^^^^^^^^^^^^^^^^^ help: try `&*p` + | ^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*p` | = note: #[warn(transmute_ptr_to_ref)] on by default @@ -36,55 +36,55 @@ warning: transmute from a pointer type (`*mut T`) to a reference type (`&mut T`) --> $DIR/transmute.rs:38:21 | 38 | let _: &mut T = std::mem::transmute(m); - | ^^^^^^^^^^^^^^^^^^^^^^ help: try `&mut *m` + | ^^^^^^^^^^^^^^^^^^^^^^ help: try: `&mut *m` warning: transmute from a pointer type (`*mut T`) to a reference type (`&T`) --> $DIR/transmute.rs:41:17 | 41 | let _: &T = std::mem::transmute(m); - | ^^^^^^^^^^^^^^^^^^^^^^ help: try `&*m` + | ^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*m` warning: transmute from a pointer type (`*mut T`) to a reference type (`&mut T`) --> $DIR/transmute.rs:44:21 | 44 | let _: &mut T = std::mem::transmute(p as *mut T); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try `&mut *(p as *mut T)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&mut *(p as *mut T)` warning: transmute from a pointer type (`*const U`) to a reference type (`&T`) --> $DIR/transmute.rs:47:17 | 47 | let _: &T = std::mem::transmute(o); - | ^^^^^^^^^^^^^^^^^^^^^^ help: try `&*(o as *const T)` + | ^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*(o as *const T)` warning: transmute from a pointer type (`*mut U`) to a reference type (`&mut T`) --> $DIR/transmute.rs:50:21 | 50 | let _: &mut T = std::mem::transmute(om); - | ^^^^^^^^^^^^^^^^^^^^^^^ help: try `&mut *(om as *mut T)` + | ^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&mut *(om as *mut T)` warning: transmute from a pointer type (`*mut U`) to a reference type (`&T`) --> $DIR/transmute.rs:53:17 | 53 | let _: &T = std::mem::transmute(om); - | ^^^^^^^^^^^^^^^^^^^^^^^ help: try `&*(om as *const T)` + | ^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*(om as *const T)` warning: transmute from a pointer type (`*const i32`) to a reference type (`&issue1231::Foo<'_, u8>`) --> $DIR/transmute.rs:64:32 | 64 | let _: &Foo = unsafe { std::mem::transmute::<_, &Foo<_>>(raw) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try `&*(raw as *const Foo<_>)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*(raw as *const Foo<_>)` warning: transmute from a pointer type (`*const i32`) to a reference type (`&issue1231::Foo<'_, &u8>`) --> $DIR/transmute.rs:66:33 | 66 | let _: &Foo<&u8> = unsafe { std::mem::transmute::<_, &Foo<&_>>(raw) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try `&*(raw as *const Foo<&_>)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*(raw as *const Foo<&_>)` warning: transmute from a pointer type (`*const i32`) to a reference type (`&u8`) --> $DIR/transmute.rs:70:14 | 70 | unsafe { std::mem::transmute::<_, Bar>(raw) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try `&*(raw as *const u8)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*(raw as *const u8)` warning: transmute from a type (`std::vec::Vec`) to itself --> $DIR/transmute.rs:76:27 @@ -120,13 +120,13 @@ warning: transmute from an integer to a pointer --> $DIR/transmute.rs:92:31 | 92 | let _: *const usize = std::mem::transmute(5_isize); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try `5_isize as *const usize` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `5_isize as *const usize` warning: transmute from an integer to a pointer --> $DIR/transmute.rs:96:31 | 96 | let _: *const usize = std::mem::transmute(1+1usize); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try `(1+1usize) as *const usize` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `(1+1usize) as *const usize` warning: transmute from a type (`*const Usize`) to the type that it points to (`Usize`) --> $DIR/transmute.rs:111:24