update test stderr

This commit is contained in:
Matthias Krüger 2018-12-10 06:27:19 +01:00
parent 435299be30
commit 7bcc2cd9c8
205 changed files with 5755 additions and 5461 deletions

View file

@ -28,6 +28,9 @@ cd clippy_dev && cargo test && cd ..
./util/dev update_lints --check
cargo +nightly fmt --all -- --check
#avoid loop spam
set +ex
# make sure tests are formatted
# some lints are sensitive to formatting, exclude some files
@ -36,7 +39,9 @@ for file in `find tests -not -path "tests/ui/methods.rs" -not -path "tests/ui/fo
rustfmt ${file} --check || echo "${file} needs reformatting!" ; needs_formatting=true
done
if $needs_reformatting
"Tests need reformatting!"
if [ "${needs_reformatting}" = true] ; then
echo "Tests need reformatting!"
exit 2
fi
set -ex

View file

@ -1,45 +1,45 @@
error: use of a blacklisted/placeholder name `toto`
--> $DIR/conf_french_blacklisted_name.rs:19:9
--> $DIR/conf_french_blacklisted_name.rs:15:9
|
19 | fn test(toto: ()) {}
15 | fn test(toto: ()) {}
| ^^^^
|
= note: `-D clippy::blacklisted-name` implied by `-D warnings`
error: use of a blacklisted/placeholder name `toto`
--> $DIR/conf_french_blacklisted_name.rs:22:9
--> $DIR/conf_french_blacklisted_name.rs:18:9
|
22 | let toto = 42;
18 | let toto = 42;
| ^^^^
error: use of a blacklisted/placeholder name `tata`
--> $DIR/conf_french_blacklisted_name.rs:23:9
--> $DIR/conf_french_blacklisted_name.rs:19:9
|
23 | let tata = 42;
19 | let tata = 42;
| ^^^^
error: use of a blacklisted/placeholder name `titi`
--> $DIR/conf_french_blacklisted_name.rs:24:9
--> $DIR/conf_french_blacklisted_name.rs:20:9
|
24 | let titi = 42;
20 | let titi = 42;
| ^^^^
error: use of a blacklisted/placeholder name `toto`
--> $DIR/conf_french_blacklisted_name.rs:30:10
--> $DIR/conf_french_blacklisted_name.rs:26:10
|
30 | (toto, Some(tata), titi @ Some(_)) => (),
26 | (toto, Some(tata), titi @ Some(_)) => (),
| ^^^^
error: use of a blacklisted/placeholder name `tata`
--> $DIR/conf_french_blacklisted_name.rs:30:21
--> $DIR/conf_french_blacklisted_name.rs:26:21
|
30 | (toto, Some(tata), titi @ Some(_)) => (),
26 | (toto, Some(tata), titi @ Some(_)) => (),
| ^^^^
error: use of a blacklisted/placeholder name `titi`
--> $DIR/conf_french_blacklisted_name.rs:30:28
--> $DIR/conf_french_blacklisted_name.rs:26:28
|
30 | (toto, Some(tata), titi @ Some(_)) => (),
26 | (toto, Some(tata), titi @ Some(_)) => (),
| ^^^^
error: aborting due to 7 previous errors

View file

@ -1,15 +1,15 @@
error: this argument is passed by reference, but would be more efficient if passed by value
--> $DIR/test.rs:23:11
--> $DIR/test.rs:20:11
|
23 | fn bad(x: &u16, y: &Foo) {
20 | fn bad(x: &u16, y: &Foo) {}
| ^^^^ help: consider passing by value instead: `u16`
|
= note: `-D clippy::trivially-copy-pass-by-ref` implied by `-D warnings`
error: this argument is passed by reference, but would be more efficient if passed by value
--> $DIR/test.rs:23:20
--> $DIR/test.rs:20:20
|
23 | fn bad(x: &u16, y: &Foo) {
20 | fn bad(x: &u16, y: &Foo) {}
| ^^^^ help: consider passing by value instead: `Foo`
error: aborting due to 2 previous errors

View file

@ -1,144 +1,144 @@
error: this comparison involving the minimum or maximum element for this type contains a case that is always true or always false
--> $DIR/absurd-extreme-comparisons.rs:17:5
--> $DIR/absurd-extreme-comparisons.rs:23:5
|
17 | u <= 0;
23 | u <= 0;
| ^^^^^^
|
= note: `-D clippy::absurd-extreme-comparisons` implied by `-D warnings`
= help: because 0 is the minimum value for this type, the case where the two sides are not equal never occurs, consider using u == 0 instead
error: this comparison involving the minimum or maximum element for this type contains a case that is always true or always false
--> $DIR/absurd-extreme-comparisons.rs:18:5
--> $DIR/absurd-extreme-comparisons.rs:24:5
|
18 | u <= Z;
24 | u <= Z;
| ^^^^^^
|
= help: because Z is the minimum value for this type, the case where the two sides are not equal never occurs, consider using u == Z instead
error: this comparison involving the minimum or maximum element for this type contains a case that is always true or always false
--> $DIR/absurd-extreme-comparisons.rs:19:5
--> $DIR/absurd-extreme-comparisons.rs:25:5
|
19 | u < Z;
25 | u < Z;
| ^^^^^
|
= help: because Z is the minimum value for this type, this comparison is always false
error: this comparison involving the minimum or maximum element for this type contains a case that is always true or always false
--> $DIR/absurd-extreme-comparisons.rs:20:5
--> $DIR/absurd-extreme-comparisons.rs:26:5
|
20 | Z >= u;
26 | Z >= u;
| ^^^^^^
|
= help: because Z is the minimum value for this type, the case where the two sides are not equal never occurs, consider using Z == u instead
error: this comparison involving the minimum or maximum element for this type contains a case that is always true or always false
--> $DIR/absurd-extreme-comparisons.rs:21:5
--> $DIR/absurd-extreme-comparisons.rs:27:5
|
21 | Z > u;
27 | Z > u;
| ^^^^^
|
= help: because Z is the minimum value for this type, this comparison is always false
error: this comparison involving the minimum or maximum element for this type contains a case that is always true or always false
--> $DIR/absurd-extreme-comparisons.rs:22:5
--> $DIR/absurd-extreme-comparisons.rs:28:5
|
22 | u > std::u32::MAX;
28 | u > std::u32::MAX;
| ^^^^^^^^^^^^^^^^^
|
= help: because std::u32::MAX is the maximum value for this type, this comparison is always false
error: this comparison involving the minimum or maximum element for this type contains a case that is always true or always false
--> $DIR/absurd-extreme-comparisons.rs:23:5
--> $DIR/absurd-extreme-comparisons.rs:29:5
|
23 | u >= std::u32::MAX;
29 | u >= std::u32::MAX;
| ^^^^^^^^^^^^^^^^^^
|
= help: because std::u32::MAX is the maximum value for this type, the case where the two sides are not equal never occurs, consider using u == std::u32::MAX instead
error: this comparison involving the minimum or maximum element for this type contains a case that is always true or always false
--> $DIR/absurd-extreme-comparisons.rs:24:5
--> $DIR/absurd-extreme-comparisons.rs:30:5
|
24 | std::u32::MAX < u;
30 | std::u32::MAX < u;
| ^^^^^^^^^^^^^^^^^
|
= help: because std::u32::MAX is the maximum value for this type, this comparison is always false
error: this comparison involving the minimum or maximum element for this type contains a case that is always true or always false
--> $DIR/absurd-extreme-comparisons.rs:25:5
--> $DIR/absurd-extreme-comparisons.rs:31:5
|
25 | std::u32::MAX <= u;
31 | std::u32::MAX <= u;
| ^^^^^^^^^^^^^^^^^^
|
= help: because std::u32::MAX is the maximum value for this type, the case where the two sides are not equal never occurs, consider using std::u32::MAX == u instead
error: this comparison involving the minimum or maximum element for this type contains a case that is always true or always false
--> $DIR/absurd-extreme-comparisons.rs:26:5
--> $DIR/absurd-extreme-comparisons.rs:32:5
|
26 | 1-1 > u;
32 | 1-1 > u;
| ^^^^^^^
|
= help: because 1-1 is the minimum value for this type, this comparison is always false
error: this comparison involving the minimum or maximum element for this type contains a case that is always true or always false
--> $DIR/absurd-extreme-comparisons.rs:27:5
--> $DIR/absurd-extreme-comparisons.rs:33:5
|
27 | u >= !0;
33 | u >= !0;
| ^^^^^^^
|
= help: because !0 is the maximum value for this type, the case where the two sides are not equal never occurs, consider using u == !0 instead
error: this comparison involving the minimum or maximum element for this type contains a case that is always true or always false
--> $DIR/absurd-extreme-comparisons.rs:28:5
--> $DIR/absurd-extreme-comparisons.rs:34:5
|
28 | u <= 12 - 2*6;
34 | u <= 12 - 2*6;
| ^^^^^^^^^^^^^
|
= help: because 12 - 2*6 is the minimum value for this type, the case where the two sides are not equal never occurs, consider using u == 12 - 2*6 instead
error: this comparison involving the minimum or maximum element for this type contains a case that is always true or always false
--> $DIR/absurd-extreme-comparisons.rs:30:5
--> $DIR/absurd-extreme-comparisons.rs:36:5
|
30 | i < -127 - 1;
36 | i < -127 - 1;
| ^^^^^^^^^^^^
|
= help: because -127 - 1 is the minimum value for this type, this comparison is always false
error: this comparison involving the minimum or maximum element for this type contains a case that is always true or always false
--> $DIR/absurd-extreme-comparisons.rs:31:5
--> $DIR/absurd-extreme-comparisons.rs:37:5
|
31 | std::i8::MAX >= i;
37 | std::i8::MAX >= i;
| ^^^^^^^^^^^^^^^^^
|
= help: because std::i8::MAX is the maximum value for this type, this comparison is always true
error: this comparison involving the minimum or maximum element for this type contains a case that is always true or always false
--> $DIR/absurd-extreme-comparisons.rs:32:5
--> $DIR/absurd-extreme-comparisons.rs:38:5
|
32 | 3-7 < std::i32::MIN;
38 | 3-7 < std::i32::MIN;
| ^^^^^^^^^^^^^^^^^^^
|
= help: because std::i32::MIN is the minimum value for this type, this comparison is always false
error: this comparison involving the minimum or maximum element for this type contains a case that is always true or always false
--> $DIR/absurd-extreme-comparisons.rs:34:5
--> $DIR/absurd-extreme-comparisons.rs:40:5
|
34 | b >= true;
40 | b >= true;
| ^^^^^^^^^
|
= help: because true is the maximum value for this type, the case where the two sides are not equal never occurs, consider using b == true instead
error: this comparison involving the minimum or maximum element for this type contains a case that is always true or always false
--> $DIR/absurd-extreme-comparisons.rs:35:5
--> $DIR/absurd-extreme-comparisons.rs:41:5
|
35 | false > b;
41 | false > b;
| ^^^^^^^^^
|
= help: because false is the minimum value for this type, this comparison is always false
error: <-comparison of unit values detected. This will always be false
--> $DIR/absurd-extreme-comparisons.rs:38:5
--> $DIR/absurd-extreme-comparisons.rs:44:5
|
38 | () < {};
44 | () < {};
| ^^^^^^^
|
= note: #[deny(clippy::unit_cmp)] on by default

View file

@ -1,117 +1,117 @@
error: approximate value of `f{32, 64}::consts::E` found. Consider using it directly
--> $DIR/approx_const.rs:17:16
--> $DIR/approx_const.rs:13:16
|
17 | let my_e = 2.7182;
13 | let my_e = 2.7182;
| ^^^^^^
|
= note: `-D clippy::approx-constant` implied by `-D warnings`
error: approximate value of `f{32, 64}::consts::E` found. Consider using it directly
--> $DIR/approx_const.rs:18:20
--> $DIR/approx_const.rs:14:20
|
18 | let almost_e = 2.718;
14 | let almost_e = 2.718;
| ^^^^^
error: approximate value of `f{32, 64}::consts::FRAC_1_PI` found. Consider using it directly
--> $DIR/approx_const.rs:21:24
--> $DIR/approx_const.rs:17:24
|
21 | let my_1_frac_pi = 0.3183;
17 | let my_1_frac_pi = 0.3183;
| ^^^^^^
error: approximate value of `f{32, 64}::consts::FRAC_1_SQRT_2` found. Consider using it directly
--> $DIR/approx_const.rs:24:28
--> $DIR/approx_const.rs:20:28
|
24 | let my_frac_1_sqrt_2 = 0.70710678;
20 | let my_frac_1_sqrt_2 = 0.70710678;
| ^^^^^^^^^^
error: approximate value of `f{32, 64}::consts::FRAC_1_SQRT_2` found. Consider using it directly
--> $DIR/approx_const.rs:25:32
--> $DIR/approx_const.rs:21:32
|
25 | let almost_frac_1_sqrt_2 = 0.70711;
21 | let almost_frac_1_sqrt_2 = 0.70711;
| ^^^^^^^
error: approximate value of `f{32, 64}::consts::FRAC_2_PI` found. Consider using it directly
--> $DIR/approx_const.rs:28:24
--> $DIR/approx_const.rs:24:24
|
28 | let my_frac_2_pi = 0.63661977;
24 | let my_frac_2_pi = 0.63661977;
| ^^^^^^^^^^
error: approximate value of `f{32, 64}::consts::FRAC_2_SQRT_PI` found. Consider using it directly
--> $DIR/approx_const.rs:31:27
--> $DIR/approx_const.rs:27:27
|
31 | let my_frac_2_sq_pi = 1.128379;
27 | let my_frac_2_sq_pi = 1.128379;
| ^^^^^^^^
error: approximate value of `f{32, 64}::consts::FRAC_PI_2` found. Consider using it directly
--> $DIR/approx_const.rs:34:24
--> $DIR/approx_const.rs:30:24
|
34 | let my_frac_pi_2 = 1.57079632679;
30 | let my_frac_pi_2 = 1.57079632679;
| ^^^^^^^^^^^^^
error: approximate value of `f{32, 64}::consts::FRAC_PI_3` found. Consider using it directly
--> $DIR/approx_const.rs:37:24
--> $DIR/approx_const.rs:33:24
|
37 | let my_frac_pi_3 = 1.04719755119;
33 | let my_frac_pi_3 = 1.04719755119;
| ^^^^^^^^^^^^^
error: approximate value of `f{32, 64}::consts::FRAC_PI_4` found. Consider using it directly
--> $DIR/approx_const.rs:40:24
--> $DIR/approx_const.rs:36:24
|
40 | let my_frac_pi_4 = 0.785398163397;
36 | let my_frac_pi_4 = 0.785398163397;
| ^^^^^^^^^^^^^^
error: approximate value of `f{32, 64}::consts::FRAC_PI_6` found. Consider using it directly
--> $DIR/approx_const.rs:43:24
--> $DIR/approx_const.rs:39:24
|
43 | let my_frac_pi_6 = 0.523598775598;
39 | let my_frac_pi_6 = 0.523598775598;
| ^^^^^^^^^^^^^^
error: approximate value of `f{32, 64}::consts::FRAC_PI_8` found. Consider using it directly
--> $DIR/approx_const.rs:46:24
--> $DIR/approx_const.rs:42:24
|
46 | let my_frac_pi_8 = 0.3926990816987;
42 | let my_frac_pi_8 = 0.3926990816987;
| ^^^^^^^^^^^^^^^
error: approximate value of `f{32, 64}::consts::LN_10` found. Consider using it directly
--> $DIR/approx_const.rs:49:20
--> $DIR/approx_const.rs:45:20
|
49 | let my_ln_10 = 2.302585092994046;
45 | let my_ln_10 = 2.302585092994046;
| ^^^^^^^^^^^^^^^^^
error: approximate value of `f{32, 64}::consts::LN_2` found. Consider using it directly
--> $DIR/approx_const.rs:52:19
--> $DIR/approx_const.rs:48:19
|
52 | let my_ln_2 = 0.6931471805599453;
48 | let my_ln_2 = 0.6931471805599453;
| ^^^^^^^^^^^^^^^^^^
error: approximate value of `f{32, 64}::consts::LOG10_E` found. Consider using it directly
--> $DIR/approx_const.rs:55:22
--> $DIR/approx_const.rs:51:22
|
55 | let my_log10_e = 0.4342944819032518;
51 | let my_log10_e = 0.4342944819032518;
| ^^^^^^^^^^^^^^^^^^
error: approximate value of `f{32, 64}::consts::LOG2_E` found. Consider using it directly
--> $DIR/approx_const.rs:58:21
--> $DIR/approx_const.rs:54:21
|
58 | let my_log2_e = 1.4426950408889634;
54 | let my_log2_e = 1.4426950408889634;
| ^^^^^^^^^^^^^^^^^^
error: approximate value of `f{32, 64}::consts::PI` found. Consider using it directly
--> $DIR/approx_const.rs:61:17
--> $DIR/approx_const.rs:57:17
|
61 | let my_pi = 3.1415;
57 | let my_pi = 3.1415;
| ^^^^^^
error: approximate value of `f{32, 64}::consts::PI` found. Consider using it directly
--> $DIR/approx_const.rs:62:21
--> $DIR/approx_const.rs:58:21
|
62 | let almost_pi = 3.14;
58 | let almost_pi = 3.14;
| ^^^^
error: approximate value of `f{32, 64}::consts::SQRT_2` found. Consider using it directly
--> $DIR/approx_const.rs:65:18
--> $DIR/approx_const.rs:61:18
|
65 | let my_sq2 = 1.4142;
61 | let my_sq2 = 1.4142;
| ^^^^^^
error: aborting due to 19 previous errors

View file

@ -1,72 +1,72 @@
error: integer arithmetic detected
--> $DIR/arithmetic.rs:17:5
--> $DIR/arithmetic.rs:22:5
|
17 | 1 + i;
22 | 1 + i;
| ^^^^^
|
= note: `-D clippy::integer-arithmetic` implied by `-D warnings`
error: integer arithmetic detected
--> $DIR/arithmetic.rs:18:5
--> $DIR/arithmetic.rs:23:5
|
18 | i * 2;
23 | i * 2;
| ^^^^^
error: integer arithmetic detected
--> $DIR/arithmetic.rs:19:5
--> $DIR/arithmetic.rs:24:5
|
19 | / 1 %
20 | | i / 2; // no error, this is part of the expression in the preceding line
24 | / 1 %
25 | | i / 2; // no error, this is part of the expression in the preceding line
| |_________^
error: integer arithmetic detected
--> $DIR/arithmetic.rs:21:5
--> $DIR/arithmetic.rs:26:5
|
21 | i - 2 + 2 - i;
26 | i - 2 + 2 - i;
| ^^^^^^^^^^^^^
error: integer arithmetic detected
--> $DIR/arithmetic.rs:22:5
--> $DIR/arithmetic.rs:27:5
|
22 | -i;
27 | -i;
| ^^
error: floating-point arithmetic detected
--> $DIR/arithmetic.rs:32:5
--> $DIR/arithmetic.rs:37:5
|
32 | f * 2.0;
37 | f * 2.0;
| ^^^^^^^
|
= note: `-D clippy::float-arithmetic` implied by `-D warnings`
error: floating-point arithmetic detected
--> $DIR/arithmetic.rs:34:5
--> $DIR/arithmetic.rs:39:5
|
34 | 1.0 + f;
39 | 1.0 + f;
| ^^^^^^^
error: floating-point arithmetic detected
--> $DIR/arithmetic.rs:35:5
--> $DIR/arithmetic.rs:40:5
|
35 | f * 2.0;
40 | f * 2.0;
| ^^^^^^^
error: floating-point arithmetic detected
--> $DIR/arithmetic.rs:36:5
--> $DIR/arithmetic.rs:41:5
|
36 | f / 2.0;
41 | f / 2.0;
| ^^^^^^^
error: floating-point arithmetic detected
--> $DIR/arithmetic.rs:37:5
--> $DIR/arithmetic.rs:42:5
|
37 | f - 2.0 * 4.2;
42 | f - 2.0 * 4.2;
| ^^^^^^^^^^^^^
error: floating-point arithmetic detected
--> $DIR/arithmetic.rs:38:5
--> $DIR/arithmetic.rs:43:5
|
38 | -f;
43 | -f;
| ^^
error: aborting due to 11 previous errors

View file

@ -1,57 +1,57 @@
error: manual implementation of an assign operation
--> $DIR/assign_ops.rs:17:5
--> $DIR/assign_ops.rs:14:5
|
17 | a = a + 1;
14 | a = a + 1;
| ^^^^^^^^^ help: replace it with: `a += 1`
|
= note: `-D clippy::assign-op-pattern` implied by `-D warnings`
error: manual implementation of an assign operation
--> $DIR/assign_ops.rs:15:5
|
15 | a = 1 + a;
| ^^^^^^^^^ help: replace it with: `a += 1`
error: manual implementation of an assign operation
--> $DIR/assign_ops.rs:16:5
|
16 | a = a - 1;
| ^^^^^^^^^ help: replace it with: `a -= 1`
error: manual implementation of an assign operation
--> $DIR/assign_ops.rs:17:5
|
17 | a = a * 99;
| ^^^^^^^^^^ help: replace it with: `a *= 99`
error: manual implementation of an assign operation
--> $DIR/assign_ops.rs:18:5
|
18 | a = 1 + a;
| ^^^^^^^^^ help: replace it with: `a += 1`
18 | a = 42 * a;
| ^^^^^^^^^^ help: replace it with: `a *= 42`
error: manual implementation of an assign operation
--> $DIR/assign_ops.rs:19:5
|
19 | a = a - 1;
| ^^^^^^^^^ help: replace it with: `a -= 1`
19 | a = a / 2;
| ^^^^^^^^^ help: replace it with: `a /= 2`
error: manual implementation of an assign operation
--> $DIR/assign_ops.rs:20:5
|
20 | a = a * 99;
| ^^^^^^^^^^ help: replace it with: `a *= 99`
20 | a = a % 5;
| ^^^^^^^^^ help: replace it with: `a %= 5`
error: manual implementation of an assign operation
--> $DIR/assign_ops.rs:21:5
|
21 | a = 42 * a;
| ^^^^^^^^^^ help: replace it with: `a *= 42`
error: manual implementation of an assign operation
--> $DIR/assign_ops.rs:22:5
|
22 | a = a / 2;
| ^^^^^^^^^ help: replace it with: `a /= 2`
error: manual implementation of an assign operation
--> $DIR/assign_ops.rs:23:5
|
23 | a = a % 5;
| ^^^^^^^^^ help: replace it with: `a %= 5`
error: manual implementation of an assign operation
--> $DIR/assign_ops.rs:24:5
|
24 | a = a & 1;
21 | a = a & 1;
| ^^^^^^^^^ help: replace it with: `a &= 1`
error: manual implementation of an assign operation
--> $DIR/assign_ops.rs:30:5
--> $DIR/assign_ops.rs:27:5
|
30 | s = s + "bla";
27 | s = s + "bla";
| ^^^^^^^^^^^^^ help: replace it with: `s += "bla"`
error: aborting due to 9 previous errors

View file

@ -1,135 +1,135 @@
error: variable appears on both sides of an assignment operation
--> $DIR/assign_ops2.rs:18:5
--> $DIR/assign_ops2.rs:14:5
|
18 | a += a + 1;
14 | a += a + 1;
| ^^^^^^^^^^
|
= note: `-D clippy::misrefactored-assign-op` implied by `-D warnings`
help: Did you mean a = a + 1 or a = a + a + 1? Consider replacing it with
|
18 | a += 1;
14 | a += 1;
| ^^^^^^
help: or
|
18 | a = a + a + 1;
14 | a = a + a + 1;
| ^^^^^^^^^^^^^
error: variable appears on both sides of an assignment operation
--> $DIR/assign_ops2.rs:15:5
|
15 | a += 1 + a;
| ^^^^^^^^^^
help: Did you mean a = a + 1 or a = a + 1 + a? Consider replacing it with
|
15 | a += 1;
| ^^^^^^
help: or
|
15 | a = a + 1 + a;
| ^^^^^^^^^^^^^
error: variable appears on both sides of an assignment operation
--> $DIR/assign_ops2.rs:16:5
|
16 | a -= a - 1;
| ^^^^^^^^^^
help: Did you mean a = a - 1 or a = a - (a - 1)? Consider replacing it with
|
16 | a -= 1;
| ^^^^^^
help: or
|
16 | a = a - (a - 1);
| ^^^^^^^^^^^^^^^
error: variable appears on both sides of an assignment operation
--> $DIR/assign_ops2.rs:17:5
|
17 | a *= a * 99;
| ^^^^^^^^^^^
help: Did you mean a = a * 99 or a = a * a * 99? Consider replacing it with
|
17 | a *= 99;
| ^^^^^^^
help: or
|
17 | a = a * a * 99;
| ^^^^^^^^^^^^^^
error: variable appears on both sides of an assignment operation
--> $DIR/assign_ops2.rs:18:5
|
18 | a *= 42 * a;
| ^^^^^^^^^^^
help: Did you mean a = a * 42 or a = a * 42 * a? Consider replacing it with
|
18 | a *= 42;
| ^^^^^^^
help: or
|
18 | a = a * 42 * a;
| ^^^^^^^^^^^^^^
error: variable appears on both sides of an assignment operation
--> $DIR/assign_ops2.rs:19:5
|
19 | a += 1 + a;
19 | a /= a / 2;
| ^^^^^^^^^^
help: Did you mean a = a + 1 or a = a + 1 + a? Consider replacing it with
help: Did you mean a = a / 2 or a = a / (a / 2)? Consider replacing it with
|
19 | a += 1;
19 | a /= 2;
| ^^^^^^
help: or
|
19 | a = a + 1 + a;
| ^^^^^^^^^^^^^
19 | a = a / (a / 2);
| ^^^^^^^^^^^^^^^
error: variable appears on both sides of an assignment operation
--> $DIR/assign_ops2.rs:20:5
|
20 | a -= a - 1;
20 | a %= a % 5;
| ^^^^^^^^^^
help: Did you mean a = a - 1 or a = a - (a - 1)? Consider replacing it with
help: Did you mean a = a % 5 or a = a % (a % 5)? Consider replacing it with
|
20 | a -= 1;
20 | a %= 5;
| ^^^^^^
help: or
|
20 | a = a - (a - 1);
20 | a = a % (a % 5);
| ^^^^^^^^^^^^^^^
error: variable appears on both sides of an assignment operation
--> $DIR/assign_ops2.rs:21:5
|
21 | a *= a * 99;
| ^^^^^^^^^^^
help: Did you mean a = a * 99 or a = a * a * 99? Consider replacing it with
21 | a &= a & 1;
| ^^^^^^^^^^
help: Did you mean a = a & 1 or a = a & a & 1? Consider replacing it with
|
21 | a *= 99;
| ^^^^^^^
21 | a &= 1;
| ^^^^^^
help: or
|
21 | a = a * a * 99;
| ^^^^^^^^^^^^^^
21 | a = a & a & 1;
| ^^^^^^^^^^^^^
error: variable appears on both sides of an assignment operation
--> $DIR/assign_ops2.rs:22:5
|
22 | a *= 42 * a;
| ^^^^^^^^^^^
help: Did you mean a = a * 42 or a = a * 42 * a? Consider replacing it with
|
22 | a *= 42;
| ^^^^^^^
help: or
|
22 | a = a * 42 * a;
| ^^^^^^^^^^^^^^
error: variable appears on both sides of an assignment operation
--> $DIR/assign_ops2.rs:23:5
|
23 | a /= a / 2;
| ^^^^^^^^^^
help: Did you mean a = a / 2 or a = a / (a / 2)? Consider replacing it with
|
23 | a /= 2;
| ^^^^^^
help: or
|
23 | a = a / (a / 2);
| ^^^^^^^^^^^^^^^
error: variable appears on both sides of an assignment operation
--> $DIR/assign_ops2.rs:24:5
|
24 | a %= a % 5;
| ^^^^^^^^^^
help: Did you mean a = a % 5 or a = a % (a % 5)? Consider replacing it with
|
24 | a %= 5;
| ^^^^^^
help: or
|
24 | a = a % (a % 5);
| ^^^^^^^^^^^^^^^
error: variable appears on both sides of an assignment operation
--> $DIR/assign_ops2.rs:25:5
|
25 | a &= a & 1;
| ^^^^^^^^^^
help: Did you mean a = a & 1 or a = a & a & 1? Consider replacing it with
|
25 | a &= 1;
| ^^^^^^
help: or
|
25 | a = a & a & 1;
| ^^^^^^^^^^^^^
error: variable appears on both sides of an assignment operation
--> $DIR/assign_ops2.rs:26:5
|
26 | a *= a * a;
22 | a *= a * a;
| ^^^^^^^^^^
help: Did you mean a = a * a or a = a * a * a? Consider replacing it with
|
26 | a *= a;
22 | a *= a;
| ^^^^^^
help: or
|
26 | a = a * a * a;
22 | a = a * a * a;
| ^^^^^^^^^^^^^
error: manual implementation of an assign operation
--> $DIR/assign_ops2.rs:63:5
--> $DIR/assign_ops2.rs:59:5
|
63 | buf = buf + cows.clone();
59 | buf = buf + cows.clone();
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `buf += cows.clone()`
|
= note: `-D clippy::assign-op-pattern` implied by `-D warnings`

View file

@ -1,23 +1,23 @@
error: you have declared `#[inline(always)]` on `test_attr_lint`. This is usually a bad idea
--> $DIR/attrs.rs:16:1
--> $DIR/attrs.rs:12:1
|
16 | #[inline(always)]
12 | #[inline(always)]
| ^^^^^^^^^^^^^^^^^
|
= note: `-D clippy::inline-always` implied by `-D warnings`
error: the since field must contain a semver-compliant version
--> $DIR/attrs.rs:37:14
--> $DIR/attrs.rs:32:14
|
37 | #[deprecated(since = "forever")]
32 | #[deprecated(since = "forever")]
| ^^^^^^^^^^^^^^^^^
|
= note: `-D clippy::deprecated-semver` implied by `-D warnings`
error: the since field must contain a semver-compliant version
--> $DIR/attrs.rs:40:14
--> $DIR/attrs.rs:35:14
|
40 | #[deprecated(since = "1")]
35 | #[deprecated(since = "1")]
| ^^^^^^^^^^^
error: aborting due to 3 previous errors

View file

@ -1,14 +1,14 @@
error: returning the result of a let binding from a block. Consider returning the expression directly.
--> $DIR/matches.rs:19:13
--> $DIR/matches.rs:18:13
|
19 | x
18 | x
| ^
|
= note: `-D clippy::let-and-return` implied by `-D warnings`
note: this expression can be directly returned
--> $DIR/matches.rs:18:21
--> $DIR/matches.rs:17:21
|
18 | let x = 3;
17 | let x = 3;
| ^
error: aborting due to previous error

View file

@ -1,109 +1,109 @@
error: &-masking with zero
--> $DIR/bit_masks.rs:22:5
--> $DIR/bit_masks.rs:23:5
|
22 | x & 0 == 0;
23 | x & 0 == 0;
| ^^^^^^^^^^
|
= note: `-D clippy::bad-bit-mask` implied by `-D warnings`
error: this operation will always return zero. This is likely not the intended outcome
--> $DIR/bit_masks.rs:22:5
--> $DIR/bit_masks.rs:23:5
|
22 | x & 0 == 0;
23 | x & 0 == 0;
| ^^^^^
|
= note: #[deny(clippy::erasing_op)] on by default
error: incompatible bit mask: `_ & 2` can never be equal to `1`
--> $DIR/bit_masks.rs:25:5
--> $DIR/bit_masks.rs:26:5
|
25 | x & 2 == 1;
26 | x & 2 == 1;
| ^^^^^^^^^^
error: incompatible bit mask: `_ | 3` can never be equal to `2`
--> $DIR/bit_masks.rs:29:5
--> $DIR/bit_masks.rs:30:5
|
29 | x | 3 == 2;
30 | x | 3 == 2;
| ^^^^^^^^^^
error: incompatible bit mask: `_ & 1` will never be higher than `1`
--> $DIR/bit_masks.rs:31:5
--> $DIR/bit_masks.rs:32:5
|
31 | x & 1 > 1;
32 | x & 1 > 1;
| ^^^^^^^^^
error: incompatible bit mask: `_ | 2` will always be higher than `1`
--> $DIR/bit_masks.rs:35:5
--> $DIR/bit_masks.rs:36:5
|
35 | x | 2 > 1;
36 | x | 2 > 1;
| ^^^^^^^^^
error: incompatible bit mask: `_ & 7` can never be equal to `8`
--> $DIR/bit_masks.rs:42:5
--> $DIR/bit_masks.rs:43:5
|
42 | x & THREE_BITS == 8;
43 | x & THREE_BITS == 8;
| ^^^^^^^^^^^^^^^^^^^
error: incompatible bit mask: `_ | 7` will never be lower than `7`
--> $DIR/bit_masks.rs:43:5
--> $DIR/bit_masks.rs:44:5
|
43 | x | EVEN_MORE_REDIRECTION < 7;
44 | x | EVEN_MORE_REDIRECTION < 7;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: &-masking with zero
--> $DIR/bit_masks.rs:45:5
--> $DIR/bit_masks.rs:46:5
|
45 | 0 & x == 0;
46 | 0 & x == 0;
| ^^^^^^^^^^
error: this operation will always return zero. This is likely not the intended outcome
--> $DIR/bit_masks.rs:45:5
--> $DIR/bit_masks.rs:46:5
|
45 | 0 & x == 0;
46 | 0 & x == 0;
| ^^^^^
error: incompatible bit mask: `_ | 2` will always be higher than `1`
--> $DIR/bit_masks.rs:49:5
--> $DIR/bit_masks.rs:50:5
|
49 | 1 < 2 | x;
50 | 1 < 2 | x;
| ^^^^^^^^^
error: incompatible bit mask: `_ | 3` can never be equal to `2`
--> $DIR/bit_masks.rs:50:5
--> $DIR/bit_masks.rs:51:5
|
50 | 2 == 3 | x;
51 | 2 == 3 | x;
| ^^^^^^^^^^
error: incompatible bit mask: `_ & 2` can never be equal to `1`
--> $DIR/bit_masks.rs:51:5
--> $DIR/bit_masks.rs:52:5
|
51 | 1 == x & 2;
52 | 1 == x & 2;
| ^^^^^^^^^^
error: ineffective bit mask: `x | 1` compared to `3`, is the same as x compared directly
--> $DIR/bit_masks.rs:62:5
--> $DIR/bit_masks.rs:63:5
|
62 | x | 1 > 3;
63 | x | 1 > 3;
| ^^^^^^^^^
|
= note: `-D clippy::ineffective-bit-mask` implied by `-D warnings`
error: ineffective bit mask: `x | 1` compared to `4`, is the same as x compared directly
--> $DIR/bit_masks.rs:63:5
--> $DIR/bit_masks.rs:64:5
|
63 | x | 1 < 4;
64 | x | 1 < 4;
| ^^^^^^^^^
error: ineffective bit mask: `x | 1` compared to `3`, is the same as x compared directly
--> $DIR/bit_masks.rs:64:5
--> $DIR/bit_masks.rs:65:5
|
64 | x | 1 <= 3;
65 | x | 1 <= 3;
| ^^^^^^^^^^
error: ineffective bit mask: `x | 1` compared to `8`, is the same as x compared directly
--> $DIR/bit_masks.rs:65:5
--> $DIR/bit_masks.rs:66:5
|
65 | x | 1 >= 8;
66 | x | 1 >= 8;
| ^^^^^^^^^^
error: aborting due to 17 previous errors

View file

@ -1,87 +1,87 @@
error: use of a blacklisted/placeholder name `foo`
--> $DIR/blacklisted_name.rs:17:9
--> $DIR/blacklisted_name.rs:20:9
|
17 | fn test(foo: ()) {}
20 | fn test(foo: ()) {}
| ^^^
|
= note: `-D clippy::blacklisted-name` implied by `-D warnings`
error: use of a blacklisted/placeholder name `foo`
--> $DIR/blacklisted_name.rs:20:9
--> $DIR/blacklisted_name.rs:23:9
|
20 | let foo = 42;
23 | let foo = 42;
| ^^^
error: use of a blacklisted/placeholder name `bar`
--> $DIR/blacklisted_name.rs:21:9
--> $DIR/blacklisted_name.rs:24:9
|
21 | let bar = 42;
24 | let bar = 42;
| ^^^
error: use of a blacklisted/placeholder name `baz`
--> $DIR/blacklisted_name.rs:22:9
--> $DIR/blacklisted_name.rs:25:9
|
22 | let baz = 42;
25 | let baz = 42;
| ^^^
error: use of a blacklisted/placeholder name `foo`
--> $DIR/blacklisted_name.rs:28:10
--> $DIR/blacklisted_name.rs:31:10
|
28 | (foo, Some(bar), baz @ Some(_)) => (),
31 | (foo, Some(bar), baz @ Some(_)) => (),
| ^^^
error: use of a blacklisted/placeholder name `bar`
--> $DIR/blacklisted_name.rs:28:20
--> $DIR/blacklisted_name.rs:31:20
|
28 | (foo, Some(bar), baz @ Some(_)) => (),
31 | (foo, Some(bar), baz @ Some(_)) => (),
| ^^^
error: use of a blacklisted/placeholder name `baz`
--> $DIR/blacklisted_name.rs:28:26
--> $DIR/blacklisted_name.rs:31:26
|
28 | (foo, Some(bar), baz @ Some(_)) => (),
31 | (foo, Some(bar), baz @ Some(_)) => (),
| ^^^
error: use of a blacklisted/placeholder name `foo`
--> $DIR/blacklisted_name.rs:33:19
--> $DIR/blacklisted_name.rs:36:19
|
33 | fn issue_1647(mut foo: u8) {
36 | fn issue_1647(mut foo: u8) {
| ^^^
error: use of a blacklisted/placeholder name `bar`
--> $DIR/blacklisted_name.rs:34:13
--> $DIR/blacklisted_name.rs:37:13
|
34 | let mut bar = 0;
37 | let mut bar = 0;
| ^^^
error: use of a blacklisted/placeholder name `baz`
--> $DIR/blacklisted_name.rs:35:21
--> $DIR/blacklisted_name.rs:38:21
|
35 | if let Some(mut baz) = Some(42) {}
38 | if let Some(mut baz) = Some(42) {}
| ^^^
error: use of a blacklisted/placeholder name `bar`
--> $DIR/blacklisted_name.rs:39:13
--> $DIR/blacklisted_name.rs:42:13
|
39 | let ref bar = 0;
42 | let ref bar = 0;
| ^^^
error: use of a blacklisted/placeholder name `baz`
--> $DIR/blacklisted_name.rs:40:21
--> $DIR/blacklisted_name.rs:43:21
|
40 | if let Some(ref baz) = Some(42) {}
43 | if let Some(ref baz) = Some(42) {}
| ^^^
error: use of a blacklisted/placeholder name `bar`
--> $DIR/blacklisted_name.rs:44:17
--> $DIR/blacklisted_name.rs:47:17
|
44 | let ref mut bar = 0;
47 | let ref mut bar = 0;
| ^^^
error: use of a blacklisted/placeholder name `baz`
--> $DIR/blacklisted_name.rs:45:25
--> $DIR/blacklisted_name.rs:48:25
|
45 | if let Some(ref mut baz) = Some(42) {}
48 | if let Some(ref mut baz) = Some(42) {}
| ^^^
error: aborting due to 14 previous errors

View file

@ -1,11 +1,11 @@
error: in an 'if' condition, avoid complex blocks or closures with blocks; instead, move the block or closure higher and bind it with a 'let'
--> $DIR/block_in_if_condition.rs:40:8
--> $DIR/block_in_if_condition.rs:35:8
|
40 | if {
35 | if {
| ________^
41 | | let x = 3;
42 | | x == 3
43 | | } {
36 | | let x = 3;
37 | | x == 3
38 | | } {
| |_____^
|
= note: `-D clippy::block-in-if-condition-stmt` implied by `-D warnings`
@ -19,9 +19,9 @@ error: in an 'if' condition, avoid complex blocks or closures with blocks; inste
} ...
error: omit braces around single expression condition
--> $DIR/block_in_if_condition.rs:51:8
--> $DIR/block_in_if_condition.rs:46:8
|
51 | if { true } {
46 | if { true } {
| ^^^^^^^^
|
= note: `-D clippy::block-in-if-condition-expr` implied by `-D warnings`
@ -31,21 +31,29 @@ error: omit braces around single expression condition
} ...
error: in an 'if' condition, avoid complex blocks or closures with blocks; instead, move the block or closure higher and bind it with a 'let'
--> $DIR/block_in_if_condition.rs:68:49
--> $DIR/block_in_if_condition.rs:66:17
|
68 | if v == 3 && sky == "blue" && predicate(|x| { let target = 3; x == target }, v) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
66 | |x| {
| _________________^
67 | | let target = 3;
68 | | x == target
69 | | },
| |_____________^
error: in an 'if' condition, avoid complex blocks or closures with blocks; instead, move the block or closure higher and bind it with a 'let'
--> $DIR/block_in_if_condition.rs:71:22
--> $DIR/block_in_if_condition.rs:75:13
|
71 | if predicate(|x| { let target = 3; x == target }, v) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
75 | |x| {
| _____________^
76 | | let target = 3;
77 | | x == target
78 | | },
| |_________^
error: this boolean expression can be simplified
--> $DIR/block_in_if_condition.rs:77:8
--> $DIR/block_in_if_condition.rs:85:8
|
77 | if true && x == 3 {
85 | if true && x == 3 {
| ^^^^^^^^^^^^^^ help: try: `x == 3`
|
= note: `-D clippy::nonminimal-bool` implied by `-D warnings`

View file

@ -1,7 +1,7 @@
error: equality checks against true are unnecessary
--> $DIR/bool_comparison.rs:17:8
--> $DIR/bool_comparison.rs:13:8
|
17 | if x == true { "yes" } else { "no" };
13 | if x == true {
| ^^^^^^^^^ help: try simplifying it as shown: `x`
|
= note: `-D clippy::bool-comparison` implied by `-D warnings`
@ -9,43 +9,43 @@ error: equality checks against true are unnecessary
error: equality checks against false can be replaced by a negation
--> $DIR/bool_comparison.rs:18:8
|
18 | if x == false { "yes" } else { "no" };
18 | if x == false {
| ^^^^^^^^^^ help: try simplifying it as shown: `!x`
error: equality checks against true are unnecessary
--> $DIR/bool_comparison.rs:19:8
--> $DIR/bool_comparison.rs:23:8
|
19 | if true == x { "yes" } else { "no" };
23 | if true == x {
| ^^^^^^^^^ help: try simplifying it as shown: `x`
error: equality checks against false can be replaced by a negation
--> $DIR/bool_comparison.rs:20:8
--> $DIR/bool_comparison.rs:28:8
|
20 | if false == x { "yes" } else { "no" };
28 | if false == x {
| ^^^^^^^^^^ help: try simplifying it as shown: `!x`
error: inequality checks against true can be replaced by a negation
--> $DIR/bool_comparison.rs:21:8
--> $DIR/bool_comparison.rs:33:8
|
21 | if x != true { "yes" } else { "no" };
33 | if x != true {
| ^^^^^^^^^ help: try simplifying it as shown: `!x`
error: inequality checks against false are unnecessary
--> $DIR/bool_comparison.rs:22:8
--> $DIR/bool_comparison.rs:38:8
|
22 | if x != false { "yes" } else { "no" };
38 | if x != false {
| ^^^^^^^^^^ help: try simplifying it as shown: `x`
error: inequality checks against true can be replaced by a negation
--> $DIR/bool_comparison.rs:23:8
--> $DIR/bool_comparison.rs:43:8
|
23 | if true != x { "yes" } else { "no" };
43 | if true != x {
| ^^^^^^^^^ help: try simplifying it as shown: `!x`
error: inequality checks against false are unnecessary
--> $DIR/bool_comparison.rs:24:8
--> $DIR/bool_comparison.rs:48:8
|
24 | if false != x { "yes" } else { "no" };
48 | if false != x {
| ^^^^^^^^^^ help: try simplifying it as shown: `x`
error: aborting due to 8 previous errors

View file

@ -1,202 +1,202 @@
error: this boolean expression contains a logic bug
--> $DIR/booleans.rs:22:13
--> $DIR/booleans.rs:19:13
|
22 | let _ = a && b || a;
19 | let _ = a && b || a;
| ^^^^^^^^^^^ help: it would look like the following: `a`
|
= note: `-D clippy::logic-bug` implied by `-D warnings`
help: this expression can be optimized out by applying boolean operations to the outer expression
--> $DIR/booleans.rs:22:18
--> $DIR/booleans.rs:19:18
|
22 | let _ = a && b || a;
19 | let _ = a && b || a;
| ^
error: this boolean expression can be simplified
--> $DIR/booleans.rs:24:13
--> $DIR/booleans.rs:21:13
|
24 | let _ = !true;
21 | let _ = !true;
| ^^^^^ help: try: `false`
|
= note: `-D clippy::nonminimal-bool` implied by `-D warnings`
error: this boolean expression can be simplified
--> $DIR/booleans.rs:25:13
--> $DIR/booleans.rs:22:13
|
25 | let _ = !false;
22 | let _ = !false;
| ^^^^^^ help: try: `true`
error: this boolean expression can be simplified
--> $DIR/booleans.rs:26:13
--> $DIR/booleans.rs:23:13
|
26 | let _ = !!a;
23 | let _ = !!a;
| ^^^ help: try: `a`
error: this boolean expression contains a logic bug
--> $DIR/booleans.rs:27:13
--> $DIR/booleans.rs:24:13
|
27 | let _ = false && a;
24 | let _ = false && a;
| ^^^^^^^^^^ help: it would look like the following: `false`
|
help: this expression can be optimized out by applying boolean operations to the outer expression
--> $DIR/booleans.rs:27:22
--> $DIR/booleans.rs:24:22
|
27 | let _ = false && a;
24 | let _ = false && a;
| ^
error: this boolean expression can be simplified
--> $DIR/booleans.rs:28:13
--> $DIR/booleans.rs:25:13
|
28 | let _ = false || a;
25 | let _ = false || a;
| ^^^^^^^^^^ help: try: `a`
error: this boolean expression can be simplified
--> $DIR/booleans.rs:33:13
--> $DIR/booleans.rs:30:13
|
33 | let _ = !(!a && b);
30 | let _ = !(!a && b);
| ^^^^^^^^^^ help: try: `!b || a`
error: this boolean expression contains a logic bug
--> $DIR/booleans.rs:43:13
--> $DIR/booleans.rs:40:13
|
43 | let _ = a == b && a != b;
40 | let _ = a == b && a != b;
| ^^^^^^^^^^^^^^^^ help: it would look like the following: `false`
|
help: this expression can be optimized out by applying boolean operations to the outer expression
--> $DIR/booleans.rs:43:13
--> $DIR/booleans.rs:40:13
|
43 | let _ = a == b && a != b;
40 | let _ = a == b && a != b;
| ^^^^^^
error: this boolean expression can be simplified
--> $DIR/booleans.rs:41:13
|
41 | let _ = a == b && c == 5 && a == b;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
help: try
|
41 | let _ = a == b && c == 5;
| ^^^^^^^^^^^^^^^^
41 | let _ = !(c != 5 || a != b);
| ^^^^^^^^^^^^^^^^^^^
error: this boolean expression can be simplified
--> $DIR/booleans.rs:42:13
|
42 | let _ = a == b && c == 5 && b == a;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
help: try
|
42 | let _ = a == b && c == 5;
| ^^^^^^^^^^^^^^^^
42 | let _ = !(c != 5 || a != b);
| ^^^^^^^^^^^^^^^^^^^
error: this boolean expression contains a logic bug
--> $DIR/booleans.rs:43:13
|
43 | let _ = a < b && a >= b;
| ^^^^^^^^^^^^^^^ help: it would look like the following: `false`
|
help: this expression can be optimized out by applying boolean operations to the outer expression
--> $DIR/booleans.rs:43:13
|
43 | let _ = a < b && a >= b;
| ^^^^^
error: this boolean expression contains a logic bug
--> $DIR/booleans.rs:44:13
|
44 | let _ = a == b && c == 5 && a == b;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
help: try
|
44 | let _ = a == b && c == 5;
| ^^^^^^^^^^^^^^^^
44 | let _ = !(c != 5 || a != b);
| ^^^^^^^^^^^^^^^^^^^
error: this boolean expression can be simplified
--> $DIR/booleans.rs:45:13
|
45 | let _ = a == b && c == 5 && b == a;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
help: try
|
45 | let _ = a == b && c == 5;
| ^^^^^^^^^^^^^^^^
45 | let _ = !(c != 5 || a != b);
| ^^^^^^^^^^^^^^^^^^^
error: this boolean expression contains a logic bug
--> $DIR/booleans.rs:46:13
|
46 | let _ = a < b && a >= b;
44 | let _ = a > b && a <= b;
| ^^^^^^^^^^^^^^^ help: it would look like the following: `false`
|
help: this expression can be optimized out by applying boolean operations to the outer expression
--> $DIR/booleans.rs:46:13
--> $DIR/booleans.rs:44:13
|
46 | let _ = a < b && a >= b;
| ^^^^^
error: this boolean expression contains a logic bug
--> $DIR/booleans.rs:47:13
|
47 | let _ = a > b && a <= b;
| ^^^^^^^^^^^^^^^ help: it would look like the following: `false`
|
help: this expression can be optimized out by applying boolean operations to the outer expression
--> $DIR/booleans.rs:47:13
|
47 | let _ = a > b && a <= b;
44 | let _ = a > b && a <= b;
| ^^^^^
error: this boolean expression can be simplified
--> $DIR/booleans.rs:49:13
--> $DIR/booleans.rs:46:13
|
49 | let _ = a != b || !(a != b || c == d);
46 | let _ = a != b || !(a != b || c == d);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
help: try
|
49 | let _ = c != d || a != b;
46 | let _ = c != d || a != b;
| ^^^^^^^^^^^^^^^^
49 | let _ = !(a == b && c == d);
46 | let _ = !(a == b && c == d);
| ^^^^^^^^^^^^^^^^^^^
error: this boolean expression can be simplified
--> $DIR/booleans.rs:57:13
--> $DIR/booleans.rs:54:13
|
57 | let _ = !a.is_some();
54 | let _ = !a.is_some();
| ^^^^^^^^^^^^ help: try: `a.is_none()`
error: this boolean expression can be simplified
--> $DIR/booleans.rs:59:13
--> $DIR/booleans.rs:56:13
|
59 | let _ = !a.is_none();
56 | let _ = !a.is_none();
| ^^^^^^^^^^^^ help: try: `a.is_some()`
error: this boolean expression can be simplified
--> $DIR/booleans.rs:61:13
--> $DIR/booleans.rs:58:13
|
61 | let _ = !b.is_err();
58 | let _ = !b.is_err();
| ^^^^^^^^^^^ help: try: `b.is_ok()`
error: this boolean expression can be simplified
--> $DIR/booleans.rs:60:13
|
60 | let _ = !b.is_ok();
| ^^^^^^^^^^ help: try: `b.is_err()`
error: this boolean expression can be simplified
--> $DIR/booleans.rs:62:13
|
62 | let _ = !(a.is_some() && !c);
| ^^^^^^^^^^^^^^^^^^^^ help: try: `c || a.is_none()`
error: this boolean expression can be simplified
--> $DIR/booleans.rs:63:13
|
63 | let _ = !b.is_ok();
| ^^^^^^^^^^ help: try: `b.is_err()`
63 | let _ = !(!c ^ c) || !a.is_some();
| ^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `!(!c ^ c) || a.is_none()`
error: this boolean expression can be simplified
--> $DIR/booleans.rs:64:13
|
64 | let _ = (!c ^ c) || !a.is_some();
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `(!c ^ c) || a.is_none()`
error: this boolean expression can be simplified
--> $DIR/booleans.rs:65:13
|
65 | let _ = !(a.is_some() && !c);
| ^^^^^^^^^^^^^^^^^^^^ help: try: `c || a.is_none()`
error: this boolean expression can be simplified
--> $DIR/booleans.rs:66:13
|
66 | let _ = !(!c ^ c) || !a.is_some();
| ^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `!(!c ^ c) || a.is_none()`
error: this boolean expression can be simplified
--> $DIR/booleans.rs:67:13
|
67 | let _ = (!c ^ c) || !a.is_some();
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `(!c ^ c) || a.is_none()`
error: this boolean expression can be simplified
--> $DIR/booleans.rs:68:13
|
68 | let _ = !c ^ c || !a.is_some();
65 | let _ = !c ^ c || !a.is_some();
| ^^^^^^^^^^^^^^^^^^^^^^ help: try: `!c ^ c || a.is_none()`
error: this boolean expression can be simplified
--> $DIR/booleans.rs:120:8
--> $DIR/booleans.rs:137:8
|
120 | if !res.is_ok() { }
137 | if !res.is_ok() {}
| ^^^^^^^^^^^^ help: try: `res.is_err()`
error: this boolean expression can be simplified
--> $DIR/booleans.rs:121:8
--> $DIR/booleans.rs:138:8
|
121 | if !res.is_err() { }
138 | if !res.is_err() {}
| ^^^^^^^^^^^^^ help: try: `res.is_ok()`
error: this boolean expression can be simplified
--> $DIR/booleans.rs:124:8
--> $DIR/booleans.rs:141:8
|
124 | if !res.is_some() { }
141 | if !res.is_some() {}
| ^^^^^^^^^^^^^^ help: try: `res.is_none()`
error: this boolean expression can be simplified
--> $DIR/booleans.rs:125:8
--> $DIR/booleans.rs:142:8
|
125 | if !res.is_none() { }
142 | if !res.is_none() {}
| ^^^^^^^^^^^^^^ help: try: `res.is_some()`
error: aborting due to 25 previous errors

View file

@ -1,31 +1,31 @@
error: you seem to be trying to use `&Box<T>`. Consider using just `&T`
--> $DIR/borrow_box.rs:19:19
--> $DIR/borrow_box.rs:15:19
|
19 | pub fn test1(foo: &mut Box<bool>) {
15 | pub fn test1(foo: &mut Box<bool>) {
| ^^^^^^^^^^^^^^ help: try: `&mut bool`
|
note: lint level defined here
--> $DIR/borrow_box.rs:14:9
--> $DIR/borrow_box.rs:10:9
|
14 | #![deny(clippy::borrowed_box)]
10 | #![deny(clippy::borrowed_box)]
| ^^^^^^^^^^^^^^^^^^^^
error: you seem to be trying to use `&Box<T>`. Consider using just `&T`
--> $DIR/borrow_box.rs:24:14
--> $DIR/borrow_box.rs:20:14
|
24 | let foo: &Box<bool>;
20 | let foo: &Box<bool>;
| ^^^^^^^^^^ help: try: `&bool`
error: you seem to be trying to use `&Box<T>`. Consider using just `&T`
--> $DIR/borrow_box.rs:28:10
--> $DIR/borrow_box.rs:24:10
|
28 | foo: &'a Box<bool>
24 | foo: &'a Box<bool>,
| ^^^^^^^^^^^^^ help: try: `&'a bool`
error: you seem to be trying to use `&Box<T>`. Consider using just `&T`
--> $DIR/borrow_box.rs:32:17
--> $DIR/borrow_box.rs:28:17
|
32 | fn test4(a: &Box<bool>);
28 | fn test4(a: &Box<bool>);
| ^^^^^^^^^^ help: try: `&bool`
error: aborting due to 4 previous errors

View file

@ -1,7 +1,7 @@
error: you seem to be trying to use `Box<Vec<T>>`. Consider using just `Vec<T>`
--> $DIR/box_vec.rs:27:18
--> $DIR/box_vec.rs:23:18
|
27 | pub fn test(foo: Box<Vec<bool>>) {
23 | pub fn test(foo: Box<Vec<bool>>) {
| ^^^^^^^^^^^^^^
|
= note: `-D clippy::box-vec` implied by `-D warnings`

View file

@ -1,17 +1,17 @@
error: This generic shadows the built-in type `u32`
--> $DIR/builtin-type-shadow.rs:15:8
--> $DIR/builtin-type-shadow.rs:12:8
|
15 | fn foo<u32>(a: u32) -> u32 {
12 | fn foo<u32>(a: u32) -> u32 {
| ^^^
|
= note: `-D clippy::builtin-type-shadow` implied by `-D warnings`
error[E0308]: mismatched types
--> $DIR/builtin-type-shadow.rs:16:5
--> $DIR/builtin-type-shadow.rs:13:5
|
15 | fn foo<u32>(a: u32) -> u32 {
12 | fn foo<u32>(a: u32) -> u32 {
| --- expected `u32` because of return type
16 | 42
13 | 42
| ^^ expected type parameter, found integral variable
|
= note: expected type `u32`

View file

@ -1,25 +1,25 @@
error: You appear to be counting bytes the naive way
--> $DIR/bytecount.rs:18:13
--> $DIR/bytecount.rs:14:13
|
18 | let _ = x.iter().filter(|&&a| a == 0).count(); // naive byte count
14 | let _ = x.iter().filter(|&&a| a == 0).count(); // naive byte count
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: Consider using the bytecount crate: `bytecount::count(x, 0)`
|
note: lint level defined here
--> $DIR/bytecount.rs:14:8
--> $DIR/bytecount.rs:10:8
|
14 | #[deny(clippy::naive_bytecount)]
10 | #[deny(clippy::naive_bytecount)]
| ^^^^^^^^^^^^^^^^^^^^^^^
error: You appear to be counting bytes the naive way
--> $DIR/bytecount.rs:20:13
--> $DIR/bytecount.rs:16:13
|
20 | let _ = (&x[..]).iter().filter(|&a| *a == 0).count(); // naive byte count
16 | let _ = (&x[..]).iter().filter(|&a| *a == 0).count(); // naive byte count
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: Consider using the bytecount crate: `bytecount::count((&x[..]), 0)`
error: You appear to be counting bytes the naive way
--> $DIR/bytecount.rs:32:13
--> $DIR/bytecount.rs:28:13
|
32 | let _ = x.iter().filter(|a| b + 1 == **a).count(); // naive byte count
28 | let _ = x.iter().filter(|a| b + 1 == **a).count(); // naive byte count
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: Consider using the bytecount crate: `bytecount::count(x, b + 1)`
error: aborting due to 3 previous errors

View file

@ -1,181 +1,181 @@
error: casting i32 to f32 causes a loss of precision (i32 is 32 bits wide, but f32's mantissa is only 23 bits wide)
--> $DIR/cast.rs:18:5
--> $DIR/cast.rs:20:5
|
18 | 1i32 as f32;
20 | 1i32 as f32;
| ^^^^^^^^^^^
|
= note: `-D clippy::cast-precision-loss` implied by `-D warnings`
error: casting i64 to f32 causes a loss of precision (i64 is 64 bits wide, but f32's mantissa is only 23 bits wide)
--> $DIR/cast.rs:19:5
--> $DIR/cast.rs:21:5
|
19 | 1i64 as f32;
21 | 1i64 as f32;
| ^^^^^^^^^^^
error: casting i64 to f64 causes a loss of precision (i64 is 64 bits wide, but f64's mantissa is only 52 bits wide)
--> $DIR/cast.rs:20:5
--> $DIR/cast.rs:22:5
|
20 | 1i64 as f64;
22 | 1i64 as f64;
| ^^^^^^^^^^^
error: casting u32 to f32 causes a loss of precision (u32 is 32 bits wide, but f32's mantissa is only 23 bits wide)
--> $DIR/cast.rs:21:5
--> $DIR/cast.rs:23:5
|
21 | 1u32 as f32;
23 | 1u32 as f32;
| ^^^^^^^^^^^
error: casting u64 to f32 causes a loss of precision (u64 is 64 bits wide, but f32's mantissa is only 23 bits wide)
--> $DIR/cast.rs:22:5
--> $DIR/cast.rs:24:5
|
22 | 1u64 as f32;
24 | 1u64 as f32;
| ^^^^^^^^^^^
error: casting u64 to f64 causes a loss of precision (u64 is 64 bits wide, but f64's mantissa is only 52 bits wide)
--> $DIR/cast.rs:23:5
--> $DIR/cast.rs:25:5
|
23 | 1u64 as f64;
25 | 1u64 as f64;
| ^^^^^^^^^^^
error: casting f32 to i32 may truncate the value
--> $DIR/cast.rs:25:5
--> $DIR/cast.rs:27:5
|
25 | 1f32 as i32;
27 | 1f32 as i32;
| ^^^^^^^^^^^
|
= note: `-D clippy::cast-possible-truncation` implied by `-D warnings`
error: casting f32 to u32 may truncate the value
--> $DIR/cast.rs:26:5
--> $DIR/cast.rs:28:5
|
26 | 1f32 as u32;
28 | 1f32 as u32;
| ^^^^^^^^^^^
error: casting f32 to u32 may lose the sign of the value
--> $DIR/cast.rs:26:5
--> $DIR/cast.rs:28:5
|
26 | 1f32 as u32;
28 | 1f32 as u32;
| ^^^^^^^^^^^
|
= note: `-D clippy::cast-sign-loss` implied by `-D warnings`
error: casting f64 to f32 may truncate the value
--> $DIR/cast.rs:27:5
--> $DIR/cast.rs:29:5
|
27 | 1f64 as f32;
29 | 1f64 as f32;
| ^^^^^^^^^^^
error: casting i32 to i8 may truncate the value
--> $DIR/cast.rs:28:5
--> $DIR/cast.rs:30:5
|
28 | 1i32 as i8;
30 | 1i32 as i8;
| ^^^^^^^^^^
error: casting i32 to u8 may lose the sign of the value
--> $DIR/cast.rs:29:5
--> $DIR/cast.rs:31:5
|
29 | 1i32 as u8;
31 | 1i32 as u8;
| ^^^^^^^^^^
error: casting i32 to u8 may truncate the value
--> $DIR/cast.rs:29:5
--> $DIR/cast.rs:31:5
|
29 | 1i32 as u8;
31 | 1i32 as u8;
| ^^^^^^^^^^
error: casting f64 to isize may truncate the value
--> $DIR/cast.rs:30:5
--> $DIR/cast.rs:32:5
|
30 | 1f64 as isize;
32 | 1f64 as isize;
| ^^^^^^^^^^^^^
error: casting f64 to usize may truncate the value
--> $DIR/cast.rs:31:5
--> $DIR/cast.rs:33:5
|
31 | 1f64 as usize;
33 | 1f64 as usize;
| ^^^^^^^^^^^^^
error: casting f64 to usize may lose the sign of the value
--> $DIR/cast.rs:31:5
--> $DIR/cast.rs:33:5
|
31 | 1f64 as usize;
33 | 1f64 as usize;
| ^^^^^^^^^^^^^
error: casting u8 to i8 may wrap around the value
--> $DIR/cast.rs:33:5
--> $DIR/cast.rs:35:5
|
33 | 1u8 as i8;
35 | 1u8 as i8;
| ^^^^^^^^^
|
= note: `-D clippy::cast-possible-wrap` implied by `-D warnings`
error: casting u16 to i16 may wrap around the value
--> $DIR/cast.rs:34:5
--> $DIR/cast.rs:36:5
|
34 | 1u16 as i16;
36 | 1u16 as i16;
| ^^^^^^^^^^^
error: casting u32 to i32 may wrap around the value
--> $DIR/cast.rs:35:5
--> $DIR/cast.rs:37:5
|
35 | 1u32 as i32;
37 | 1u32 as i32;
| ^^^^^^^^^^^
error: casting u64 to i64 may wrap around the value
--> $DIR/cast.rs:36:5
--> $DIR/cast.rs:38:5
|
36 | 1u64 as i64;
38 | 1u64 as i64;
| ^^^^^^^^^^^
error: casting usize to isize may wrap around the value
--> $DIR/cast.rs:37:5
--> $DIR/cast.rs:39:5
|
37 | 1usize as isize;
39 | 1usize as isize;
| ^^^^^^^^^^^^^^^
error: casting f32 to f64 may become silently lossy if types change
--> $DIR/cast.rs:39:5
--> $DIR/cast.rs:41:5
|
39 | 1.0f32 as f64;
41 | 1.0f32 as f64;
| ^^^^^^^^^^^^^ help: try: `f64::from(1.0f32)`
|
= note: `-D clippy::cast-lossless` implied by `-D warnings`
error: casting u8 to u16 may become silently lossy if types change
--> $DIR/cast.rs:41:5
--> $DIR/cast.rs:43:5
|
41 | (1u8 + 1u8) as u16;
43 | (1u8 + 1u8) as u16;
| ^^^^^^^^^^^^^^^^^^ help: try: `u16::from(1u8 + 1u8)`
error: casting i32 to u32 may lose the sign of the value
--> $DIR/cast.rs:43:5
--> $DIR/cast.rs:45:5
|
43 | 1i32 as u32;
45 | 1i32 as u32;
| ^^^^^^^^^^^
error: casting isize to usize may lose the sign of the value
--> $DIR/cast.rs:44:5
--> $DIR/cast.rs:46:5
|
44 | 1isize as usize;
46 | 1isize as usize;
| ^^^^^^^^^^^^^^^
error: casting to the same type is unnecessary (`i32` -> `i32`)
--> $DIR/cast.rs:47:5
--> $DIR/cast.rs:49:5
|
47 | 1i32 as i32;
49 | 1i32 as i32;
| ^^^^^^^^^^^
|
= note: `-D clippy::unnecessary-cast` implied by `-D warnings`
error: casting to the same type is unnecessary (`f32` -> `f32`)
--> $DIR/cast.rs:48:5
--> $DIR/cast.rs:50:5
|
48 | 1f32 as f32;
50 | 1f32 as f32;
| ^^^^^^^^^^^
error: casting to the same type is unnecessary (`bool` -> `bool`)
--> $DIR/cast.rs:49:5
--> $DIR/cast.rs:51:5
|
49 | false as bool;
51 | false as bool;
| ^^^^^^^^^^^^^
error: aborting due to 28 previous errors

View file

@ -1,15 +1,15 @@
error: casting from `*const u8` to a more-strictly-aligned pointer (`*const u16`)
--> $DIR/cast_alignment.rs:25:5
--> $DIR/cast_alignment.rs:22:5
|
25 | (&1u8 as *const u8) as *const u16;
22 | (&1u8 as *const u8) as *const u16;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: `-D clippy::cast-ptr-alignment` implied by `-D warnings`
error: casting from `*mut u8` to a more-strictly-aligned pointer (`*mut u16`)
--> $DIR/cast_alignment.rs:26:5
--> $DIR/cast_alignment.rs:23:5
|
26 | (&mut 1u8 as *mut u8) as *mut u16;
23 | (&mut 1u8 as *mut u8) as *mut u16;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to 2 previous errors

View file

@ -1,63 +1,63 @@
error: casting i8 to f32 may become silently lossy if types change
--> $DIR/cast_lossless_float.rs:17:5
--> $DIR/cast_lossless_float.rs:14:5
|
17 | 1i8 as f32;
14 | 1i8 as f32;
| ^^^^^^^^^^ help: try: `f32::from(1i8)`
|
= note: `-D clippy::cast-lossless` implied by `-D warnings`
error: casting i8 to f64 may become silently lossy if types change
--> $DIR/cast_lossless_float.rs:18:5
--> $DIR/cast_lossless_float.rs:15:5
|
18 | 1i8 as f64;
15 | 1i8 as f64;
| ^^^^^^^^^^ help: try: `f64::from(1i8)`
error: casting u8 to f32 may become silently lossy if types change
--> $DIR/cast_lossless_float.rs:19:5
--> $DIR/cast_lossless_float.rs:16:5
|
19 | 1u8 as f32;
16 | 1u8 as f32;
| ^^^^^^^^^^ help: try: `f32::from(1u8)`
error: casting u8 to f64 may become silently lossy if types change
--> $DIR/cast_lossless_float.rs:20:5
--> $DIR/cast_lossless_float.rs:17:5
|
20 | 1u8 as f64;
17 | 1u8 as f64;
| ^^^^^^^^^^ help: try: `f64::from(1u8)`
error: casting i16 to f32 may become silently lossy if types change
--> $DIR/cast_lossless_float.rs:21:5
--> $DIR/cast_lossless_float.rs:18:5
|
21 | 1i16 as f32;
18 | 1i16 as f32;
| ^^^^^^^^^^^ help: try: `f32::from(1i16)`
error: casting i16 to f64 may become silently lossy if types change
--> $DIR/cast_lossless_float.rs:22:5
--> $DIR/cast_lossless_float.rs:19:5
|
22 | 1i16 as f64;
19 | 1i16 as f64;
| ^^^^^^^^^^^ help: try: `f64::from(1i16)`
error: casting u16 to f32 may become silently lossy if types change
--> $DIR/cast_lossless_float.rs:23:5
--> $DIR/cast_lossless_float.rs:20:5
|
23 | 1u16 as f32;
20 | 1u16 as f32;
| ^^^^^^^^^^^ help: try: `f32::from(1u16)`
error: casting u16 to f64 may become silently lossy if types change
--> $DIR/cast_lossless_float.rs:24:5
--> $DIR/cast_lossless_float.rs:21:5
|
24 | 1u16 as f64;
21 | 1u16 as f64;
| ^^^^^^^^^^^ help: try: `f64::from(1u16)`
error: casting i32 to f64 may become silently lossy if types change
--> $DIR/cast_lossless_float.rs:25:5
--> $DIR/cast_lossless_float.rs:22:5
|
25 | 1i32 as f64;
22 | 1i32 as f64;
| ^^^^^^^^^^^ help: try: `f64::from(1i32)`
error: casting u32 to f64 may become silently lossy if types change
--> $DIR/cast_lossless_float.rs:26:5
--> $DIR/cast_lossless_float.rs:23:5
|
26 | 1u32 as f64;
23 | 1u32 as f64;
| ^^^^^^^^^^^ help: try: `f64::from(1u32)`
error: aborting due to 10 previous errors

View file

@ -1,111 +1,111 @@
error: casting i8 to i16 may become silently lossy if types change
--> $DIR/cast_lossless_integer.rs:16:5
--> $DIR/cast_lossless_integer.rs:14:5
|
16 | 1i8 as i16;
14 | 1i8 as i16;
| ^^^^^^^^^^ help: try: `i16::from(1i8)`
|
= note: `-D clippy::cast-lossless` implied by `-D warnings`
error: casting i8 to i32 may become silently lossy if types change
--> $DIR/cast_lossless_integer.rs:17:5
--> $DIR/cast_lossless_integer.rs:15:5
|
17 | 1i8 as i32;
15 | 1i8 as i32;
| ^^^^^^^^^^ help: try: `i32::from(1i8)`
error: casting i8 to i64 may become silently lossy if types change
--> $DIR/cast_lossless_integer.rs:18:5
--> $DIR/cast_lossless_integer.rs:16:5
|
18 | 1i8 as i64;
16 | 1i8 as i64;
| ^^^^^^^^^^ help: try: `i64::from(1i8)`
error: casting u8 to i16 may become silently lossy if types change
--> $DIR/cast_lossless_integer.rs:19:5
--> $DIR/cast_lossless_integer.rs:17:5
|
19 | 1u8 as i16;
17 | 1u8 as i16;
| ^^^^^^^^^^ help: try: `i16::from(1u8)`
error: casting u8 to i32 may become silently lossy if types change
--> $DIR/cast_lossless_integer.rs:20:5
--> $DIR/cast_lossless_integer.rs:18:5
|
20 | 1u8 as i32;
18 | 1u8 as i32;
| ^^^^^^^^^^ help: try: `i32::from(1u8)`
error: casting u8 to i64 may become silently lossy if types change
--> $DIR/cast_lossless_integer.rs:21:5
--> $DIR/cast_lossless_integer.rs:19:5
|
21 | 1u8 as i64;
19 | 1u8 as i64;
| ^^^^^^^^^^ help: try: `i64::from(1u8)`
error: casting u8 to u16 may become silently lossy if types change
--> $DIR/cast_lossless_integer.rs:22:5
--> $DIR/cast_lossless_integer.rs:20:5
|
22 | 1u8 as u16;
20 | 1u8 as u16;
| ^^^^^^^^^^ help: try: `u16::from(1u8)`
error: casting u8 to u32 may become silently lossy if types change
--> $DIR/cast_lossless_integer.rs:23:5
--> $DIR/cast_lossless_integer.rs:21:5
|
23 | 1u8 as u32;
21 | 1u8 as u32;
| ^^^^^^^^^^ help: try: `u32::from(1u8)`
error: casting u8 to u64 may become silently lossy if types change
--> $DIR/cast_lossless_integer.rs:24:5
--> $DIR/cast_lossless_integer.rs:22:5
|
24 | 1u8 as u64;
22 | 1u8 as u64;
| ^^^^^^^^^^ help: try: `u64::from(1u8)`
error: casting i16 to i32 may become silently lossy if types change
--> $DIR/cast_lossless_integer.rs:25:5
--> $DIR/cast_lossless_integer.rs:23:5
|
25 | 1i16 as i32;
23 | 1i16 as i32;
| ^^^^^^^^^^^ help: try: `i32::from(1i16)`
error: casting i16 to i64 may become silently lossy if types change
--> $DIR/cast_lossless_integer.rs:26:5
--> $DIR/cast_lossless_integer.rs:24:5
|
26 | 1i16 as i64;
24 | 1i16 as i64;
| ^^^^^^^^^^^ help: try: `i64::from(1i16)`
error: casting u16 to i32 may become silently lossy if types change
--> $DIR/cast_lossless_integer.rs:27:5
--> $DIR/cast_lossless_integer.rs:25:5
|
27 | 1u16 as i32;
25 | 1u16 as i32;
| ^^^^^^^^^^^ help: try: `i32::from(1u16)`
error: casting u16 to i64 may become silently lossy if types change
--> $DIR/cast_lossless_integer.rs:28:5
--> $DIR/cast_lossless_integer.rs:26:5
|
28 | 1u16 as i64;
26 | 1u16 as i64;
| ^^^^^^^^^^^ help: try: `i64::from(1u16)`
error: casting u16 to u32 may become silently lossy if types change
--> $DIR/cast_lossless_integer.rs:29:5
--> $DIR/cast_lossless_integer.rs:27:5
|
29 | 1u16 as u32;
27 | 1u16 as u32;
| ^^^^^^^^^^^ help: try: `u32::from(1u16)`
error: casting u16 to u64 may become silently lossy if types change
--> $DIR/cast_lossless_integer.rs:30:5
--> $DIR/cast_lossless_integer.rs:28:5
|
30 | 1u16 as u64;
28 | 1u16 as u64;
| ^^^^^^^^^^^ help: try: `u64::from(1u16)`
error: casting i32 to i64 may become silently lossy if types change
--> $DIR/cast_lossless_integer.rs:31:5
--> $DIR/cast_lossless_integer.rs:29:5
|
31 | 1i32 as i64;
29 | 1i32 as i64;
| ^^^^^^^^^^^ help: try: `i64::from(1i32)`
error: casting u32 to i64 may become silently lossy if types change
--> $DIR/cast_lossless_integer.rs:32:5
--> $DIR/cast_lossless_integer.rs:30:5
|
32 | 1u32 as i64;
30 | 1u32 as i64;
| ^^^^^^^^^^^ help: try: `i64::from(1u32)`
error: casting u32 to u64 may become silently lossy if types change
--> $DIR/cast_lossless_integer.rs:33:5
--> $DIR/cast_lossless_integer.rs:31:5
|
33 | 1u32 as u64;
31 | 1u32 as u64;
| ^^^^^^^^^^^ help: try: `u64::from(1u32)`
error: aborting due to 18 previous errors

View file

@ -1,123 +1,123 @@
error: casting isize to i8 may truncate the value
--> $DIR/cast_size.rs:17:5
--> $DIR/cast_size.rs:20:5
|
17 | 1isize as i8;
20 | 1isize as i8;
| ^^^^^^^^^^^^
|
= note: `-D clippy::cast-possible-truncation` implied by `-D warnings`
error: casting isize to f64 causes a loss of precision on targets with 64-bit wide pointers (isize is 64 bits wide, but f64's mantissa is only 52 bits wide)
--> $DIR/cast_size.rs:18:5
--> $DIR/cast_size.rs:21:5
|
18 | 1isize as f64;
21 | 1isize as f64;
| ^^^^^^^^^^^^^
|
= note: `-D clippy::cast-precision-loss` implied by `-D warnings`
error: casting usize to f64 causes a loss of precision on targets with 64-bit wide pointers (usize is 64 bits wide, but f64's mantissa is only 52 bits wide)
--> $DIR/cast_size.rs:19:5
--> $DIR/cast_size.rs:22:5
|
19 | 1usize as f64;
22 | 1usize as f64;
| ^^^^^^^^^^^^^
error: casting isize to f32 causes a loss of precision (isize is 32 or 64 bits wide, but f32's mantissa is only 23 bits wide)
--> $DIR/cast_size.rs:20:5
--> $DIR/cast_size.rs:23:5
|
20 | 1isize as f32;
23 | 1isize as f32;
| ^^^^^^^^^^^^^
error: casting usize to f32 causes a loss of precision (usize is 32 or 64 bits wide, but f32's mantissa is only 23 bits wide)
--> $DIR/cast_size.rs:21:5
--> $DIR/cast_size.rs:24:5
|
21 | 1usize as f32;
24 | 1usize as f32;
| ^^^^^^^^^^^^^
error: casting isize to i32 may truncate the value on targets with 64-bit wide pointers
--> $DIR/cast_size.rs:22:5
--> $DIR/cast_size.rs:25:5
|
22 | 1isize as i32;
25 | 1isize as i32;
| ^^^^^^^^^^^^^
error: casting isize to u32 may lose the sign of the value
--> $DIR/cast_size.rs:23:5
--> $DIR/cast_size.rs:26:5
|
23 | 1isize as u32;
26 | 1isize as u32;
| ^^^^^^^^^^^^^
|
= note: `-D clippy::cast-sign-loss` implied by `-D warnings`
error: casting isize to u32 may truncate the value on targets with 64-bit wide pointers
--> $DIR/cast_size.rs:23:5
--> $DIR/cast_size.rs:26:5
|
23 | 1isize as u32;
26 | 1isize as u32;
| ^^^^^^^^^^^^^
error: casting usize to u32 may truncate the value on targets with 64-bit wide pointers
--> $DIR/cast_size.rs:24:5
--> $DIR/cast_size.rs:27:5
|
24 | 1usize as u32;
27 | 1usize as u32;
| ^^^^^^^^^^^^^
error: casting usize to i32 may truncate the value on targets with 64-bit wide pointers
--> $DIR/cast_size.rs:25:5
--> $DIR/cast_size.rs:28:5
|
25 | 1usize as i32;
28 | 1usize as i32;
| ^^^^^^^^^^^^^
error: casting usize to i32 may wrap around the value on targets with 32-bit wide pointers
--> $DIR/cast_size.rs:25:5
--> $DIR/cast_size.rs:28:5
|
25 | 1usize as i32;
28 | 1usize as i32;
| ^^^^^^^^^^^^^
|
= note: `-D clippy::cast-possible-wrap` implied by `-D warnings`
error: casting i64 to isize may truncate the value on targets with 32-bit wide pointers
--> $DIR/cast_size.rs:27:5
--> $DIR/cast_size.rs:30:5
|
27 | 1i64 as isize;
30 | 1i64 as isize;
| ^^^^^^^^^^^^^
error: casting i64 to usize may lose the sign of the value
--> $DIR/cast_size.rs:28:5
--> $DIR/cast_size.rs:31:5
|
28 | 1i64 as usize;
31 | 1i64 as usize;
| ^^^^^^^^^^^^^
error: casting i64 to usize may truncate the value on targets with 32-bit wide pointers
--> $DIR/cast_size.rs:28:5
--> $DIR/cast_size.rs:31:5
|
28 | 1i64 as usize;
31 | 1i64 as usize;
| ^^^^^^^^^^^^^
error: casting u64 to isize may truncate the value on targets with 32-bit wide pointers
--> $DIR/cast_size.rs:29:5
--> $DIR/cast_size.rs:32:5
|
29 | 1u64 as isize;
32 | 1u64 as isize;
| ^^^^^^^^^^^^^
error: casting u64 to isize may wrap around the value on targets with 64-bit wide pointers
--> $DIR/cast_size.rs:29:5
--> $DIR/cast_size.rs:32:5
|
29 | 1u64 as isize;
32 | 1u64 as isize;
| ^^^^^^^^^^^^^
error: casting u64 to usize may truncate the value on targets with 32-bit wide pointers
--> $DIR/cast_size.rs:30:5
--> $DIR/cast_size.rs:33:5
|
30 | 1u64 as usize;
33 | 1u64 as usize;
| ^^^^^^^^^^^^^
error: casting u32 to isize may wrap around the value on targets with 32-bit wide pointers
--> $DIR/cast_size.rs:31:5
--> $DIR/cast_size.rs:34:5
|
31 | 1u32 as isize;
34 | 1u32 as isize;
| ^^^^^^^^^^^^^
error: casting i32 to usize may lose the sign of the value
--> $DIR/cast_size.rs:34:5
--> $DIR/cast_size.rs:37:5
|
34 | 1i32 as usize;
37 | 1i32 as usize;
| ^^^^^^^^^^^^^
error: aborting due to 19 previous errors

View file

@ -1,7 +1,7 @@
error: casting character literal to u8. `char`s are 4 bytes wide in rust, so casting to u8 truncates them
--> $DIR/char_lit_as_u8.rs:17:13
--> $DIR/char_lit_as_u8.rs:13:13
|
17 | let c = 'a' as u8;
13 | let c = 'a' as u8;
| ^^^^^^^^^
|
= note: `-D clippy::char-lit-as-u8` implied by `-D warnings`

View file

@ -1,312 +1,312 @@
error: You checked before that `unwrap()` cannot fail. Instead of checking and unwrapping, it's better to use `if let` or `match`.
--> $DIR/checked_unwrap.rs:19:9
--> $DIR/checked_unwrap.rs:16:9
|
18 | if x.is_some() {
15 | if x.is_some() {
| ----------- the check is happening here
19 | x.unwrap(); // unnecessary
16 | x.unwrap(); // unnecessary
| ^^^^^^^^^^
|
note: lint level defined here
--> $DIR/checked_unwrap.rs:13:35
--> $DIR/checked_unwrap.rs:10:35
|
13 | #![deny(clippy::panicking_unwrap, clippy::unnecessary_unwrap)]
10 | #![deny(clippy::panicking_unwrap, clippy::unnecessary_unwrap)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
error: This call to `unwrap()` will always panic.
--> $DIR/checked_unwrap.rs:18:9
|
15 | if x.is_some() {
| ----------- because of this check
...
18 | x.unwrap(); // will panic
| ^^^^^^^^^^
|
note: lint level defined here
--> $DIR/checked_unwrap.rs:10:9
|
10 | #![deny(clippy::panicking_unwrap, clippy::unnecessary_unwrap)]
| ^^^^^^^^^^^^^^^^^^^^^^^^
error: This call to `unwrap()` will always panic.
--> $DIR/checked_unwrap.rs:21:9
|
18 | if x.is_some() {
20 | if x.is_none() {
| ----------- because of this check
...
21 | x.unwrap(); // will panic
| ^^^^^^^^^^
|
note: lint level defined here
--> $DIR/checked_unwrap.rs:13:9
|
13 | #![deny(clippy::panicking_unwrap, clippy::unnecessary_unwrap)]
| ^^^^^^^^^^^^^^^^^^^^^^^^
error: This call to `unwrap()` will always panic.
--> $DIR/checked_unwrap.rs:24:9
|
23 | if x.is_none() {
| ----------- because of this check
24 | x.unwrap(); // will panic
| ^^^^^^^^^^
error: You checked before that `unwrap()` cannot fail. Instead of checking and unwrapping, it's better to use `if let` or `match`.
--> $DIR/checked_unwrap.rs:26:9
--> $DIR/checked_unwrap.rs:23:9
|
23 | if x.is_none() {
20 | if x.is_none() {
| ----------- the check is happening here
...
26 | x.unwrap(); // unnecessary
23 | x.unwrap(); // unnecessary
| ^^^^^^^^^^
error: You checked before that `unwrap()` cannot fail. Instead of checking and unwrapping, it's better to use `if let` or `match`.
--> $DIR/checked_unwrap.rs:27:9
|
26 | if x.is_ok() {
| --------- the check is happening here
27 | x.unwrap(); // unnecessary
| ^^^^^^^^^^
error: This call to `unwrap_err()` will always panic.
--> $DIR/checked_unwrap.rs:28:9
|
26 | if x.is_ok() {
| --------- because of this check
27 | x.unwrap(); // unnecessary
28 | x.unwrap_err(); // will panic
| ^^^^^^^^^^^^^^
error: This call to `unwrap()` will always panic.
--> $DIR/checked_unwrap.rs:30:9
|
29 | if x.is_ok() {
| --------- the check is happening here
30 | x.unwrap(); // unnecessary
26 | if x.is_ok() {
| --------- because of this check
...
30 | x.unwrap(); // will panic
| ^^^^^^^^^^
error: This call to `unwrap_err()` will always panic.
error: You checked before that `unwrap_err()` cannot fail. Instead of checking and unwrapping, it's better to use `if let` or `match`.
--> $DIR/checked_unwrap.rs:31:9
|
29 | if x.is_ok() {
| --------- because of this check
30 | x.unwrap(); // unnecessary
31 | x.unwrap_err(); // will panic
26 | if x.is_ok() {
| --------- the check is happening here
...
31 | x.unwrap_err(); // unnecessary
| ^^^^^^^^^^^^^^
error: This call to `unwrap()` will always panic.
--> $DIR/checked_unwrap.rs:33:9
|
29 | if x.is_ok() {
| --------- because of this check
...
33 | x.unwrap(); // will panic
| ^^^^^^^^^^
error: You checked before that `unwrap_err()` cannot fail. Instead of checking and unwrapping, it's better to use `if let` or `match`.
--> $DIR/checked_unwrap.rs:34:9
|
29 | if x.is_ok() {
| --------- the check is happening here
...
34 | x.unwrap_err(); // unnecessary
33 | if x.is_err() {
| ---------- because of this check
34 | x.unwrap(); // will panic
| ^^^^^^^^^^
error: You checked before that `unwrap_err()` cannot fail. Instead of checking and unwrapping, it's better to use `if let` or `match`.
--> $DIR/checked_unwrap.rs:35:9
|
33 | if x.is_err() {
| ---------- the check is happening here
34 | x.unwrap(); // will panic
35 | x.unwrap_err(); // unnecessary
| ^^^^^^^^^^^^^^
error: This call to `unwrap()` will always panic.
error: You checked before that `unwrap()` cannot fail. Instead of checking and unwrapping, it's better to use `if let` or `match`.
--> $DIR/checked_unwrap.rs:37:9
|
36 | if x.is_err() {
| ---------- because of this check
37 | x.unwrap(); // will panic
33 | if x.is_err() {
| ---------- the check is happening here
...
37 | x.unwrap(); // unnecessary
| ^^^^^^^^^^
error: You checked before that `unwrap_err()` cannot fail. Instead of checking and unwrapping, it's better to use `if let` or `match`.
error: This call to `unwrap_err()` will always panic.
--> $DIR/checked_unwrap.rs:38:9
|
36 | if x.is_err() {
| ---------- the check is happening here
37 | x.unwrap(); // will panic
38 | x.unwrap_err(); // unnecessary
| ^^^^^^^^^^^^^^
error: You checked before that `unwrap()` cannot fail. Instead of checking and unwrapping, it's better to use `if let` or `match`.
--> $DIR/checked_unwrap.rs:40:9
|
36 | if x.is_err() {
| ---------- the check is happening here
...
40 | x.unwrap(); // unnecessary
| ^^^^^^^^^^
error: This call to `unwrap_err()` will always panic.
--> $DIR/checked_unwrap.rs:41:9
|
36 | if x.is_err() {
33 | if x.is_err() {
| ---------- because of this check
...
41 | x.unwrap_err(); // will panic
38 | x.unwrap_err(); // will panic
| ^^^^^^^^^^^^^^
error: You checked before that `unwrap()` cannot fail. Instead of checking and unwrapping, it's better to use `if let` or `match`.
--> $DIR/checked_unwrap.rs:58:9
--> $DIR/checked_unwrap.rs:55:9
|
57 | if x.is_ok() && y.is_err() {
54 | if x.is_ok() && y.is_err() {
| --------- the check is happening here
58 | x.unwrap(); // unnecessary
55 | x.unwrap(); // unnecessary
| ^^^^^^^^^^
error: This call to `unwrap_err()` will always panic.
--> $DIR/checked_unwrap.rs:59:9
--> $DIR/checked_unwrap.rs:56:9
|
57 | if x.is_ok() && y.is_err() {
54 | if x.is_ok() && y.is_err() {
| --------- because of this check
58 | x.unwrap(); // unnecessary
59 | x.unwrap_err(); // will panic
55 | x.unwrap(); // unnecessary
56 | x.unwrap_err(); // will panic
| ^^^^^^^^^^^^^^
error: This call to `unwrap()` will always panic.
--> $DIR/checked_unwrap.rs:60:9
--> $DIR/checked_unwrap.rs:57:9
|
57 | if x.is_ok() && y.is_err() {
54 | if x.is_ok() && y.is_err() {
| ---------- because of this check
...
60 | y.unwrap(); // will panic
57 | y.unwrap(); // will panic
| ^^^^^^^^^^
error: You checked before that `unwrap_err()` cannot fail. Instead of checking and unwrapping, it's better to use `if let` or `match`.
--> $DIR/checked_unwrap.rs:61:9
--> $DIR/checked_unwrap.rs:58:9
|
57 | if x.is_ok() && y.is_err() {
54 | if x.is_ok() && y.is_err() {
| ---------- the check is happening here
...
61 | y.unwrap_err(); // unnecessary
58 | y.unwrap_err(); // unnecessary
| ^^^^^^^^^^^^^^
error: This call to `unwrap()` will always panic.
--> $DIR/checked_unwrap.rs:75:9
--> $DIR/checked_unwrap.rs:72:9
|
70 | if x.is_ok() || y.is_ok() {
67 | if x.is_ok() || y.is_ok() {
| --------- because of this check
...
75 | x.unwrap(); // will panic
72 | x.unwrap(); // will panic
| ^^^^^^^^^^
error: You checked before that `unwrap_err()` cannot fail. Instead of checking and unwrapping, it's better to use `if let` or `match`.
--> $DIR/checked_unwrap.rs:76:9
--> $DIR/checked_unwrap.rs:73:9
|
70 | if x.is_ok() || y.is_ok() {
67 | if x.is_ok() || y.is_ok() {
| --------- the check is happening here
...
76 | x.unwrap_err(); // unnecessary
73 | x.unwrap_err(); // unnecessary
| ^^^^^^^^^^^^^^
error: This call to `unwrap()` will always panic.
--> $DIR/checked_unwrap.rs:77:9
--> $DIR/checked_unwrap.rs:74:9
|
70 | if x.is_ok() || y.is_ok() {
67 | if x.is_ok() || y.is_ok() {
| --------- because of this check
...
77 | y.unwrap(); // will panic
74 | y.unwrap(); // will panic
| ^^^^^^^^^^
error: You checked before that `unwrap_err()` cannot fail. Instead of checking and unwrapping, it's better to use `if let` or `match`.
--> $DIR/checked_unwrap.rs:78:9
--> $DIR/checked_unwrap.rs:75:9
|
70 | if x.is_ok() || y.is_ok() {
67 | if x.is_ok() || y.is_ok() {
| --------- the check is happening here
...
78 | y.unwrap_err(); // unnecessary
75 | y.unwrap_err(); // unnecessary
| ^^^^^^^^^^^^^^
error: You checked before that `unwrap()` cannot fail. Instead of checking and unwrapping, it's better to use `if let` or `match`.
--> $DIR/checked_unwrap.rs:79:9
|
78 | if x.is_ok() && !(y.is_ok() || z.is_err()) {
| --------- the check is happening here
79 | x.unwrap(); // unnecessary
| ^^^^^^^^^^
error: This call to `unwrap_err()` will always panic.
--> $DIR/checked_unwrap.rs:80:9
|
78 | if x.is_ok() && !(y.is_ok() || z.is_err()) {
| --------- because of this check
79 | x.unwrap(); // unnecessary
80 | x.unwrap_err(); // will panic
| ^^^^^^^^^^^^^^
error: This call to `unwrap()` will always panic.
--> $DIR/checked_unwrap.rs:81:9
|
78 | if x.is_ok() && !(y.is_ok() || z.is_err()) {
| --------- because of this check
...
81 | y.unwrap(); // will panic
| ^^^^^^^^^^
error: You checked before that `unwrap_err()` cannot fail. Instead of checking and unwrapping, it's better to use `if let` or `match`.
--> $DIR/checked_unwrap.rs:82:9
|
81 | if x.is_ok() && !(y.is_ok() || z.is_err()) {
| --------- the check is happening here
82 | x.unwrap(); // unnecessary
| ^^^^^^^^^^
78 | if x.is_ok() && !(y.is_ok() || z.is_err()) {
| --------- the check is happening here
...
82 | y.unwrap_err(); // unnecessary
| ^^^^^^^^^^^^^^
error: This call to `unwrap_err()` will always panic.
error: You checked before that `unwrap()` cannot fail. Instead of checking and unwrapping, it's better to use `if let` or `match`.
--> $DIR/checked_unwrap.rs:83:9
|
81 | if x.is_ok() && !(y.is_ok() || z.is_err()) {
| --------- because of this check
82 | x.unwrap(); // unnecessary
83 | x.unwrap_err(); // will panic
| ^^^^^^^^^^^^^^
error: This call to `unwrap()` will always panic.
--> $DIR/checked_unwrap.rs:84:9
|
81 | if x.is_ok() && !(y.is_ok() || z.is_err()) {
| --------- because of this check
...
84 | y.unwrap(); // will panic
| ^^^^^^^^^^
error: You checked before that `unwrap_err()` cannot fail. Instead of checking and unwrapping, it's better to use `if let` or `match`.
--> $DIR/checked_unwrap.rs:85:9
|
81 | if x.is_ok() && !(y.is_ok() || z.is_err()) {
| --------- the check is happening here
...
85 | y.unwrap_err(); // unnecessary
| ^^^^^^^^^^^^^^
error: You checked before that `unwrap()` cannot fail. Instead of checking and unwrapping, it's better to use `if let` or `match`.
--> $DIR/checked_unwrap.rs:86:9
|
81 | if x.is_ok() && !(y.is_ok() || z.is_err()) {
78 | if x.is_ok() && !(y.is_ok() || z.is_err()) {
| ---------- the check is happening here
...
86 | z.unwrap(); // unnecessary
83 | z.unwrap(); // unnecessary
| ^^^^^^^^^^
error: This call to `unwrap_err()` will always panic.
--> $DIR/checked_unwrap.rs:87:9
--> $DIR/checked_unwrap.rs:84:9
|
81 | if x.is_ok() && !(y.is_ok() || z.is_err()) {
78 | if x.is_ok() && !(y.is_ok() || z.is_err()) {
| ---------- because of this check
...
87 | z.unwrap_err(); // will panic
84 | z.unwrap_err(); // will panic
| ^^^^^^^^^^^^^^
error: This call to `unwrap()` will always panic.
--> $DIR/checked_unwrap.rs:95:9
--> $DIR/checked_unwrap.rs:92:9
|
89 | if x.is_ok() || !(y.is_ok() && z.is_err()) {
86 | if x.is_ok() || !(y.is_ok() && z.is_err()) {
| --------- because of this check
...
95 | x.unwrap(); // will panic
92 | x.unwrap(); // will panic
| ^^^^^^^^^^
error: You checked before that `unwrap_err()` cannot fail. Instead of checking and unwrapping, it's better to use `if let` or `match`.
--> $DIR/checked_unwrap.rs:96:9
--> $DIR/checked_unwrap.rs:93:9
|
89 | if x.is_ok() || !(y.is_ok() && z.is_err()) {
86 | if x.is_ok() || !(y.is_ok() && z.is_err()) {
| --------- the check is happening here
...
96 | x.unwrap_err(); // unnecessary
93 | x.unwrap_err(); // unnecessary
| ^^^^^^^^^^^^^^
error: You checked before that `unwrap()` cannot fail. Instead of checking and unwrapping, it's better to use `if let` or `match`.
--> $DIR/checked_unwrap.rs:97:9
--> $DIR/checked_unwrap.rs:94:9
|
89 | if x.is_ok() || !(y.is_ok() && z.is_err()) {
86 | if x.is_ok() || !(y.is_ok() && z.is_err()) {
| --------- the check is happening here
...
97 | y.unwrap(); // unnecessary
94 | y.unwrap(); // unnecessary
| ^^^^^^^^^^
error: This call to `unwrap_err()` will always panic.
--> $DIR/checked_unwrap.rs:98:9
--> $DIR/checked_unwrap.rs:95:9
|
89 | if x.is_ok() || !(y.is_ok() && z.is_err()) {
86 | if x.is_ok() || !(y.is_ok() && z.is_err()) {
| --------- because of this check
...
98 | y.unwrap_err(); // will panic
95 | y.unwrap_err(); // will panic
| ^^^^^^^^^^^^^^
error: This call to `unwrap()` will always panic.
--> $DIR/checked_unwrap.rs:99:9
--> $DIR/checked_unwrap.rs:96:9
|
89 | if x.is_ok() || !(y.is_ok() && z.is_err()) {
86 | if x.is_ok() || !(y.is_ok() && z.is_err()) {
| ---------- because of this check
...
99 | z.unwrap(); // will panic
96 | z.unwrap(); // will panic
| ^^^^^^^^^^
error: You checked before that `unwrap_err()` cannot fail. Instead of checking and unwrapping, it's better to use `if let` or `match`.
--> $DIR/checked_unwrap.rs:100:9
|
89 | if x.is_ok() || !(y.is_ok() && z.is_err()) {
| ---------- the check is happening here
--> $DIR/checked_unwrap.rs:97:9
|
86 | if x.is_ok() || !(y.is_ok() && z.is_err()) {
| ---------- the check is happening here
...
100 | z.unwrap_err(); // unnecessary
| ^^^^^^^^^^^^^^
97 | z.unwrap_err(); // unnecessary
| ^^^^^^^^^^^^^^
error: You checked before that `unwrap()` cannot fail. Instead of checking and unwrapping, it's better to use `if let` or `match`.
--> $DIR/checked_unwrap.rs:108:13
--> $DIR/checked_unwrap.rs:105:13
|
107 | if x.is_some() {
104 | if x.is_some() {
| ----------- the check is happening here
108 | x.unwrap(); // unnecessary
105 | x.unwrap(); // unnecessary
| ^^^^^^^^^^
error: This call to `unwrap()` will always panic.
--> $DIR/checked_unwrap.rs:110:13
--> $DIR/checked_unwrap.rs:107:13
|
107 | if x.is_some() {
104 | if x.is_some() {
| ----------- because of this check
...
110 | x.unwrap(); // will panic
107 | x.unwrap(); // will panic
| ^^^^^^^^^^
error: aborting due to 34 previous errors

View file

@ -1,75 +1,75 @@
error: doomed comparison with NAN, use `std::{f32,f64}::is_nan()` instead
--> $DIR/cmp_nan.rs:18:5
--> $DIR/cmp_nan.rs:14:5
|
18 | x == std::f32::NAN;
14 | x == std::f32::NAN;
| ^^^^^^^^^^^^^^^^^^
|
= note: `-D clippy::cmp-nan` implied by `-D warnings`
error: doomed comparison with NAN, use `std::{f32,f64}::is_nan()` instead
--> $DIR/cmp_nan.rs:19:5
--> $DIR/cmp_nan.rs:15:5
|
19 | x != std::f32::NAN;
15 | x != std::f32::NAN;
| ^^^^^^^^^^^^^^^^^^
error: doomed comparison with NAN, use `std::{f32,f64}::is_nan()` instead
--> $DIR/cmp_nan.rs:20:5
--> $DIR/cmp_nan.rs:16:5
|
20 | x < std::f32::NAN;
16 | x < std::f32::NAN;
| ^^^^^^^^^^^^^^^^^
error: doomed comparison with NAN, use `std::{f32,f64}::is_nan()` instead
--> $DIR/cmp_nan.rs:21:5
--> $DIR/cmp_nan.rs:17:5
|
21 | x > std::f32::NAN;
17 | x > std::f32::NAN;
| ^^^^^^^^^^^^^^^^^
error: doomed comparison with NAN, use `std::{f32,f64}::is_nan()` instead
--> $DIR/cmp_nan.rs:18:5
|
18 | x <= std::f32::NAN;
| ^^^^^^^^^^^^^^^^^^
error: doomed comparison with NAN, use `std::{f32,f64}::is_nan()` instead
--> $DIR/cmp_nan.rs:19:5
|
19 | x >= std::f32::NAN;
| ^^^^^^^^^^^^^^^^^^
error: doomed comparison with NAN, use `std::{f32,f64}::is_nan()` instead
--> $DIR/cmp_nan.rs:22:5
|
22 | x <= std::f32::NAN;
22 | y == std::f64::NAN;
| ^^^^^^^^^^^^^^^^^^
error: doomed comparison with NAN, use `std::{f32,f64}::is_nan()` instead
--> $DIR/cmp_nan.rs:23:5
|
23 | x >= std::f32::NAN;
23 | y != std::f64::NAN;
| ^^^^^^^^^^^^^^^^^^
error: doomed comparison with NAN, use `std::{f32,f64}::is_nan()` instead
--> $DIR/cmp_nan.rs:24:5
|
24 | y < std::f64::NAN;
| ^^^^^^^^^^^^^^^^^
error: doomed comparison with NAN, use `std::{f32,f64}::is_nan()` instead
--> $DIR/cmp_nan.rs:25:5
|
25 | y > std::f64::NAN;
| ^^^^^^^^^^^^^^^^^
error: doomed comparison with NAN, use `std::{f32,f64}::is_nan()` instead
--> $DIR/cmp_nan.rs:26:5
|
26 | y == std::f64::NAN;
26 | y <= std::f64::NAN;
| ^^^^^^^^^^^^^^^^^^
error: doomed comparison with NAN, use `std::{f32,f64}::is_nan()` instead
--> $DIR/cmp_nan.rs:27:5
|
27 | y != std::f64::NAN;
| ^^^^^^^^^^^^^^^^^^
error: doomed comparison with NAN, use `std::{f32,f64}::is_nan()` instead
--> $DIR/cmp_nan.rs:28:5
|
28 | y < std::f64::NAN;
| ^^^^^^^^^^^^^^^^^
error: doomed comparison with NAN, use `std::{f32,f64}::is_nan()` instead
--> $DIR/cmp_nan.rs:29:5
|
29 | y > std::f64::NAN;
| ^^^^^^^^^^^^^^^^^
error: doomed comparison with NAN, use `std::{f32,f64}::is_nan()` instead
--> $DIR/cmp_nan.rs:30:5
|
30 | y <= std::f64::NAN;
| ^^^^^^^^^^^^^^^^^^
error: doomed comparison with NAN, use `std::{f32,f64}::is_nan()` instead
--> $DIR/cmp_nan.rs:31:5
|
31 | y >= std::f64::NAN;
27 | y >= std::f64::NAN;
| ^^^^^^^^^^^^^^^^^^
error: aborting due to 12 previous errors

View file

@ -1,15 +1,15 @@
error: Comparing with null is better expressed by the .is_null() method
--> $DIR/cmp_null.rs:21:8
--> $DIR/cmp_null.rs:18:8
|
21 | if p == ptr::null() {
18 | if p == ptr::null() {
| ^^^^^^^^^^^^^^^^
|
= note: `-D clippy::cmp-null` implied by `-D warnings`
error: Comparing with null is better expressed by the .is_null() method
--> $DIR/cmp_null.rs:26:8
--> $DIR/cmp_null.rs:23:8
|
26 | if m == ptr::null_mut() {
23 | if m == ptr::null_mut() {
| ^^^^^^^^^^^^^^^^^^^^
error: aborting due to 2 previous errors

View file

@ -1,57 +1,57 @@
error: this creates an owned instance just for comparison
--> $DIR/cmp_owned.rs:18:14
--> $DIR/cmp_owned.rs:14:14
|
18 | x != "foo".to_string();
14 | x != "foo".to_string();
| ^^^^^^^^^^^^^^^^^ help: try: `"foo"`
|
= note: `-D clippy::cmp-owned` implied by `-D warnings`
error: this creates an owned instance just for comparison
--> $DIR/cmp_owned.rs:20:9
--> $DIR/cmp_owned.rs:16:9
|
20 | "foo".to_string() != x;
16 | "foo".to_string() != x;
| ^^^^^^^^^^^^^^^^^ help: try: `"foo"`
error: this creates an owned instance just for comparison
--> $DIR/cmp_owned.rs:27:10
--> $DIR/cmp_owned.rs:23:10
|
27 | x != "foo".to_owned();
23 | x != "foo".to_owned();
| ^^^^^^^^^^^^^^^^ help: try: `"foo"`
error: this creates an owned instance just for comparison
--> $DIR/cmp_owned.rs:29:10
--> $DIR/cmp_owned.rs:25:10
|
29 | x != String::from("foo");
25 | x != String::from("foo");
| ^^^^^^^^^^^^^^^^^^^ help: try: `"foo"`
error: this creates an owned instance just for comparison
--> $DIR/cmp_owned.rs:33:5
--> $DIR/cmp_owned.rs:29:5
|
33 | Foo.to_owned() == Foo;
29 | Foo.to_owned() == Foo;
| ^^^^^^^^^^^^^^ help: try: `Foo`
error: this creates an owned instance just for comparison
--> $DIR/cmp_owned.rs:35:30
--> $DIR/cmp_owned.rs:31:30
|
35 | "abc".chars().filter(|c| c.to_owned() != 'X');
31 | "abc".chars().filter(|c| c.to_owned() != 'X');
| ^^^^^^^^^^^^ help: try: `*c`
error: this creates an owned instance just for comparison
--> $DIR/cmp_owned.rs:42:5
--> $DIR/cmp_owned.rs:38:5
|
42 | y.to_owned() == *x;
38 | y.to_owned() == *x;
| ^^^^^^^^^^^^^^^^^^ try implementing the comparison without allocating
error: this creates an owned instance just for comparison
--> $DIR/cmp_owned.rs:47:5
--> $DIR/cmp_owned.rs:43:5
|
47 | y.to_owned() == **x;
43 | y.to_owned() == **x;
| ^^^^^^^^^^^^^^^^^^^ try implementing the comparison without allocating
error: this creates an owned instance just for comparison
--> $DIR/cmp_owned.rs:54:9
--> $DIR/cmp_owned.rs:50:9
|
54 | self.to_owned() == *other
50 | self.to_owned() == *other
| ^^^^^^^^^^^^^^^^^^^^^^^^^ try implementing the comparison without allocating
error: aborting due to 9 previous errors

View file

@ -1,259 +1,259 @@
error: this if statement can be collapsed
--> $DIR/collapsible_if.rs:16:5
--> $DIR/collapsible_if.rs:15:5
|
16 | / if x == "hello" {
17 | | if y == "world" {
18 | | println!("Hello world!");
19 | | }
20 | | }
15 | / if x == "hello" {
16 | | if y == "world" {
17 | | println!("Hello world!");
18 | | }
19 | | }
| |_____^
|
= note: `-D clippy::collapsible-if` implied by `-D warnings`
help: try
|
16 | if x == "hello" && y == "world" {
17 | println!("Hello world!");
18 | }
15 | if x == "hello" && y == "world" {
16 | println!("Hello world!");
17 | }
|
error: this if statement can be collapsed
--> $DIR/collapsible_if.rs:22:5
--> $DIR/collapsible_if.rs:21:5
|
22 | / if x == "hello" || x == "world" {
23 | | if y == "world" || y == "hello" {
24 | | println!("Hello world!");
25 | | }
26 | | }
21 | / if x == "hello" || x == "world" {
22 | | if y == "world" || y == "hello" {
23 | | println!("Hello world!");
24 | | }
25 | | }
| |_____^
help: try
|
22 | if (x == "hello" || x == "world") && (y == "world" || y == "hello") {
23 | println!("Hello world!");
24 | }
21 | if (x == "hello" || x == "world") && (y == "world" || y == "hello") {
22 | println!("Hello world!");
23 | }
|
error: this if statement can be collapsed
--> $DIR/collapsible_if.rs:28:5
--> $DIR/collapsible_if.rs:27:5
|
28 | / if x == "hello" && x == "world" {
29 | | if y == "world" || y == "hello" {
30 | | println!("Hello world!");
31 | | }
32 | | }
27 | / if x == "hello" && x == "world" {
28 | | if y == "world" || y == "hello" {
29 | | println!("Hello world!");
30 | | }
31 | | }
| |_____^
help: try
|
28 | if x == "hello" && x == "world" && (y == "world" || y == "hello") {
29 | println!("Hello world!");
30 | }
27 | if x == "hello" && x == "world" && (y == "world" || y == "hello") {
28 | println!("Hello world!");
29 | }
|
error: this if statement can be collapsed
--> $DIR/collapsible_if.rs:34:5
--> $DIR/collapsible_if.rs:33:5
|
34 | / if x == "hello" || x == "world" {
35 | | if y == "world" && y == "hello" {
36 | | println!("Hello world!");
37 | | }
38 | | }
33 | / if x == "hello" || x == "world" {
34 | | if y == "world" && y == "hello" {
35 | | println!("Hello world!");
36 | | }
37 | | }
| |_____^
help: try
|
34 | if (x == "hello" || x == "world") && y == "world" && y == "hello" {
35 | println!("Hello world!");
36 | }
33 | if (x == "hello" || x == "world") && y == "world" && y == "hello" {
34 | println!("Hello world!");
35 | }
|
error: this if statement can be collapsed
--> $DIR/collapsible_if.rs:40:5
--> $DIR/collapsible_if.rs:39:5
|
40 | / if x == "hello" && x == "world" {
41 | | if y == "world" && y == "hello" {
42 | | println!("Hello world!");
43 | | }
44 | | }
39 | / if x == "hello" && x == "world" {
40 | | if y == "world" && y == "hello" {
41 | | println!("Hello world!");
42 | | }
43 | | }
| |_____^
help: try
|
40 | if x == "hello" && x == "world" && y == "world" && y == "hello" {
41 | println!("Hello world!");
42 | }
39 | if x == "hello" && x == "world" && y == "world" && y == "hello" {
40 | println!("Hello world!");
41 | }
|
error: this if statement can be collapsed
--> $DIR/collapsible_if.rs:46:5
--> $DIR/collapsible_if.rs:45:5
|
46 | / if 42 == 1337 {
47 | | if 'a' != 'A' {
48 | | println!("world!")
49 | | }
50 | | }
45 | / if 42 == 1337 {
46 | | if 'a' != 'A' {
47 | | println!("world!")
48 | | }
49 | | }
| |_____^
help: try
|
46 | if 42 == 1337 && 'a' != 'A' {
47 | println!("world!")
48 | }
45 | if 42 == 1337 && 'a' != 'A' {
46 | println!("world!")
47 | }
|
error: this `else { if .. }` block can be collapsed
--> $DIR/collapsible_if.rs:55:12
--> $DIR/collapsible_if.rs:54:12
|
55 | } else {
54 | } else {
| ____________^
56 | | if y == "world" {
57 | | println!("world!")
58 | | }
59 | | }
55 | | if y == "world" {
56 | | println!("world!")
57 | | }
58 | | }
| |_____^
help: try
|
55 | } else if y == "world" {
56 | println!("world!")
57 | }
54 | } else if y == "world" {
55 | println!("world!")
56 | }
|
error: this `else { if .. }` block can be collapsed
--> $DIR/collapsible_if.rs:63:12
--> $DIR/collapsible_if.rs:62:12
|
63 | } else {
62 | } else {
| ____________^
64 | | if let Some(42) = Some(42) {
65 | | println!("world!")
66 | | }
67 | | }
63 | | if let Some(42) = Some(42) {
64 | | println!("world!")
65 | | }
66 | | }
| |_____^
help: try
|
63 | } else if let Some(42) = Some(42) {
64 | println!("world!")
65 | }
62 | } else if let Some(42) = Some(42) {
63 | println!("world!")
64 | }
|
error: this `else { if .. }` block can be collapsed
--> $DIR/collapsible_if.rs:71:12
--> $DIR/collapsible_if.rs:70:12
|
71 | } else {
70 | } else {
| ____________^
72 | | if y == "world" {
73 | | println!("world")
74 | | }
71 | | if y == "world" {
72 | | println!("world")
73 | | }
... |
77 | | }
78 | | }
76 | | }
77 | | }
| |_____^
help: try
|
71 | } else if y == "world" {
72 | println!("world")
73 | }
74 | else {
75 | println!("!")
76 | }
70 | } else if y == "world" {
71 | println!("world")
72 | }
73 | else {
74 | println!("!")
75 | }
|
error: this `else { if .. }` block can be collapsed
--> $DIR/collapsible_if.rs:82:12
--> $DIR/collapsible_if.rs:81:12
|
82 | } else {
81 | } else {
| ____________^
83 | | if let Some(42) = Some(42) {
84 | | println!("world")
85 | | }
82 | | if let Some(42) = Some(42) {
83 | | println!("world")
84 | | }
... |
88 | | }
89 | | }
87 | | }
88 | | }
| |_____^
help: try
|
82 | } else if let Some(42) = Some(42) {
83 | println!("world")
84 | }
85 | else {
86 | println!("!")
87 | }
81 | } else if let Some(42) = Some(42) {
82 | println!("world")
83 | }
84 | else {
85 | println!("!")
86 | }
|
error: this `else { if .. }` block can be collapsed
--> $DIR/collapsible_if.rs:93:12
--> $DIR/collapsible_if.rs:92:12
|
92 | } else {
| ____________^
93 | | if let Some(42) = Some(42) {
94 | | println!("world")
95 | | }
... |
98 | | }
99 | | }
| |_____^
help: try
|
92 | } else if let Some(42) = Some(42) {
93 | println!("world")
94 | }
95 | else {
96 | println!("!")
97 | }
|
error: this `else { if .. }` block can be collapsed
--> $DIR/collapsible_if.rs:103:12
|
93 | } else {
103 | } else {
| ____________^
94 | | if let Some(42) = Some(42) {
95 | | println!("world")
96 | | }
104 | | if x == "hello" {
105 | | println!("world")
106 | | }
... |
99 | | }
100 | | }
109 | | }
110 | | }
| |_____^
help: try
|
93 | } else if let Some(42) = Some(42) {
94 | println!("world")
95 | }
96 | else {
97 | println!("!")
98 | }
103 | } else if x == "hello" {
104 | println!("world")
105 | }
106 | else {
107 | println!("!")
108 | }
|
error: this `else { if .. }` block can be collapsed
--> $DIR/collapsible_if.rs:104:12
--> $DIR/collapsible_if.rs:114:12
|
104 | } else {
114 | } else {
| ____________^
105 | | if x == "hello" {
106 | | println!("world")
107 | | }
115 | | if let Some(42) = Some(42) {
116 | | println!("world")
117 | | }
... |
110 | | }
111 | | }
120 | | }
121 | | }
| |_____^
help: try
|
104 | } else if x == "hello" {
105 | println!("world")
106 | }
107 | else {
108 | println!("!")
109 | }
|
error: this `else { if .. }` block can be collapsed
--> $DIR/collapsible_if.rs:115:12
|
115 | } else {
| ____________^
116 | | if let Some(42) = Some(42) {
117 | | println!("world")
118 | | }
... |
121 | | }
122 | | }
| |_____^
help: try
|
115 | } else if let Some(42) = Some(42) {
116 | println!("world")
117 | }
118 | else {
119 | println!("!")
120 | }
114 | } else if let Some(42) = Some(42) {
115 | println!("world")
116 | }
117 | else {
118 | println!("!")
119 | }
|
error: this if statement can be collapsed
--> $DIR/collapsible_if.rs:174:5
--> $DIR/collapsible_if.rs:173:5
|
174 | / if x == "hello" {
175 | | if y == "world" { // Collapsible
176 | | println!("Hello world!");
177 | | }
178 | | }
173 | / if x == "hello" {
174 | | if y == "world" { // Collapsible
175 | | println!("Hello world!");
176 | | }
177 | | }
| |_____^
help: try
|
174 | if x == "hello" && y == "world" { // Collapsible
175 | println!("Hello world!");
176 | }
173 | if x == "hello" && y == "world" { // Collapsible
174 | println!("Hello world!");
175 | }
|
error: aborting due to 14 previous errors

View file

@ -1,93 +1,93 @@
error: very complex type used. Consider factoring parts into `type` definitions
--> $DIR/complex_types.rs:19:12
--> $DIR/complex_types.rs:16:12
|
19 | const CST: (u32, (u32, (u32, (u32, u32)))) = (0, (0, (0, (0, 0))));
16 | const CST: (u32, (u32, (u32, (u32, u32)))) = (0, (0, (0, (0, 0))));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: `-D clippy::type-complexity` implied by `-D warnings`
error: very complex type used. Consider factoring parts into `type` definitions
--> $DIR/complex_types.rs:20:12
--> $DIR/complex_types.rs:17:12
|
20 | static ST: (u32, (u32, (u32, (u32, u32)))) = (0, (0, (0, (0, 0))));
17 | static ST: (u32, (u32, (u32, (u32, u32)))) = (0, (0, (0, (0, 0))));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: very complex type used. Consider factoring parts into `type` definitions
--> $DIR/complex_types.rs:23:8
--> $DIR/complex_types.rs:20:8
|
23 | f: Vec<Vec<Box<(u32, u32, u32, u32)>>>,
20 | f: Vec<Vec<Box<(u32, u32, u32, u32)>>>,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: very complex type used. Consider factoring parts into `type` definitions
--> $DIR/complex_types.rs:23:11
|
23 | struct TS(Vec<Vec<Box<(u32, u32, u32, u32)>>>);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: very complex type used. Consider factoring parts into `type` definitions
--> $DIR/complex_types.rs:26:11
|
26 | struct TS(Vec<Vec<Box<(u32, u32, u32, u32)>>>);
26 | Tuple(Vec<Vec<Box<(u32, u32, u32, u32)>>>),
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: very complex type used. Consider factoring parts into `type` definitions
--> $DIR/complex_types.rs:29:11
--> $DIR/complex_types.rs:27:17
|
29 | Tuple(Vec<Vec<Box<(u32, u32, u32, u32)>>>),
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: very complex type used. Consider factoring parts into `type` definitions
--> $DIR/complex_types.rs:30:17
|
30 | Struct { f: Vec<Vec<Box<(u32, u32, u32, u32)>>> },
27 | Struct { f: Vec<Vec<Box<(u32, u32, u32, u32)>>> },
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: very complex type used. Consider factoring parts into `type` definitions
--> $DIR/complex_types.rs:34:14
--> $DIR/complex_types.rs:31:14
|
34 | const A: (u32, (u32, (u32, (u32, u32)))) = (0, (0, (0, (0, 0))));
31 | const A: (u32, (u32, (u32, (u32, u32)))) = (0, (0, (0, (0, 0))));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: very complex type used. Consider factoring parts into `type` definitions
--> $DIR/complex_types.rs:35:30
--> $DIR/complex_types.rs:32:30
|
35 | fn impl_method(&self, p: Vec<Vec<Box<(u32, u32, u32, u32)>>>) { }
32 | fn impl_method(&self, p: Vec<Vec<Box<(u32, u32, u32, u32)>>>) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: very complex type used. Consider factoring parts into `type` definitions
--> $DIR/complex_types.rs:39:14
--> $DIR/complex_types.rs:36:14
|
39 | const A: Vec<Vec<Box<(u32, u32, u32, u32)>>>;
36 | const A: Vec<Vec<Box<(u32, u32, u32, u32)>>>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: very complex type used. Consider factoring parts into `type` definitions
--> $DIR/complex_types.rs:40:14
--> $DIR/complex_types.rs:37:14
|
40 | type B = Vec<Vec<Box<(u32, u32, u32, u32)>>>;
37 | type B = Vec<Vec<Box<(u32, u32, u32, u32)>>>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: very complex type used. Consider factoring parts into `type` definitions
--> $DIR/complex_types.rs:41:25
--> $DIR/complex_types.rs:38:25
|
41 | fn method(&self, p: Vec<Vec<Box<(u32, u32, u32, u32)>>>);
38 | fn method(&self, p: Vec<Vec<Box<(u32, u32, u32, u32)>>>);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: very complex type used. Consider factoring parts into `type` definitions
--> $DIR/complex_types.rs:42:29
--> $DIR/complex_types.rs:39:29
|
42 | fn def_method(&self, p: Vec<Vec<Box<(u32, u32, u32, u32)>>>) { }
39 | fn def_method(&self, p: Vec<Vec<Box<(u32, u32, u32, u32)>>>) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: very complex type used. Consider factoring parts into `type` definitions
--> $DIR/complex_types.rs:45:15
--> $DIR/complex_types.rs:42:15
|
45 | fn test1() -> Vec<Vec<Box<(u32, u32, u32, u32)>>> { vec![] }
42 | fn test1() -> Vec<Vec<Box<(u32, u32, u32, u32)>>> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: very complex type used. Consider factoring parts into `type` definitions
--> $DIR/complex_types.rs:47:14
--> $DIR/complex_types.rs:46:14
|
47 | fn test2(_x: Vec<Vec<Box<(u32, u32, u32, u32)>>>) { }
46 | fn test2(_x: Vec<Vec<Box<(u32, u32, u32, u32)>>>) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: very complex type used. Consider factoring parts into `type` definitions
--> $DIR/complex_types.rs:50:13
--> $DIR/complex_types.rs:49:13
|
50 | let _y: Vec<Vec<Box<(u32, u32, u32, u32)>>> = vec![];
49 | let _y: Vec<Vec<Box<(u32, u32, u32, u32)>>> = vec![];
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to 15 previous errors

View file

@ -1,81 +1,81 @@
error: Constants have by default a `'static` lifetime
--> $DIR/const_static_lifetime.rs:14:17
--> $DIR/const_static_lifetime.rs:13:17
|
14 | const VAR_ONE: &'static str = "Test constant #1"; // ERROR Consider removing 'static.
13 | const VAR_ONE: &'static str = "Test constant #1"; // ERROR Consider removing 'static.
| -^^^^^^^---- help: consider removing `'static`: `&str`
|
= note: `-D clippy::const-static-lifetime` implied by `-D warnings`
error: Constants have by default a `'static` lifetime
--> $DIR/const_static_lifetime.rs:18:21
--> $DIR/const_static_lifetime.rs:17:21
|
18 | const VAR_THREE: &[&'static str] = &["one", "two"]; // ERROR Consider removing 'static
17 | const VAR_THREE: &[&'static str] = &["one", "two"]; // ERROR Consider removing 'static
| -^^^^^^^---- help: consider removing `'static`: `&str`
error: Constants have by default a `'static` lifetime
--> $DIR/const_static_lifetime.rs:20:32
--> $DIR/const_static_lifetime.rs:19:32
|
20 | const VAR_FOUR: (&str, (&str, &'static str), &'static str) = ("on", ("th", "th"), "on"); // ERROR Consider removing 'static
19 | const VAR_FOUR: (&str, (&str, &'static str), &'static str) = ("on", ("th", "th"), "on"); // ERROR Consider removing 'static
| -^^^^^^^---- help: consider removing `'static`: `&str`
error: Constants have by default a `'static` lifetime
--> $DIR/const_static_lifetime.rs:20:47
--> $DIR/const_static_lifetime.rs:19:47
|
20 | const VAR_FOUR: (&str, (&str, &'static str), &'static str) = ("on", ("th", "th"), "on"); // ERROR Consider removing 'static
19 | const VAR_FOUR: (&str, (&str, &'static str), &'static str) = ("on", ("th", "th"), "on"); // ERROR Consider removing 'static
| -^^^^^^^---- help: consider removing `'static`: `&str`
error: Constants have by default a `'static` lifetime
--> $DIR/const_static_lifetime.rs:22:18
--> $DIR/const_static_lifetime.rs:21:18
|
22 | const VAR_FIVE: &'static [&[&'static str]] = &[&["test"], &["other one"]]; // ERROR Consider removing 'static
21 | const VAR_FIVE: &'static [&[&'static str]] = &[&["test"], &["other one"]]; // ERROR Consider removing 'static
| -^^^^^^^------------------ help: consider removing `'static`: `&[&[&'static str]]`
error: Constants have by default a `'static` lifetime
--> $DIR/const_static_lifetime.rs:22:30
--> $DIR/const_static_lifetime.rs:21:30
|
22 | const VAR_FIVE: &'static [&[&'static str]] = &[&["test"], &["other one"]]; // ERROR Consider removing 'static
21 | const VAR_FIVE: &'static [&[&'static str]] = &[&["test"], &["other one"]]; // ERROR Consider removing 'static
| -^^^^^^^---- help: consider removing `'static`: `&str`
error: Constants have by default a `'static` lifetime
--> $DIR/const_static_lifetime.rs:24:17
--> $DIR/const_static_lifetime.rs:23:17
|
24 | const VAR_SIX: &'static u8 = &5;
23 | const VAR_SIX: &'static u8 = &5;
| -^^^^^^^--- help: consider removing `'static`: `&u8`
error: Constants have by default a `'static` lifetime
--> $DIR/const_static_lifetime.rs:26:29
--> $DIR/const_static_lifetime.rs:25:29
|
26 | const VAR_SEVEN: &[&(&str, &'static [&'static str])] = &[&("one", &["other one"])];
25 | const VAR_SEVEN: &[&(&str, &'static [&'static str])] = &[&("one", &["other one"])];
| -^^^^^^^--------------- help: consider removing `'static`: `&[&'static str]`
error: Constants have by default a `'static` lifetime
--> $DIR/const_static_lifetime.rs:26:39
--> $DIR/const_static_lifetime.rs:25:39
|
26 | const VAR_SEVEN: &[&(&str, &'static [&'static str])] = &[&("one", &["other one"])];
25 | const VAR_SEVEN: &[&(&str, &'static [&'static str])] = &[&("one", &["other one"])];
| -^^^^^^^---- help: consider removing `'static`: `&str`
error: Constants have by default a `'static` lifetime
--> $DIR/const_static_lifetime.rs:28:20
--> $DIR/const_static_lifetime.rs:27:20
|
28 | const VAR_HEIGHT: &'static Foo = &Foo {};
27 | const VAR_HEIGHT: &'static Foo = &Foo {};
| -^^^^^^^---- help: consider removing `'static`: `&Foo`
error: Constants have by default a `'static` lifetime
--> $DIR/const_static_lifetime.rs:30:19
--> $DIR/const_static_lifetime.rs:29:19
|
30 | const VAR_SLICE: &'static [u8] = b"Test constant #1"; // ERROR Consider removing 'static.
29 | const VAR_SLICE: &'static [u8] = b"Test constant #1"; // ERROR Consider removing 'static.
| -^^^^^^^----- help: consider removing `'static`: `&[u8]`
error: Constants have by default a `'static` lifetime
--> $DIR/const_static_lifetime.rs:32:19
--> $DIR/const_static_lifetime.rs:31:19
|
32 | const VAR_TUPLE: &'static (u8, u8) = &(1, 2); // ERROR Consider removing 'static.
31 | const VAR_TUPLE: &'static (u8, u8) = &(1, 2); // ERROR Consider removing 'static.
| -^^^^^^^--------- help: consider removing `'static`: `&(u8, u8)`
error: Constants have by default a `'static` lifetime
--> $DIR/const_static_lifetime.rs:34:19
--> $DIR/const_static_lifetime.rs:33:19
|
34 | const VAR_ARRAY: &'static [u8; 1] = b"T"; // ERROR Consider removing 'static.
33 | const VAR_ARRAY: &'static [u8; 1] = b"T"; // ERROR Consider removing 'static.
| -^^^^^^^-------- help: consider removing `'static`: `&[u8; 1]`
error: aborting due to 13 previous errors

View file

@ -1,385 +1,392 @@
error: this `if` has identical blocks
--> $DIR/copies.rs:41:10
--> $DIR/copies.rs:50:12
|
41 | else { //~ ERROR same body as `if` block
| __________^
42 | | Foo { bar: 42 };
43 | | 0..10;
44 | | ..;
50 | } else {
| ____________^
51 | | //~ ERROR same body as `if` block
52 | | Foo { bar: 42 };
53 | | 0..10;
... |
48 | | foo();
49 | | }
58 | | foo();
59 | | }
| |_____^
|
= note: `-D clippy::if-same-then-else` implied by `-D warnings`
note: same as this
--> $DIR/copies.rs:32:13
--> $DIR/copies.rs:42:13
|
32 | if true {
42 | if true {
| _____________^
33 | | Foo { bar: 42 };
34 | | 0..10;
35 | | ..;
43 | | Foo { bar: 42 };
44 | | 0..10;
45 | | ..;
... |
39 | | foo();
40 | | }
49 | | foo();
50 | | } else {
| |_____^
error: this `match` has identical arm bodies
--> $DIR/copies.rs:90:14
|
90 | _ => { //~ ERROR match arms have same body
| ______________^
91 | | foo();
92 | | let mut a = 42 + [23].len() as i32;
93 | | if true {
... |
97 | | a
98 | | }
| |_________^
|
= note: `-D clippy::match-same-arms` implied by `-D warnings`
--> $DIR/copies.rs:96:14
|
96 | _ => {
| ______________^
97 | | //~ ERROR match arms have same body
98 | | foo();
99 | | let mut a = 42 + [23].len() as i32;
... |
104 | | a
105 | | },
| |_________^
|
= note: `-D clippy::match-same-arms` implied by `-D warnings`
note: same as this
--> $DIR/copies.rs:81:15
|
81 | 42 => {
| _______________^
82 | | foo();
83 | | let mut a = 42 + [23].len() as i32;
84 | | if true {
... |
88 | | a
89 | | }
| |_________^
--> $DIR/copies.rs:87:15
|
87 | 42 => {
| _______________^
88 | | foo();
89 | | let mut a = 42 + [23].len() as i32;
90 | | if true {
... |
94 | | a
95 | | },
| |_________^
note: `42` has the same arm body as the `_` wildcard, consider removing it`
--> $DIR/copies.rs:81:15
|
81 | 42 => {
| _______________^
82 | | foo();
83 | | let mut a = 42 + [23].len() as i32;
84 | | if true {
... |
88 | | a
89 | | }
| |_________^
--> $DIR/copies.rs:87:15
|
87 | 42 => {
| _______________^
88 | | foo();
89 | | let mut a = 42 + [23].len() as i32;
90 | | if true {
... |
94 | | a
95 | | },
| |_________^
error: this `match` has identical arm bodies
--> $DIR/copies.rs:104:14
--> $DIR/copies.rs:111:14
|
104 | _ => 0, //~ ERROR match arms have same body
111 | _ => 0, //~ ERROR match arms have same body
| ^
|
note: same as this
--> $DIR/copies.rs:102:19
--> $DIR/copies.rs:109:19
|
102 | Abc::A => 0,
109 | Abc::A => 0,
| ^
note: `Abc::A` has the same arm body as the `_` wildcard, consider removing it`
--> $DIR/copies.rs:102:19
--> $DIR/copies.rs:109:19
|
102 | Abc::A => 0,
109 | Abc::A => 0,
| ^
error: this `if` has identical blocks
--> $DIR/copies.rs:114:10
--> $DIR/copies.rs:120:12
|
114 | else { //~ ERROR same body as `if` block
| __________^
115 | | 42
116 | | };
120 | } else {
| ____________^
121 | | //~ ERROR same body as `if` block
122 | | 42
123 | | };
| |_____^
|
note: same as this
--> $DIR/copies.rs:111:21
--> $DIR/copies.rs:118:21
|
111 | let _ = if true {
118 | let _ = if true {
| _____________________^
112 | | 42
113 | | }
119 | | 42
120 | | } else {
| |_____^
error: this `if` has identical blocks
--> $DIR/copies.rs:128:10
--> $DIR/copies.rs:134:12
|
128 | else { //~ ERROR same body as `if` block
| __________^
129 | | for _ in &[42] {
130 | | let foo: &Option<_> = &Some::<u8>(42);
131 | | if true {
134 | } else {
| ____________^
135 | | //~ ERROR same body as `if` block
136 | | for _ in &[42] {
137 | | let foo: &Option<_> = &Some::<u8>(42);
... |
136 | | }
137 | | }
143 | | }
144 | | }
| |_____^
|
note: same as this
--> $DIR/copies.rs:118:13
--> $DIR/copies.rs:125:13
|
118 | if true {
125 | if true {
| _____________^
119 | | for _ in &[42] {
120 | | let foo: &Option<_> = &Some::<u8>(42);
121 | | if true {
126 | | for _ in &[42] {
127 | | let foo: &Option<_> = &Some::<u8>(42);
128 | | if true {
... |
126 | | }
127 | | }
133 | | }
134 | | } else {
| |_____^
error: this `if` has identical blocks
--> $DIR/copies.rs:150:10
--> $DIR/copies.rs:153:12
|
150 | else { //~ ERROR same body as `if` block
| __________^
151 | | let bar = if true {
152 | | 42
153 | | }
153 | } else {
| ____________^
154 | | //~ ERROR same body as `if` block
155 | | let bar = if true { 42 } else { 43 };
156 | |
... |
159 | | bar + 1;
160 | | }
160 | | bar + 1;
161 | | }
| |_____^
|
note: same as this
--> $DIR/copies.rs:139:13
--> $DIR/copies.rs:146:13
|
139 | if true {
146 | if true {
| _____________^
140 | | let bar = if true {
141 | | 42
142 | | }
147 | | let bar = if true { 42 } else { 43 };
148 | |
149 | | while foo() {
... |
148 | | bar + 1;
149 | | }
152 | | bar + 1;
153 | | } else {
| |_____^
error: this `if` has identical blocks
--> $DIR/copies.rs:185:10
--> $DIR/copies.rs:183:12
|
185 | else { //~ ERROR same body as `if` block
| __________^
186 | | if let Some(a) = Some(42) {}
187 | | }
183 | } else {
| ____________^
184 | | //~ ERROR same body as `if` block
185 | | if let Some(a) = Some(42) {}
186 | | }
| |_____^
|
note: same as this
--> $DIR/copies.rs:182:13
--> $DIR/copies.rs:181:13
|
182 | if true {
181 | if true {
| _____________^
183 | | if let Some(a) = Some(42) {}
184 | | }
182 | | if let Some(a) = Some(42) {}
183 | | } else {
| |_____^
error: this `if` has identical blocks
--> $DIR/copies.rs:192:10
--> $DIR/copies.rs:190:12
|
192 | else { //~ ERROR same body as `if` block
| __________^
193 | | if let (1, .., 3) = (1, 2, 3) {}
194 | | }
190 | } else {
| ____________^
191 | | //~ ERROR same body as `if` block
192 | | if let (1, .., 3) = (1, 2, 3) {}
193 | | }
| |_____^
|
note: same as this
--> $DIR/copies.rs:189:13
--> $DIR/copies.rs:188:13
|
189 | if true {
188 | if true {
| _____________^
190 | | if let (1, .., 3) = (1, 2, 3) {}
191 | | }
189 | | if let (1, .., 3) = (1, 2, 3) {}
190 | | } else {
| |_____^
error: this `match` has identical arm bodies
--> $DIR/copies.rs:247:15
--> $DIR/copies.rs:239:15
|
247 | 51 => foo(), //~ ERROR match arms have same body
239 | 51 => foo(), //~ ERROR match arms have same body
| ^^^^^
|
note: same as this
--> $DIR/copies.rs:246:15
--> $DIR/copies.rs:238:15
|
246 | 42 => foo(),
238 | 42 => foo(),
| ^^^^^
note: consider refactoring into `42 | 51`
--> $DIR/copies.rs:246:15
--> $DIR/copies.rs:238:15
|
246 | 42 => foo(),
238 | 42 => foo(),
| ^^^^^
error: this `match` has identical arm bodies
--> $DIR/copies.rs:253:17
--> $DIR/copies.rs:245:17
|
253 | None => 24, //~ ERROR match arms have same body
245 | None => 24, //~ ERROR match arms have same body
| ^^
|
note: same as this
--> $DIR/copies.rs:252:20
--> $DIR/copies.rs:244:20
|
252 | Some(_) => 24,
244 | Some(_) => 24,
| ^^
note: consider refactoring into `Some(_) | None`
--> $DIR/copies.rs:252:20
--> $DIR/copies.rs:244:20
|
252 | Some(_) => 24,
244 | Some(_) => 24,
| ^^
error: this `match` has identical arm bodies
--> $DIR/copies.rs:275:28
--> $DIR/copies.rs:267:28
|
275 | (None, Some(a)) => bar(a), //~ ERROR match arms have same body
267 | (None, Some(a)) => bar(a), //~ ERROR match arms have same body
| ^^^^^^
|
note: same as this
--> $DIR/copies.rs:274:28
--> $DIR/copies.rs:266:28
|
274 | (Some(a), None) => bar(a),
266 | (Some(a), None) => bar(a),
| ^^^^^^
note: consider refactoring into `(Some(a), None) | (None, Some(a))`
--> $DIR/copies.rs:274:28
--> $DIR/copies.rs:266:28
|
274 | (Some(a), None) => bar(a),
266 | (Some(a), None) => bar(a),
| ^^^^^^
error: this `match` has identical arm bodies
--> $DIR/copies.rs:281:26
--> $DIR/copies.rs:273:26
|
281 | (.., Some(a)) => bar(a), //~ ERROR match arms have same body
273 | (.., Some(a)) => bar(a), //~ ERROR match arms have same body
| ^^^^^^
|
note: same as this
--> $DIR/copies.rs:280:26
--> $DIR/copies.rs:272:26
|
280 | (Some(a), ..) => bar(a),
272 | (Some(a), ..) => bar(a),
| ^^^^^^
note: consider refactoring into `(Some(a), ..) | (.., Some(a))`
--> $DIR/copies.rs:280:26
--> $DIR/copies.rs:272:26
|
280 | (Some(a), ..) => bar(a),
272 | (Some(a), ..) => bar(a),
| ^^^^^^
error: this `match` has identical arm bodies
--> $DIR/copies.rs:287:20
--> $DIR/copies.rs:279:20
|
287 | (.., 3) => 42, //~ ERROR match arms have same body
279 | (.., 3) => 42, //~ ERROR match arms have same body
| ^^
|
note: same as this
--> $DIR/copies.rs:286:23
--> $DIR/copies.rs:278:23
|
286 | (1, .., 3) => 42,
278 | (1, .., 3) => 42,
| ^^
note: consider refactoring into `(1, .., 3) | (.., 3)`
--> $DIR/copies.rs:286:23
--> $DIR/copies.rs:278:23
|
286 | (1, .., 3) => 42,
278 | (1, .., 3) => 42,
| ^^
error: this `if` has identical blocks
--> $DIR/copies.rs:293:12
--> $DIR/copies.rs:285:12
|
293 | } else { //~ ERROR same body as `if` block
285 | } else {
| ____________^
294 | | 0.0
286 | | //~ ERROR same body as `if` block
287 | | 0.0
288 | | };
| |_____^
|
note: same as this
--> $DIR/copies.rs:283:21
|
283 | let _ = if true {
| _____________________^
284 | | 0.0
285 | | } else {
| |_____^
error: this `if` has identical blocks
--> $DIR/copies.rs:292:12
|
292 | } else {
| ____________^
293 | | //~ ERROR same body as `if` block
294 | | -0.0
295 | | };
| |_____^
|
note: same as this
--> $DIR/copies.rs:291:21
--> $DIR/copies.rs:290:21
|
291 | let _ = if true {
290 | let _ = if true {
| _____________________^
292 | | 0.0
293 | | } else { //~ ERROR same body as `if` block
291 | | -0.0
292 | | } else {
| |_____^
error: this `if` has identical blocks
--> $DIR/copies.rs:299:12
--> $DIR/copies.rs:305:12
|
299 | } else { //~ ERROR same body as `if` block
305 | } else {
| ____________^
300 | | -0.0
301 | | };
306 | | //~ ERROR same body as `if` block
307 | | std::f32::NAN
308 | | };
| |_____^
|
note: same as this
--> $DIR/copies.rs:297:21
--> $DIR/copies.rs:303:21
|
297 | let _ = if true {
303 | let _ = if true {
| _____________________^
298 | | -0.0
299 | | } else { //~ ERROR same body as `if` block
304 | | std::f32::NAN
305 | | } else {
| |_____^
error: this `if` has identical blocks
--> $DIR/copies.rs:319:12
--> $DIR/copies.rs:323:12
|
319 | } else { //~ ERROR same body as `if` block
323 | } else {
| ____________^
320 | | std::f32::NAN
321 | | };
324 | | //~ ERROR same body as `if` block
325 | | try!(Ok("foo"));
326 | | }
| |_____^
|
note: same as this
--> $DIR/copies.rs:317:21
--> $DIR/copies.rs:321:13
|
317 | let _ = if true {
| _____________________^
318 | | std::f32::NAN
319 | | } else { //~ ERROR same body as `if` block
| |_____^
error: this `if` has identical blocks
--> $DIR/copies.rs:337:10
|
337 | else { //~ ERROR same body as `if` block
| __________^
338 | | try!(Ok("foo"));
339 | | }
| |_____^
|
note: same as this
--> $DIR/copies.rs:334:13
|
334 | if true {
321 | if true {
| _____________^
335 | | try!(Ok("foo"));
336 | | }
322 | | try!(Ok("foo"));
323 | | } else {
| |_____^
error: this `if` has the same condition as a previous if
--> $DIR/copies.rs:363:13
--> $DIR/copies.rs:347:15
|
363 | else if b { //~ ERROR ifs same condition
| ^
347 | } else if b {
| ^
|
= note: `-D clippy::ifs-same-cond` implied by `-D warnings`
note: same as this
--> $DIR/copies.rs:361:8
--> $DIR/copies.rs:346:8
|
361 | if b {
346 | if b {
| ^
error: this `if` has the same condition as a previous if
--> $DIR/copies.rs:368:13
--> $DIR/copies.rs:352:15
|
368 | else if a == 1 { //~ ERROR ifs same condition
| ^^^^^^
352 | } else if a == 1 {
| ^^^^^^
|
note: same as this
--> $DIR/copies.rs:366:8
--> $DIR/copies.rs:351:8
|
366 | if a == 1 {
351 | if a == 1 {
| ^^^^^^
error: this `if` has the same condition as a previous if
--> $DIR/copies.rs:375:13
--> $DIR/copies.rs:358:15
|
375 | else if 2*a == 1 { //~ ERROR ifs same condition
| ^^^^^^^^
358 | } else if 2 * a == 1 {
| ^^^^^^^^^^
|
note: same as this
--> $DIR/copies.rs:371:8
--> $DIR/copies.rs:356:8
|
371 | if 2*a == 1 {
| ^^^^^^^^
356 | if 2 * a == 1 {
| ^^^^^^^^^^
error: aborting due to 20 previous errors

View file

@ -1,13 +1,13 @@
error: you are implementing `Iterator` on a `Copy` type
--> $DIR/copy_iterator.rs:18:1
--> $DIR/copy_iterator.rs:15:1
|
18 | / impl Iterator for Countdown {
19 | | type Item = u8;
20 | |
21 | | fn next(&mut self) -> Option<u8> {
15 | / impl Iterator for Countdown {
16 | | type Item = u8;
17 | |
18 | | fn next(&mut self) -> Option<u8> {
... |
26 | | }
27 | | }
23 | | }
24 | | }
| |_^
|
= note: `-D clippy::copy-iterator` implied by `-D warnings`

View file

@ -1,15 +1,15 @@
error: you are getting the inner pointer of a temporary `CString`
--> $DIR/cstring.rs:19:5
--> $DIR/cstring.rs:16:5
|
19 | CString::new("foo").unwrap().as_ptr();
16 | CString::new("foo").unwrap().as_ptr();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: #[deny(clippy::temporary_cstring_as_ptr)] on by default
= note: that pointer will be invalid outside this expression
help: assign the `CString` to a variable to extend its lifetime
--> $DIR/cstring.rs:19:5
--> $DIR/cstring.rs:16:5
|
19 | CString::new("foo").unwrap().as_ptr();
16 | CString::new("foo").unwrap().as_ptr();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to previous error

View file

@ -1,270 +1,269 @@
error: the function has a cyclomatic complexity of 28
--> $DIR/cyclomatic_complexity.rs:16:1
--> $DIR/cyclomatic_complexity.rs:15:1
|
16 | / fn main() {
17 | | if true {
18 | | println!("a");
19 | | }
15 | / fn main() {
16 | | if true {
17 | | println!("a");
18 | | }
... |
97 | | }
98 | | }
96 | | }
97 | | }
| |_^
|
= note: `-D clippy::cyclomatic-complexity` implied by `-D warnings`
= help: you could split it up into multiple smaller functions
error: the function has a cyclomatic complexity of 7
--> $DIR/cyclomatic_complexity.rs:101:1
--> $DIR/cyclomatic_complexity.rs:100:1
|
101 | / fn kaboom() {
102 | | let n = 0;
103 | | 'a: for i in 0..20 {
104 | | 'b: for j in i..20 {
100 | / fn kaboom() {
101 | | let n = 0;
102 | | 'a: for i in 0..20 {
103 | | 'b: for j in i..20 {
... |
119 | | }
120 | | }
118 | | }
119 | | }
| |_^
|
= help: you could split it up into multiple smaller functions
error: the function has a cyclomatic complexity of 1
--> $DIR/cyclomatic_complexity.rs:147:1
--> $DIR/cyclomatic_complexity.rs:146:1
|
147 | / fn lots_of_short_circuits() -> bool {
148 | | true && false && true && false && true && false && true
149 | | }
146 | / fn lots_of_short_circuits() -> bool {
147 | | true && false && true && false && true && false && true
148 | | }
| |_^
|
= help: you could split it up into multiple smaller functions
error: the function has a cyclomatic complexity of 1
--> $DIR/cyclomatic_complexity.rs:152:1
--> $DIR/cyclomatic_complexity.rs:151:1
|
152 | / fn lots_of_short_circuits2() -> bool {
153 | | true || false || true || false || true || false || true
154 | | }
151 | / fn lots_of_short_circuits2() -> bool {
152 | | true || false || true || false || true || false || true
153 | | }
| |_^
|
= help: you could split it up into multiple smaller functions
error: the function has a cyclomatic complexity of 2
--> $DIR/cyclomatic_complexity.rs:157:1
--> $DIR/cyclomatic_complexity.rs:156:1
|
157 | / fn baa() {
158 | | let x = || match 99 {
159 | | 0 => 0,
160 | | 1 => 1,
156 | / fn baa() {
157 | | let x = || match 99 {
158 | | 0 => 0,
159 | | 1 => 1,
... |
171 | | }
172 | | }
170 | | }
171 | | }
| |_^
|
= help: you could split it up into multiple smaller functions
error: the function has a cyclomatic complexity of 2
--> $DIR/cyclomatic_complexity.rs:158:13
--> $DIR/cyclomatic_complexity.rs:157:13
|
158 | let x = || match 99 {
157 | let x = || match 99 {
| _____________^
159 | | 0 => 0,
160 | | 1 => 1,
161 | | 2 => 2,
158 | | 0 => 0,
159 | | 1 => 1,
160 | | 2 => 2,
... |
165 | | _ => 42,
166 | | };
164 | | _ => 42,
165 | | };
| |_____^
|
= help: you could split it up into multiple smaller functions
error: the function has a cyclomatic complexity of 2
--> $DIR/cyclomatic_complexity.rs:175:1
--> $DIR/cyclomatic_complexity.rs:174:1
|
175 | / fn bar() {
176 | | match 99 {
177 | | 0 => println!("hi"),
178 | | _ => println!("bye"),
179 | | }
180 | | }
174 | / fn bar() {
175 | | match 99 {
176 | | 0 => println!("hi"),
177 | | _ => println!("bye"),
178 | | }
179 | | }
| |_^
|
= help: you could split it up into multiple smaller functions
error: the function has a cyclomatic complexity of 2
--> $DIR/cyclomatic_complexity.rs:194:1
--> $DIR/cyclomatic_complexity.rs:193:1
|
194 | / fn barr() {
195 | | match 99 {
196 | | 0 => println!("hi"),
197 | | 1 => println!("bla"),
193 | / fn barr() {
194 | | match 99 {
195 | | 0 => println!("hi"),
196 | | 1 => println!("bla"),
... |
200 | | }
201 | | }
199 | | }
200 | | }
| |_^
|
= help: you could split it up into multiple smaller functions
error: the function has a cyclomatic complexity of 3
--> $DIR/cyclomatic_complexity.rs:204:1
--> $DIR/cyclomatic_complexity.rs:203:1
|
204 | / fn barr2() {
205 | | match 99 {
206 | | 0 => println!("hi"),
207 | | 1 => println!("bla"),
203 | / fn barr2() {
204 | | match 99 {
205 | | 0 => println!("hi"),
206 | | 1 => println!("bla"),
... |
216 | | }
217 | | }
215 | | }
216 | | }
| |_^
|
= help: you could split it up into multiple smaller functions
error: the function has a cyclomatic complexity of 2
--> $DIR/cyclomatic_complexity.rs:220:1
--> $DIR/cyclomatic_complexity.rs:219:1
|
220 | / fn barrr() {
221 | | match 99 {
222 | | 0 => println!("hi"),
223 | | 1 => panic!("bla"),
219 | / fn barrr() {
220 | | match 99 {
221 | | 0 => println!("hi"),
222 | | 1 => panic!("bla"),
... |
226 | | }
227 | | }
225 | | }
226 | | }
| |_^
|
= help: you could split it up into multiple smaller functions
error: the function has a cyclomatic complexity of 3
--> $DIR/cyclomatic_complexity.rs:230:1
--> $DIR/cyclomatic_complexity.rs:229:1
|
230 | / fn barrr2() {
231 | | match 99 {
232 | | 0 => println!("hi"),
233 | | 1 => panic!("bla"),
229 | / fn barrr2() {
230 | | match 99 {
231 | | 0 => println!("hi"),
232 | | 1 => panic!("bla"),
... |
242 | | }
243 | | }
241 | | }
242 | | }
| |_^
|
= help: you could split it up into multiple smaller functions
error: the function has a cyclomatic complexity of 2
--> $DIR/cyclomatic_complexity.rs:246:1
--> $DIR/cyclomatic_complexity.rs:245:1
|
246 | / fn barrrr() {
247 | | match 99 {
248 | | 0 => println!("hi"),
249 | | 1 => println!("bla"),
245 | / fn barrrr() {
246 | | match 99 {
247 | | 0 => println!("hi"),
248 | | 1 => println!("bla"),
... |
252 | | }
253 | | }
251 | | }
252 | | }
| |_^
|
= help: you could split it up into multiple smaller functions
error: the function has a cyclomatic complexity of 3
--> $DIR/cyclomatic_complexity.rs:256:1
--> $DIR/cyclomatic_complexity.rs:255:1
|
256 | / fn barrrr2() {
257 | | match 99 {
258 | | 0 => println!("hi"),
259 | | 1 => println!("bla"),
255 | / fn barrrr2() {
256 | | match 99 {
257 | | 0 => println!("hi"),
258 | | 1 => println!("bla"),
... |
268 | | }
269 | | }
267 | | }
268 | | }
| |_^
|
= help: you could split it up into multiple smaller functions
error: the function has a cyclomatic complexity of 2
--> $DIR/cyclomatic_complexity.rs:272:1
--> $DIR/cyclomatic_complexity.rs:271:1
|
272 | / fn cake() {
273 | | if 4 == 5 {
274 | | println!("yea");
275 | | } else {
271 | / fn cake() {
272 | | if 4 == 5 {
273 | | println!("yea");
274 | | } else {
... |
278 | | println!("whee");
279 | | }
277 | | println!("whee");
278 | | }
| |_^
|
= help: you could split it up into multiple smaller functions
error: the function has a cyclomatic complexity of 4
--> $DIR/cyclomatic_complexity.rs:283:1
--> $DIR/cyclomatic_complexity.rs:281:1
|
283 | / pub fn read_file(input_path: &str) -> String {
284 | | use std::fs::File;
285 | | use std::io::{Read, Write};
286 | | use std::path::Path;
281 | / pub fn read_file(input_path: &str) -> String {
282 | | use std::fs::File;
283 | | use std::io::{Read, Write};
284 | | use std::path::Path;
... |
308 | | }
309 | | }
306 | | }
307 | | }
| |_^
|
= help: you could split it up into multiple smaller functions
error: the function has a cyclomatic complexity of 1
--> $DIR/cyclomatic_complexity.rs:314:1
--> $DIR/cyclomatic_complexity.rs:312:1
|
314 | / fn void(void: Void) {
315 | | if true {
316 | | match void {
317 | | }
318 | | }
319 | | }
312 | / fn void(void: Void) {
313 | | if true {
314 | | match void {}
315 | | }
316 | | }
| |_^
|
= help: you could split it up into multiple smaller functions
error: the function has a cyclomatic complexity of 1
--> $DIR/cyclomatic_complexity.rs:328:1
--> $DIR/cyclomatic_complexity.rs:325:1
|
328 | / fn try() -> Result<i32, &'static str> {
329 | | match 5 {
330 | | 5 => Ok(5),
331 | | _ => return Err("bla"),
332 | | }
333 | | }
325 | / fn try() -> Result<i32, &'static str> {
326 | | match 5 {
327 | | 5 => Ok(5),
328 | | _ => return Err("bla"),
329 | | }
330 | | }
| |_^
|
= help: you could split it up into multiple smaller functions
error: the function has a cyclomatic complexity of 1
--> $DIR/cyclomatic_complexity.rs:336:1
--> $DIR/cyclomatic_complexity.rs:333:1
|
336 | / fn try_again() -> Result<i32, &'static str> {
337 | | let _ = try!(Ok(42));
338 | | let _ = try!(Ok(43));
339 | | let _ = try!(Ok(44));
333 | / fn try_again() -> Result<i32, &'static str> {
334 | | let _ = try!(Ok(42));
335 | | let _ = try!(Ok(43));
336 | | let _ = try!(Ok(44));
... |
348 | | }
349 | | }
345 | | }
346 | | }
| |_^
|
= help: you could split it up into multiple smaller functions
error: the function has a cyclomatic complexity of 1
--> $DIR/cyclomatic_complexity.rs:352:1
--> $DIR/cyclomatic_complexity.rs:349:1
|
352 | / fn early() -> Result<i32, &'static str> {
353 | | return Ok(5);
354 | | return Ok(5);
355 | | return Ok(5);
349 | / fn early() -> Result<i32, &'static str> {
350 | | return Ok(5);
351 | | return Ok(5);
352 | | return Ok(5);
... |
361 | | return Ok(5);
362 | | }
358 | | return Ok(5);
359 | | }
| |_^
|
= help: you could split it up into multiple smaller functions
error: the function has a cyclomatic complexity of 8
--> $DIR/cyclomatic_complexity.rs:366:1
--> $DIR/cyclomatic_complexity.rs:363:1
|
366 | / fn early_ret() -> i32 {
367 | | let a = if true { 42 } else { return 0; };
368 | | let a = if a < 99 { 42 } else { return 0; };
369 | | let a = if a < 99 { 42 } else { return 0; };
363 | / fn early_ret() -> i32 {
364 | | let a = if true { 42 } else { return 0; };
365 | | let a = if a < 99 { 42 } else { return 0; };
366 | | let a = if a < 99 { 42 } else { return 0; };
... |
382 | | }
383 | | }
379 | | }
380 | | }
| |_^
|
= help: you could split it up into multiple smaller functions

View file

@ -1,13 +1,13 @@
error: the function has a cyclomatic complexity of 3
--> $DIR/cyclomatic_complexity_attr_used.rs:21:1
--> $DIR/cyclomatic_complexity_attr_used.rs:18:1
|
21 | / fn kaboom() {
22 | | if 42 == 43 {
23 | | panic!();
24 | | } else if "cake" == "lie" {
25 | | println!("what?");
26 | | }
27 | | }
18 | / fn kaboom() {
19 | | if 42 == 43 {
20 | | panic!();
21 | | } else if "cake" == "lie" {
22 | | println!("what?");
23 | | }
24 | | }
| |_^
|
= note: `-D clippy::cyclomatic-complexity` implied by `-D warnings`

View file

@ -1,33 +1,33 @@
error: integer literal has a better hexadecimal representation
--> $DIR/decimal_literal_representation.rs:28:9
--> $DIR/decimal_literal_representation.rs:26:9
|
28 | 32_773, // 0x8005
26 | 32_773, // 0x8005
| ^^^^^^ help: consider: `0x8005`
|
= note: `-D clippy::decimal-literal-representation` implied by `-D warnings`
error: integer literal has a better hexadecimal representation
--> $DIR/decimal_literal_representation.rs:27:9
|
27 | 65_280, // 0xFF00
| ^^^^^^ help: consider: `0xFF00`
error: integer literal has a better hexadecimal representation
--> $DIR/decimal_literal_representation.rs:28:9
|
28 | 2_131_750_927, // 0x7F0F_F00F
| ^^^^^^^^^^^^^ help: consider: `0x7F0F_F00F`
error: integer literal has a better hexadecimal representation
--> $DIR/decimal_literal_representation.rs:29:9
|
29 | 65_280, // 0xFF00
| ^^^^^^ help: consider: `0xFF00`
29 | 2_147_483_647, // 0x7FFF_FFFF
| ^^^^^^^^^^^^^ help: consider: `0x7FFF_FFFF`
error: integer literal has a better hexadecimal representation
--> $DIR/decimal_literal_representation.rs:30:9
|
30 | 2_131_750_927, // 0x7F0F_F00F
| ^^^^^^^^^^^^^ help: consider: `0x7F0F_F00F`
error: integer literal has a better hexadecimal representation
--> $DIR/decimal_literal_representation.rs:31:9
|
31 | 2_147_483_647, // 0x7FFF_FFFF
| ^^^^^^^^^^^^^ help: consider: `0x7FFF_FFFF`
error: integer literal has a better hexadecimal representation
--> $DIR/decimal_literal_representation.rs:32:9
|
32 | 4_042_322_160, // 0xF0F0_F0F0
30 | 4_042_322_160, // 0xF0F0_F0F0
| ^^^^^^^^^^^^^ help: consider: `0xF0F0_F0F0`
error: aborting due to 5 previous errors

View file

@ -1,51 +1,51 @@
error: Calling std::string::String::default() is more clear than this expression
--> $DIR/default_trait_access.rs:20:22
--> $DIR/default_trait_access.rs:17:22
|
20 | let s1: String = Default::default();
17 | let s1: String = Default::default();
| ^^^^^^^^^^^^^^^^^^ help: try: `std::string::String::default()`
|
= note: `-D clippy::default-trait-access` implied by `-D warnings`
error: Calling std::string::String::default() is more clear than this expression
--> $DIR/default_trait_access.rs:24:22
--> $DIR/default_trait_access.rs:21:22
|
24 | let s3: String = D2::default();
21 | let s3: String = D2::default();
| ^^^^^^^^^^^^^ help: try: `std::string::String::default()`
error: Calling std::string::String::default() is more clear than this expression
--> $DIR/default_trait_access.rs:26:22
--> $DIR/default_trait_access.rs:23:22
|
26 | let s4: String = std::default::Default::default();
23 | let s4: String = std::default::Default::default();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `std::string::String::default()`
error: Calling std::string::String::default() is more clear than this expression
--> $DIR/default_trait_access.rs:30:22
--> $DIR/default_trait_access.rs:27:22
|
30 | let s6: String = default::Default::default();
27 | let s6: String = default::Default::default();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `std::string::String::default()`
error: Calling GenericDerivedDefault<std::string::String>::default() is more clear than this expression
--> $DIR/default_trait_access.rs:40:46
--> $DIR/default_trait_access.rs:37:46
|
40 | let s11: GenericDerivedDefault<String> = Default::default();
37 | let s11: GenericDerivedDefault<String> = Default::default();
| ^^^^^^^^^^^^^^^^^^ help: try: `GenericDerivedDefault<std::string::String>::default()`
error: Calling TupleDerivedDefault::default() is more clear than this expression
--> $DIR/default_trait_access.rs:46:36
--> $DIR/default_trait_access.rs:43:36
|
46 | let s14: TupleDerivedDefault = Default::default();
43 | let s14: TupleDerivedDefault = Default::default();
| ^^^^^^^^^^^^^^^^^^ help: try: `TupleDerivedDefault::default()`
error: Calling ArrayDerivedDefault::default() is more clear than this expression
--> $DIR/default_trait_access.rs:48:36
--> $DIR/default_trait_access.rs:45:36
|
48 | let s15: ArrayDerivedDefault = Default::default();
45 | let s15: ArrayDerivedDefault = Default::default();
| ^^^^^^^^^^^^^^^^^^ help: try: `ArrayDerivedDefault::default()`
error: Calling TupleStructDerivedDefault::default() is more clear than this expression
--> $DIR/default_trait_access.rs:52:42
--> $DIR/default_trait_access.rs:49:42
|
52 | let s17: TupleStructDerivedDefault = Default::default();
49 | let s17: TupleStructDerivedDefault = Default::default();
| ^^^^^^^^^^^^^^^^^^ help: try: `TupleStructDerivedDefault::default()`
error: aborting due to 8 previous errors

View file

@ -1,33 +1,33 @@
error: lint `str_to_string` has been removed: `using `str::to_string` is common even today and specialization will likely happen soon`
--> $DIR/deprecated.rs:14:8
--> $DIR/deprecated.rs:10:8
|
14 | #[warn(str_to_string)]
10 | #[warn(str_to_string)]
| ^^^^^^^^^^^^^
|
= note: `-D renamed-and-removed-lints` implied by `-D warnings`
error: lint `string_to_string` has been removed: `using `string::to_string` is common even today and specialization will likely happen soon`
--> $DIR/deprecated.rs:16:8
--> $DIR/deprecated.rs:11:8
|
16 | #[warn(string_to_string)]
11 | #[warn(string_to_string)]
| ^^^^^^^^^^^^^^^^
error: lint `unstable_as_slice` has been removed: ``Vec::as_slice` has been stabilized in 1.7`
--> $DIR/deprecated.rs:18:8
--> $DIR/deprecated.rs:12:8
|
18 | #[warn(unstable_as_slice)]
12 | #[warn(unstable_as_slice)]
| ^^^^^^^^^^^^^^^^^
error: lint `unstable_as_mut_slice` has been removed: ``Vec::as_mut_slice` has been stabilized in 1.7`
--> $DIR/deprecated.rs:20:8
--> $DIR/deprecated.rs:13:8
|
20 | #[warn(unstable_as_mut_slice)]
13 | #[warn(unstable_as_mut_slice)]
| ^^^^^^^^^^^^^^^^^^^^^
error: lint `misaligned_transmute` has been removed: `this lint has been split into cast_ptr_alignment and transmute_ptr_to_ptr`
--> $DIR/deprecated.rs:22:8
--> $DIR/deprecated.rs:14:8
|
22 | #[warn(misaligned_transmute)]
14 | #[warn(misaligned_transmute)]
| ^^^^^^^^^^^^^^^^^^^^
error: aborting due to 5 previous errors

View file

@ -1,15 +1,17 @@
error: you are deriving `Hash` but have implemented `PartialEq` explicitly
--> $DIR/derive.rs:27:10
--> $DIR/derive.rs:25:10
|
27 | #[derive(Hash)]
25 | #[derive(Hash)]
| ^^^^
|
= note: #[deny(clippy::derive_hash_xor_eq)] on by default
note: `PartialEq` implemented here
--> $DIR/derive.rs:30:1
--> $DIR/derive.rs:28:1
|
30 | / impl PartialEq for Bar {
31 | | fn eq(&self, _: &Bar) -> bool { true }
28 | / impl PartialEq for Bar {
29 | | fn eq(&self, _: &Bar) -> bool {
30 | | true
31 | | }
32 | | }
| |_^
@ -23,88 +25,106 @@ note: `PartialEq` implemented here
--> $DIR/derive.rs:37:1
|
37 | / impl PartialEq<Baz> for Baz {
38 | | fn eq(&self, _: &Baz) -> bool { true }
39 | | }
38 | | fn eq(&self, _: &Baz) -> bool {
39 | | true
40 | | }
41 | | }
| |_^
error: you are implementing `Hash` explicitly but have derived `PartialEq`
--> $DIR/derive.rs:44:1
--> $DIR/derive.rs:46:1
|
44 | / impl Hash for Bah {
45 | | fn hash<H: Hasher>(&self, _: &mut H) {}
46 | | }
46 | / impl Hash for Bah {
47 | | fn hash<H: Hasher>(&self, _: &mut H) {}
48 | | }
| |_^
|
note: `PartialEq` implemented here
--> $DIR/derive.rs:41:10
--> $DIR/derive.rs:43:10
|
41 | #[derive(PartialEq)]
43 | #[derive(PartialEq)]
| ^^^^^^^^^
error: you are implementing `Clone` explicitly on a `Copy` type
--> $DIR/derive.rs:51:1
--> $DIR/derive.rs:53:1
|
51 | / impl Clone for Qux {
52 | | fn clone(&self) -> Self { Qux }
53 | | }
53 | / impl Clone for Qux {
54 | | fn clone(&self) -> Self {
55 | | Qux
56 | | }
57 | | }
| |_^
|
= note: `-D clippy::expl-impl-clone-on-copy` implied by `-D warnings`
note: consider deriving `Clone` or removing `Copy`
--> $DIR/derive.rs:51:1
--> $DIR/derive.rs:53:1
|
51 | / impl Clone for Qux {
52 | | fn clone(&self) -> Self { Qux }
53 | | }
53 | / impl Clone for Qux {
54 | | fn clone(&self) -> Self {
55 | | Qux
56 | | }
57 | | }
| |_^
error: you are implementing `Clone` explicitly on a `Copy` type
--> $DIR/derive.rs:75:1
--> $DIR/derive.rs:77:1
|
75 | / impl<'a> Clone for Lt<'a> {
76 | | fn clone(&self) -> Self { unimplemented!() }
77 | | }
77 | / impl<'a> Clone for Lt<'a> {
78 | | fn clone(&self) -> Self {
79 | | unimplemented!()
80 | | }
81 | | }
| |_^
|
note: consider deriving `Clone` or removing `Copy`
--> $DIR/derive.rs:75:1
--> $DIR/derive.rs:77:1
|
75 | / impl<'a> Clone for Lt<'a> {
76 | | fn clone(&self) -> Self { unimplemented!() }
77 | | }
77 | / impl<'a> Clone for Lt<'a> {
78 | | fn clone(&self) -> Self {
79 | | unimplemented!()
80 | | }
81 | | }
| |_^
error: you are implementing `Clone` explicitly on a `Copy` type
--> $DIR/derive.rs:85:1
--> $DIR/derive.rs:89:1
|
85 | / impl Clone for BigArray {
86 | | fn clone(&self) -> Self { unimplemented!() }
87 | | }
89 | / impl Clone for BigArray {
90 | | fn clone(&self) -> Self {
91 | | unimplemented!()
92 | | }
93 | | }
| |_^
|
note: consider deriving `Clone` or removing `Copy`
--> $DIR/derive.rs:85:1
--> $DIR/derive.rs:89:1
|
85 | / impl Clone for BigArray {
86 | | fn clone(&self) -> Self { unimplemented!() }
87 | | }
89 | / impl Clone for BigArray {
90 | | fn clone(&self) -> Self {
91 | | unimplemented!()
92 | | }
93 | | }
| |_^
error: you are implementing `Clone` explicitly on a `Copy` type
--> $DIR/derive.rs:95:1
|
95 | / impl Clone for FnPtr {
96 | | fn clone(&self) -> Self { unimplemented!() }
97 | | }
| |_^
|
--> $DIR/derive.rs:101:1
|
101 | / impl Clone for FnPtr {
102 | | fn clone(&self) -> Self {
103 | | unimplemented!()
104 | | }
105 | | }
| |_^
|
note: consider deriving `Clone` or removing `Copy`
--> $DIR/derive.rs:95:1
|
95 | / impl Clone for FnPtr {
96 | | fn clone(&self) -> Self { unimplemented!() }
97 | | }
| |_^
--> $DIR/derive.rs:101:1
|
101 | / impl Clone for FnPtr {
102 | | fn clone(&self) -> Self {
103 | | unimplemented!()
104 | | }
105 | | }
| |_^
error: aborting due to 7 previous errors

View file

@ -1,48 +1,48 @@
error: I see you're using a LinkedList! Perhaps you meant some other data structure?
--> $DIR/dlist.rs:24:16
--> $DIR/dlist.rs:19:16
|
24 | type Baz = LinkedList<u8>;
19 | type Baz = LinkedList<u8>;
| ^^^^^^^^^^^^^^
|
= note: `-D clippy::linkedlist` implied by `-D warnings`
= help: a VecDeque might work
error: I see you're using a LinkedList! Perhaps you meant some other data structure?
--> $DIR/dlist.rs:25:12
--> $DIR/dlist.rs:20:12
|
25 | fn foo(LinkedList<u8>);
20 | fn foo(LinkedList<u8>);
| ^^^^^^^^^^^^^^
|
= help: a VecDeque might work
error: I see you're using a LinkedList! Perhaps you meant some other data structure?
--> $DIR/dlist.rs:26:24
--> $DIR/dlist.rs:21:23
|
26 | const BAR : Option<LinkedList<u8>>;
| ^^^^^^^^^^^^^^
21 | const BAR: Option<LinkedList<u8>>;
| ^^^^^^^^^^^^^^
|
= help: a VecDeque might work
error: I see you're using a LinkedList! Perhaps you meant some other data structure?
--> $DIR/dlist.rs:37:15
--> $DIR/dlist.rs:32:15
|
37 | fn foo(_: LinkedList<u8>) {}
32 | fn foo(_: LinkedList<u8>) {}
| ^^^^^^^^^^^^^^
|
= help: a VecDeque might work
error: I see you're using a LinkedList! Perhaps you meant some other data structure?
--> $DIR/dlist.rs:40:39
--> $DIR/dlist.rs:35:39
|
40 | pub fn test(my_favourite_linked_list: LinkedList<u8>) {
35 | pub fn test(my_favourite_linked_list: LinkedList<u8>) {
| ^^^^^^^^^^^^^^
|
= help: a VecDeque might work
error: I see you're using a LinkedList! Perhaps you meant some other data structure?
--> $DIR/dlist.rs:44:29
--> $DIR/dlist.rs:39:29
|
44 | pub fn test_ret() -> Option<LinkedList<u8>> {
39 | pub fn test_ret() -> Option<LinkedList<u8>> {
| ^^^^^^^^^^^^^^
|
= help: a VecDeque might work

View file

@ -1,51 +1,51 @@
error: This binary expression can be simplified
--> $DIR/double_comparison.rs:14:8
--> $DIR/double_comparison.rs:13:8
|
14 | if x == y || x < y {
13 | if x == y || x < y {
| ^^^^^^^^^^^^^^^ help: try: `x <= y`
|
= note: `-D clippy::double-comparisons` implied by `-D warnings`
error: This binary expression can be simplified
--> $DIR/double_comparison.rs:17:8
--> $DIR/double_comparison.rs:16:8
|
17 | if x < y || x == y {
16 | if x < y || x == y {
| ^^^^^^^^^^^^^^^ help: try: `x <= y`
error: This binary expression can be simplified
--> $DIR/double_comparison.rs:20:8
--> $DIR/double_comparison.rs:19:8
|
20 | if x == y || x > y {
19 | if x == y || x > y {
| ^^^^^^^^^^^^^^^ help: try: `x >= y`
error: This binary expression can be simplified
--> $DIR/double_comparison.rs:23:8
--> $DIR/double_comparison.rs:22:8
|
23 | if x > y || x == y {
22 | if x > y || x == y {
| ^^^^^^^^^^^^^^^ help: try: `x >= y`
error: This binary expression can be simplified
--> $DIR/double_comparison.rs:26:8
--> $DIR/double_comparison.rs:25:8
|
26 | if x < y || x > y {
25 | if x < y || x > y {
| ^^^^^^^^^^^^^^ help: try: `x != y`
error: This binary expression can be simplified
--> $DIR/double_comparison.rs:29:8
--> $DIR/double_comparison.rs:28:8
|
29 | if x > y || x < y {
28 | if x > y || x < y {
| ^^^^^^^^^^^^^^ help: try: `x != y`
error: This binary expression can be simplified
--> $DIR/double_comparison.rs:32:8
--> $DIR/double_comparison.rs:31:8
|
32 | if x <= y && x >= y {
31 | if x <= y && x >= y {
| ^^^^^^^^^^^^^^^^ help: try: `x == y`
error: This binary expression can be simplified
--> $DIR/double_comparison.rs:35:8
--> $DIR/double_comparison.rs:34:8
|
35 | if x >= y && x <= y {
34 | if x >= y && x <= y {
| ^^^^^^^^^^^^^^^^ help: try: `x == y`
error: aborting due to 8 previous errors

View file

@ -1,7 +1,7 @@
error: `--x` could be misinterpreted as pre-decrement by C programmers, is usually a no-op
--> $DIR/double_neg.rs:19:5
--> $DIR/double_neg.rs:15:5
|
19 | --x;
15 | --x;
| ^^^
|
= note: `-D clippy::double-neg` implied by `-D warnings`

View file

@ -1,75 +1,75 @@
error: calls to `std::mem::drop` with a value that implements Copy. Dropping a copy leaves the original intact.
--> $DIR/drop_forget_copy.rs:43:5
--> $DIR/drop_forget_copy.rs:42:5
|
43 | drop(s1);
42 | drop(s1);
| ^^^^^^^^
|
= note: `-D clippy::drop-copy` implied by `-D warnings`
note: argument has type SomeStruct
--> $DIR/drop_forget_copy.rs:42:10
|
42 | drop(s1);
| ^^
error: calls to `std::mem::drop` with a value that implements Copy. Dropping a copy leaves the original intact.
--> $DIR/drop_forget_copy.rs:43:5
|
43 | drop(s2);
| ^^^^^^^^
|
note: argument has type SomeStruct
--> $DIR/drop_forget_copy.rs:43:10
|
43 | drop(s1);
43 | drop(s2);
| ^^
error: calls to `std::mem::drop` with a value that implements Copy. Dropping a copy leaves the original intact.
--> $DIR/drop_forget_copy.rs:44:5
--> $DIR/drop_forget_copy.rs:45:5
|
44 | drop(s2);
45 | drop(s4);
| ^^^^^^^^
|
note: argument has type SomeStruct
--> $DIR/drop_forget_copy.rs:44:10
--> $DIR/drop_forget_copy.rs:45:10
|
44 | drop(s2);
| ^^
error: calls to `std::mem::drop` with a value that implements Copy. Dropping a copy leaves the original intact.
--> $DIR/drop_forget_copy.rs:46:5
|
46 | drop(s4);
| ^^^^^^^^
|
note: argument has type SomeStruct
--> $DIR/drop_forget_copy.rs:46:10
|
46 | drop(s4);
45 | drop(s4);
| ^^
error: calls to `std::mem::forget` with a value that implements Copy. Forgetting a copy leaves the original intact.
--> $DIR/drop_forget_copy.rs:49:5
--> $DIR/drop_forget_copy.rs:48:5
|
49 | forget(s1);
48 | forget(s1);
| ^^^^^^^^^^
|
= note: `-D clippy::forget-copy` implied by `-D warnings`
note: argument has type SomeStruct
--> $DIR/drop_forget_copy.rs:48:12
|
48 | forget(s1);
| ^^
error: calls to `std::mem::forget` with a value that implements Copy. Forgetting a copy leaves the original intact.
--> $DIR/drop_forget_copy.rs:49:5
|
49 | forget(s2);
| ^^^^^^^^^^
|
note: argument has type SomeStruct
--> $DIR/drop_forget_copy.rs:49:12
|
49 | forget(s1);
49 | forget(s2);
| ^^
error: calls to `std::mem::forget` with a value that implements Copy. Forgetting a copy leaves the original intact.
--> $DIR/drop_forget_copy.rs:50:5
--> $DIR/drop_forget_copy.rs:51:5
|
50 | forget(s2);
51 | forget(s4);
| ^^^^^^^^^^
|
note: argument has type SomeStruct
--> $DIR/drop_forget_copy.rs:50:12
--> $DIR/drop_forget_copy.rs:51:12
|
50 | forget(s2);
| ^^
error: calls to `std::mem::forget` with a value that implements Copy. Forgetting a copy leaves the original intact.
--> $DIR/drop_forget_copy.rs:52:5
|
52 | forget(s4);
| ^^^^^^^^^^
|
note: argument has type SomeStruct
--> $DIR/drop_forget_copy.rs:52:12
|
52 | forget(s4);
51 | forget(s4);
| ^^
error: aborting due to 6 previous errors

View file

@ -1,219 +1,219 @@
error: calls to `std::mem::drop` with a reference instead of an owned value. Dropping a reference does nothing.
--> $DIR/drop_forget_ref.rs:22:5
--> $DIR/drop_forget_ref.rs:18:5
|
22 | drop(&SomeStruct);
18 | drop(&SomeStruct);
| ^^^^^^^^^^^^^^^^^
|
= note: `-D clippy::drop-ref` implied by `-D warnings`
note: argument has type &SomeStruct
--> $DIR/drop_forget_ref.rs:22:10
--> $DIR/drop_forget_ref.rs:18:10
|
22 | drop(&SomeStruct);
18 | drop(&SomeStruct);
| ^^^^^^^^^^^
error: calls to `std::mem::forget` with a reference instead of an owned value. Forgetting a reference does nothing.
--> $DIR/drop_forget_ref.rs:23:5
--> $DIR/drop_forget_ref.rs:19:5
|
23 | forget(&SomeStruct);
19 | forget(&SomeStruct);
| ^^^^^^^^^^^^^^^^^^^
|
= note: `-D clippy::forget-ref` implied by `-D warnings`
note: argument has type &SomeStruct
--> $DIR/drop_forget_ref.rs:23:12
--> $DIR/drop_forget_ref.rs:19:12
|
23 | forget(&SomeStruct);
19 | forget(&SomeStruct);
| ^^^^^^^^^^^
error: calls to `std::mem::drop` with a reference instead of an owned value. Dropping a reference does nothing.
--> $DIR/drop_forget_ref.rs:26:5
--> $DIR/drop_forget_ref.rs:22:5
|
26 | drop(&owned1);
22 | drop(&owned1);
| ^^^^^^^^^^^^^
|
note: argument has type &SomeStruct
--> $DIR/drop_forget_ref.rs:26:10
--> $DIR/drop_forget_ref.rs:22:10
|
26 | drop(&owned1);
22 | drop(&owned1);
| ^^^^^^^
error: calls to `std::mem::drop` with a reference instead of an owned value. Dropping a reference does nothing.
--> $DIR/drop_forget_ref.rs:27:5
--> $DIR/drop_forget_ref.rs:23:5
|
27 | drop(&&owned1);
23 | drop(&&owned1);
| ^^^^^^^^^^^^^^
|
note: argument has type &&SomeStruct
--> $DIR/drop_forget_ref.rs:27:10
--> $DIR/drop_forget_ref.rs:23:10
|
27 | drop(&&owned1);
23 | drop(&&owned1);
| ^^^^^^^^
error: calls to `std::mem::drop` with a reference instead of an owned value. Dropping a reference does nothing.
--> $DIR/drop_forget_ref.rs:28:5
--> $DIR/drop_forget_ref.rs:24:5
|
28 | drop(&mut owned1);
24 | drop(&mut owned1);
| ^^^^^^^^^^^^^^^^^
|
note: argument has type &mut SomeStruct
--> $DIR/drop_forget_ref.rs:28:10
--> $DIR/drop_forget_ref.rs:24:10
|
28 | drop(&mut owned1);
24 | drop(&mut owned1);
| ^^^^^^^^^^^
error: calls to `std::mem::forget` with a reference instead of an owned value. Forgetting a reference does nothing.
--> $DIR/drop_forget_ref.rs:31:5
--> $DIR/drop_forget_ref.rs:27:5
|
31 | forget(&owned2);
27 | forget(&owned2);
| ^^^^^^^^^^^^^^^
|
note: argument has type &SomeStruct
--> $DIR/drop_forget_ref.rs:31:12
--> $DIR/drop_forget_ref.rs:27:12
|
31 | forget(&owned2);
27 | forget(&owned2);
| ^^^^^^^
error: calls to `std::mem::forget` with a reference instead of an owned value. Forgetting a reference does nothing.
--> $DIR/drop_forget_ref.rs:32:5
--> $DIR/drop_forget_ref.rs:28:5
|
32 | forget(&&owned2);
28 | forget(&&owned2);
| ^^^^^^^^^^^^^^^^
|
note: argument has type &&SomeStruct
--> $DIR/drop_forget_ref.rs:32:12
--> $DIR/drop_forget_ref.rs:28:12
|
32 | forget(&&owned2);
28 | forget(&&owned2);
| ^^^^^^^^
error: calls to `std::mem::forget` with a reference instead of an owned value. Forgetting a reference does nothing.
--> $DIR/drop_forget_ref.rs:33:5
--> $DIR/drop_forget_ref.rs:29:5
|
33 | forget(&mut owned2);
29 | forget(&mut owned2);
| ^^^^^^^^^^^^^^^^^^^
|
note: argument has type &mut SomeStruct
--> $DIR/drop_forget_ref.rs:33:12
--> $DIR/drop_forget_ref.rs:29:12
|
33 | forget(&mut owned2);
29 | forget(&mut owned2);
| ^^^^^^^^^^^
error: calls to `std::mem::drop` with a reference instead of an owned value. Dropping a reference does nothing.
--> $DIR/drop_forget_ref.rs:33:5
|
33 | drop(reference1);
| ^^^^^^^^^^^^^^^^
|
note: argument has type &SomeStruct
--> $DIR/drop_forget_ref.rs:33:10
|
33 | drop(reference1);
| ^^^^^^^^^^
error: calls to `std::mem::forget` with a reference instead of an owned value. Forgetting a reference does nothing.
--> $DIR/drop_forget_ref.rs:34:5
|
34 | forget(&*reference1);
| ^^^^^^^^^^^^^^^^^^^^
|
note: argument has type &SomeStruct
--> $DIR/drop_forget_ref.rs:34:12
|
34 | forget(&*reference1);
| ^^^^^^^^^^^^
error: calls to `std::mem::drop` with a reference instead of an owned value. Dropping a reference does nothing.
--> $DIR/drop_forget_ref.rs:37:5
|
37 | drop(reference1);
| ^^^^^^^^^^^^^^^^
|
note: argument has type &SomeStruct
--> $DIR/drop_forget_ref.rs:37:10
|
37 | drop(reference1);
| ^^^^^^^^^^
error: calls to `std::mem::forget` with a reference instead of an owned value. Forgetting a reference does nothing.
--> $DIR/drop_forget_ref.rs:38:5
|
38 | forget(&*reference1);
| ^^^^^^^^^^^^^^^^^^^^
|
note: argument has type &SomeStruct
--> $DIR/drop_forget_ref.rs:38:12
|
38 | forget(&*reference1);
| ^^^^^^^^^^^^
error: calls to `std::mem::drop` with a reference instead of an owned value. Dropping a reference does nothing.
--> $DIR/drop_forget_ref.rs:41:5
|
41 | drop(reference2);
37 | drop(reference2);
| ^^^^^^^^^^^^^^^^
|
note: argument has type &mut SomeStruct
--> $DIR/drop_forget_ref.rs:41:10
--> $DIR/drop_forget_ref.rs:37:10
|
41 | drop(reference2);
37 | drop(reference2);
| ^^^^^^^^^^
error: calls to `std::mem::forget` with a reference instead of an owned value. Forgetting a reference does nothing.
--> $DIR/drop_forget_ref.rs:39:5
|
39 | forget(reference3);
| ^^^^^^^^^^^^^^^^^^
|
note: argument has type &mut SomeStruct
--> $DIR/drop_forget_ref.rs:39:12
|
39 | forget(reference3);
| ^^^^^^^^^^
error: calls to `std::mem::drop` with a reference instead of an owned value. Dropping a reference does nothing.
--> $DIR/drop_forget_ref.rs:42:5
|
42 | drop(reference4);
| ^^^^^^^^^^^^^^^^
|
note: argument has type &SomeStruct
--> $DIR/drop_forget_ref.rs:42:10
|
42 | drop(reference4);
| ^^^^^^^^^^
error: calls to `std::mem::forget` with a reference instead of an owned value. Forgetting a reference does nothing.
--> $DIR/drop_forget_ref.rs:43:5
|
43 | forget(reference3);
43 | forget(reference4);
| ^^^^^^^^^^^^^^^^^^
|
note: argument has type &mut SomeStruct
note: argument has type &SomeStruct
--> $DIR/drop_forget_ref.rs:43:12
|
43 | forget(reference3);
43 | forget(reference4);
| ^^^^^^^^^^
error: calls to `std::mem::drop` with a reference instead of an owned value. Dropping a reference does nothing.
--> $DIR/drop_forget_ref.rs:46:5
--> $DIR/drop_forget_ref.rs:48:5
|
46 | drop(reference4);
| ^^^^^^^^^^^^^^^^
|
note: argument has type &SomeStruct
--> $DIR/drop_forget_ref.rs:46:10
|
46 | drop(reference4);
| ^^^^^^^^^^
error: calls to `std::mem::forget` with a reference instead of an owned value. Forgetting a reference does nothing.
--> $DIR/drop_forget_ref.rs:47:5
|
47 | forget(reference4);
| ^^^^^^^^^^^^^^^^^^
|
note: argument has type &SomeStruct
--> $DIR/drop_forget_ref.rs:47:12
|
47 | forget(reference4);
| ^^^^^^^^^^
error: calls to `std::mem::drop` with a reference instead of an owned value. Dropping a reference does nothing.
--> $DIR/drop_forget_ref.rs:52:5
|
52 | drop(&val);
48 | drop(&val);
| ^^^^^^^^^^
|
note: argument has type &T
--> $DIR/drop_forget_ref.rs:52:10
--> $DIR/drop_forget_ref.rs:48:10
|
52 | drop(&val);
48 | drop(&val);
| ^^^^
error: calls to `std::mem::forget` with a reference instead of an owned value. Forgetting a reference does nothing.
--> $DIR/drop_forget_ref.rs:58:5
--> $DIR/drop_forget_ref.rs:54:5
|
58 | forget(&val);
54 | forget(&val);
| ^^^^^^^^^^^^
|
note: argument has type &T
--> $DIR/drop_forget_ref.rs:58:12
--> $DIR/drop_forget_ref.rs:54:12
|
58 | forget(&val);
54 | forget(&val);
| ^^^^
error: calls to `std::mem::drop` with a reference instead of an owned value. Dropping a reference does nothing.
--> $DIR/drop_forget_ref.rs:66:5
--> $DIR/drop_forget_ref.rs:62:5
|
66 | std::mem::drop(&SomeStruct);
62 | std::mem::drop(&SomeStruct);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
note: argument has type &SomeStruct
--> $DIR/drop_forget_ref.rs:66:20
--> $DIR/drop_forget_ref.rs:62:20
|
66 | std::mem::drop(&SomeStruct);
62 | std::mem::drop(&SomeStruct);
| ^^^^^^^^^^^
error: calls to `std::mem::forget` with a reference instead of an owned value. Forgetting a reference does nothing.
--> $DIR/drop_forget_ref.rs:69:5
--> $DIR/drop_forget_ref.rs:65:5
|
69 | std::mem::forget(&SomeStruct);
65 | std::mem::forget(&SomeStruct);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
note: argument has type &SomeStruct
--> $DIR/drop_forget_ref.rs:69:22
--> $DIR/drop_forget_ref.rs:65:22
|
69 | std::mem::forget(&SomeStruct);
65 | std::mem::forget(&SomeStruct);
| ^^^^^^^^^^^
error: aborting due to 18 previous errors

View file

@ -1,7 +1,7 @@
error: `darth` already exists, having another argument having almost the same name makes code comprehension and documentation more difficult
--> $DIR/duplicate_underscore_argument.rs:17:23
--> $DIR/duplicate_underscore_argument.rs:13:23
|
17 | fn join_the_dark_side(darth: i32, _darth: i32) {}
13 | fn join_the_dark_side(darth: i32, _darth: i32) {}
| ^^^^^
|
= note: `-D clippy::duplicate-underscore-argument` implied by `-D warnings`

View file

@ -1,33 +1,33 @@
error: Calling `subsec_millis()` is more concise than this calculation
--> $DIR/duration_subsec.rs:20:24
--> $DIR/duration_subsec.rs:17:24
|
20 | let bad_millis_1 = dur.subsec_micros() / 1_000;
17 | let bad_millis_1 = dur.subsec_micros() / 1_000;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `dur.subsec_millis()`
|
= note: `-D clippy::duration-subsec` implied by `-D warnings`
error: Calling `subsec_millis()` is more concise than this calculation
--> $DIR/duration_subsec.rs:21:24
--> $DIR/duration_subsec.rs:18:24
|
21 | let bad_millis_2 = dur.subsec_nanos() / 1_000_000;
18 | let bad_millis_2 = dur.subsec_nanos() / 1_000_000;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `dur.subsec_millis()`
error: Calling `subsec_micros()` is more concise than this calculation
--> $DIR/duration_subsec.rs:26:22
--> $DIR/duration_subsec.rs:23:22
|
26 | let bad_micros = dur.subsec_nanos() / 1_000;
23 | let bad_micros = dur.subsec_nanos() / 1_000;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `dur.subsec_micros()`
error: Calling `subsec_micros()` is more concise than this calculation
--> $DIR/duration_subsec.rs:31:13
--> $DIR/duration_subsec.rs:28:13
|
31 | let _ = (&dur).subsec_nanos() / 1_000;
28 | let _ = (&dur).subsec_nanos() / 1_000;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `(&dur).subsec_micros()`
error: Calling `subsec_micros()` is more concise than this calculation
--> $DIR/duration_subsec.rs:35:13
--> $DIR/duration_subsec.rs:32:13
|
35 | let _ = dur.subsec_nanos() / NANOS_IN_MICRO;
32 | let _ = dur.subsec_nanos() / NANOS_IN_MICRO;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `dur.subsec_micros()`
error: aborting due to 5 previous errors

View file

@ -1,22 +1,24 @@
error: if expression with an `else if`, but without a final `else`
--> $DIR/else_if_without_else.rs:51:12
--> $DIR/else_if_without_else.rs:54:12
|
51 | } else if bla2() { //~ ERROR else if without else
54 | } else if bla2() {
| ____________^
52 | | println!("else if");
53 | | }
55 | | //~ ERROR else if without else
56 | | println!("else if");
57 | | }
| |_____^
|
= note: `-D clippy::else-if-without-else` implied by `-D warnings`
= help: add an `else` block here
error: if expression with an `else if`, but without a final `else`
--> $DIR/else_if_without_else.rs:59:12
--> $DIR/else_if_without_else.rs:63:12
|
59 | } else if bla3() { //~ ERROR else if without else
63 | } else if bla3() {
| ____________^
60 | | println!("else if 2");
61 | | }
64 | | //~ ERROR else if without else
65 | | println!("else if 2");
66 | | }
| |_____^
|
= help: add an `else` block here

View file

@ -1,14 +1,14 @@
error: enum with no variants
--> $DIR/empty_enum.rs:17:1
--> $DIR/empty_enum.rs:13:1
|
17 | enum Empty {}
13 | enum Empty {}
| ^^^^^^^^^^^^^
|
= note: `-D clippy::empty-enum` implied by `-D warnings`
help: consider using the uninhabited type `!` or a wrapper around it
--> $DIR/empty_enum.rs:17:1
--> $DIR/empty_enum.rs:13:1
|
17 | enum Empty {}
13 | enum Empty {}
| ^^^^^^^^^^^^^
error: aborting due to previous error

View file

@ -1,46 +1,74 @@
error: usage of `contains_key` followed by `insert` on a `HashMap`
--> $DIR/entry.rs:23:5
--> $DIR/entry.rs:19:5
|
23 | if !m.contains_key(&k) { m.insert(k, v); }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `m.entry(k).or_insert(v)`
19 | / if !m.contains_key(&k) {
20 | | m.insert(k, v);
21 | | }
| |_____^ help: consider using: `m.entry(k).or_insert(v)`
|
= note: `-D clippy::map-entry` implied by `-D warnings`
error: usage of `contains_key` followed by `insert` on a `HashMap`
--> $DIR/entry.rs:27:5
--> $DIR/entry.rs:25:5
|
27 | if !m.contains_key(&k) { foo(); m.insert(k, v); }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `m.entry(k)`
25 | / if !m.contains_key(&k) {
26 | | foo();
27 | | m.insert(k, v);
28 | | }
| |_____^ help: consider using: `m.entry(k)`
error: usage of `contains_key` followed by `insert` on a `HashMap`
--> $DIR/entry.rs:31:5
--> $DIR/entry.rs:32:5
|
31 | if !m.contains_key(&k) { m.insert(k, v) } else { None };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `m.entry(k)`
32 | / if !m.contains_key(&k) {
33 | | m.insert(k, v)
34 | | } else {
35 | | None
36 | | };
| |_____^ help: consider using: `m.entry(k)`
error: usage of `contains_key` followed by `insert` on a `HashMap`
--> $DIR/entry.rs:35:5
--> $DIR/entry.rs:40:5
|
35 | if m.contains_key(&k) { None } else { m.insert(k, v) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `m.entry(k)`
40 | / if m.contains_key(&k) {
41 | | None
42 | | } else {
43 | | m.insert(k, v)
44 | | };
| |_____^ help: consider using: `m.entry(k)`
error: usage of `contains_key` followed by `insert` on a `HashMap`
--> $DIR/entry.rs:39:5
--> $DIR/entry.rs:48:5
|
39 | if !m.contains_key(&k) { foo(); m.insert(k, v) } else { None };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `m.entry(k)`
48 | / if !m.contains_key(&k) {
49 | | foo();
50 | | m.insert(k, v)
51 | | } else {
52 | | None
53 | | };
| |_____^ help: consider using: `m.entry(k)`
error: usage of `contains_key` followed by `insert` on a `HashMap`
--> $DIR/entry.rs:43:5
--> $DIR/entry.rs:57:5
|
43 | if m.contains_key(&k) { None } else { foo(); m.insert(k, v) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `m.entry(k)`
57 | / if m.contains_key(&k) {
58 | | None
59 | | } else {
60 | | foo();
61 | | m.insert(k, v)
62 | | };
| |_____^ help: consider using: `m.entry(k)`
error: usage of `contains_key` followed by `insert` on a `BTreeMap`
--> $DIR/entry.rs:47:5
--> $DIR/entry.rs:66:5
|
47 | if !m.contains_key(&k) { foo(); m.insert(k, v) } else { None };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `m.entry(k)`
66 | / if !m.contains_key(&k) {
67 | | foo();
68 | | m.insert(k, v)
69 | | } else {
70 | | None
71 | | };
| |_____^ help: consider using: `m.entry(k)`
error: aborting due to 7 previous errors

View file

@ -1,15 +1,15 @@
error: don't use glob imports for enum variants
--> $DIR/enum_glob_use.rs:16:1
--> $DIR/enum_glob_use.rs:13:1
|
16 | use std::cmp::Ordering::*;
13 | use std::cmp::Ordering::*;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: `-D clippy::enum-glob-use` implied by `-D warnings`
error: don't use glob imports for enum variants
--> $DIR/enum_glob_use.rs:22:1
--> $DIR/enum_glob_use.rs:19:1
|
22 | use self::Enum::*;
19 | use self::Enum::*;
| ^^^^^^^^^^^^^^^^^^
error: aborting due to 2 previous errors

View file

@ -1,61 +1,61 @@
error: Variant name ends with the enum's name
--> $DIR/enum_variants.rs:26:5
--> $DIR/enum_variants.rs:24:5
|
26 | cFoo,
24 | cFoo,
| ^^^^
|
= note: `-D clippy::enum-variant-names` implied by `-D warnings`
error: Variant name starts with the enum's name
--> $DIR/enum_variants.rs:37:5
--> $DIR/enum_variants.rs:35:5
|
37 | FoodGood,
35 | FoodGood,
| ^^^^^^^^
error: Variant name starts with the enum's name
--> $DIR/enum_variants.rs:38:5
--> $DIR/enum_variants.rs:36:5
|
38 | FoodMiddle,
36 | FoodMiddle,
| ^^^^^^^^^^
error: Variant name starts with the enum's name
--> $DIR/enum_variants.rs:39:5
--> $DIR/enum_variants.rs:37:5
|
39 | FoodBad,
37 | FoodBad,
| ^^^^^^^
error: All variants have the same prefix: `Food`
--> $DIR/enum_variants.rs:36:1
--> $DIR/enum_variants.rs:34:1
|
36 | / enum Food {
37 | | FoodGood,
38 | | FoodMiddle,
39 | | FoodBad,
40 | | }
34 | / enum Food {
35 | | FoodGood,
36 | | FoodMiddle,
37 | | FoodBad,
38 | | }
| |_^
|
= help: remove the prefixes and use full paths to the variants instead of glob imports
error: All variants have the same prefix: `CallType`
--> $DIR/enum_variants.rs:46:1
--> $DIR/enum_variants.rs:44:1
|
46 | / enum BadCallType {
47 | | CallTypeCall,
48 | | CallTypeCreate,
49 | | CallTypeDestroy,
50 | | }
44 | / enum BadCallType {
45 | | CallTypeCall,
46 | | CallTypeCreate,
47 | | CallTypeDestroy,
48 | | }
| |_^
|
= help: remove the prefixes and use full paths to the variants instead of glob imports
error: All variants have the same prefix: `Constant`
--> $DIR/enum_variants.rs:57:1
--> $DIR/enum_variants.rs:56:1
|
57 | / enum Consts {
58 | | ConstantInt,
59 | | ConstantCake,
60 | | ConstantLie,
61 | | }
56 | / enum Consts {
57 | | ConstantInt,
58 | | ConstantCake,
59 | | ConstantLie,
60 | | }
| |_^
|
= help: remove the prefixes and use full paths to the variants instead of glob imports

View file

@ -1,51 +1,51 @@
error: Clike enum variant discriminant is not portable to 32-bit targets
--> $DIR/enums_clike.rs:22:5
--> $DIR/enums_clike.rs:17:5
|
22 | X = 0x1_0000_0000,
17 | X = 0x1_0000_0000,
| ^^^^^^^^^^^^^^^^^
|
= note: `-D clippy::enum-clike-unportable-variant` implied by `-D warnings`
error: Clike enum variant discriminant is not portable to 32-bit targets
--> $DIR/enums_clike.rs:29:5
--> $DIR/enums_clike.rs:24:5
|
29 | X = 0x1_0000_0000,
24 | X = 0x1_0000_0000,
| ^^^^^^^^^^^^^^^^^
error: Clike enum variant discriminant is not portable to 32-bit targets
--> $DIR/enums_clike.rs:32:5
--> $DIR/enums_clike.rs:27:5
|
32 | A = 0xFFFF_FFFF,
27 | A = 0xFFFF_FFFF,
| ^^^^^^^^^^^^^^^
error: Clike enum variant discriminant is not portable to 32-bit targets
--> $DIR/enums_clike.rs:39:5
--> $DIR/enums_clike.rs:34:5
|
39 | Z = 0xFFFF_FFFF,
34 | Z = 0xFFFF_FFFF,
| ^^^^^^^^^^^^^^^
error: Clike enum variant discriminant is not portable to 32-bit targets
--> $DIR/enums_clike.rs:40:5
--> $DIR/enums_clike.rs:35:5
|
40 | A = 0x1_0000_0000,
35 | A = 0x1_0000_0000,
| ^^^^^^^^^^^^^^^^^
error: Clike enum variant discriminant is not portable to 32-bit targets
--> $DIR/enums_clike.rs:42:5
--> $DIR/enums_clike.rs:37:5
|
42 | C = (std::i32::MIN as isize) - 1,
37 | C = (std::i32::MIN as isize) - 1,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: Clike enum variant discriminant is not portable to 32-bit targets
--> $DIR/enums_clike.rs:48:5
--> $DIR/enums_clike.rs:43:5
|
48 | Z = 0xFFFF_FFFF,
43 | Z = 0xFFFF_FFFF,
| ^^^^^^^^^^^^^^^
error: Clike enum variant discriminant is not portable to 32-bit targets
--> $DIR/enums_clike.rs:49:5
--> $DIR/enums_clike.rs:44:5
|
49 | A = 0x1_0000_0000,
44 | A = 0x1_0000_0000,
| ^^^^^^^^^^^^^^^^^
error: aborting due to 8 previous errors

View file

@ -1,21 +1,21 @@
error: this operation will always return zero. This is likely not the intended outcome
--> $DIR/erasing_op.rs:19:5
--> $DIR/erasing_op.rs:15:5
|
19 | x * 0;
15 | x * 0;
| ^^^^^
|
= note: `-D clippy::erasing-op` implied by `-D warnings`
error: this operation will always return zero. This is likely not the intended outcome
--> $DIR/erasing_op.rs:20:5
--> $DIR/erasing_op.rs:16:5
|
20 | 0 & x;
16 | 0 & x;
| ^^^^^
error: this operation will always return zero. This is likely not the intended outcome
--> $DIR/erasing_op.rs:21:5
--> $DIR/erasing_op.rs:17:5
|
21 | 0 / x;
17 | 0 / x;
| ^^^^^
error: aborting due to 3 previous errors

View file

@ -1,15 +1,15 @@
error: local variable doesn't need to be boxed here
--> $DIR/escape_analysis.rs:45:13
--> $DIR/escape_analysis.rs:43:13
|
45 | fn warn_arg(x: Box<A>) {
43 | fn warn_arg(x: Box<A>) {
| ^
|
= note: `-D clippy::boxed-local` implied by `-D warnings`
error: local variable doesn't need to be boxed here
--> $DIR/escape_analysis.rs:137:12
--> $DIR/escape_analysis.rs:134:12
|
137 | pub fn new(_needs_name: Box<PeekableSeekable<&()>>) -> () {
134 | pub fn new(_needs_name: Box<PeekableSeekable<&()>>) -> () {}
| ^^^^^^^^^^^
error: aborting due to 2 previous errors

View file

@ -1,35 +1,35 @@
error: redundant closure found
--> $DIR/eta.rs:17:27
--> $DIR/eta.rs:22:27
|
17 | let a = Some(1u8).map(|a| foo(a));
22 | let a = Some(1u8).map(|a| foo(a));
| ^^^^^^^^^^ help: remove closure as shown: `foo`
|
= note: `-D clippy::redundant-closure` implied by `-D warnings`
error: redundant closure found
--> $DIR/eta.rs:18:10
--> $DIR/eta.rs:23:10
|
18 | meta(|a| foo(a));
23 | meta(|a| foo(a));
| ^^^^^^^^^^ help: remove closure as shown: `foo`
error: redundant closure found
--> $DIR/eta.rs:19:27
--> $DIR/eta.rs:24:27
|
19 | let c = Some(1u8).map(|a| {1+2; foo}(a));
24 | let c = Some(1u8).map(|a| {1+2; foo}(a));
| ^^^^^^^^^^^^^^^^^ help: remove closure as shown: `{1+2; foo}`
error: this expression borrows a reference that is immediately dereferenced by the compiler
--> $DIR/eta.rs:21:21
--> $DIR/eta.rs:26:21
|
21 | all(&[1, 2, 3], &&2, |x, y| below(x, y)); //is adjusted
26 | all(&[1, 2, 3], &&2, |x, y| below(x, y)); //is adjusted
| ^^^ help: change this to: `&2`
|
= note: `-D clippy::needless-borrow` implied by `-D warnings`
error: redundant closure found
--> $DIR/eta.rs:28:27
--> $DIR/eta.rs:33:27
|
28 | let e = Some(1u8).map(|a| generic(a));
33 | let e = Some(1u8).map(|a| generic(a));
| ^^^^^^^^^^^^^^ help: remove closure as shown: `generic`
error: aborting due to 5 previous errors

View file

@ -1,51 +1,51 @@
error: unsequenced read of a variable
--> $DIR/eval_order_dependence.rs:18:28
--> $DIR/eval_order_dependence.rs:24:9
|
18 | let a = { x = 1; 1 } + x;
| ^
24 | } + x;
| ^
|
= note: `-D clippy::eval-order-dependence` implied by `-D warnings`
note: whether read occurs before this write depends on evaluation order
--> $DIR/eval_order_dependence.rs:18:15
--> $DIR/eval_order_dependence.rs:22:9
|
18 | let a = { x = 1; 1 } + x;
| ^^^^^
22 | x = 1;
| ^^^^^
error: unsequenced read of a variable
--> $DIR/eval_order_dependence.rs:21:5
--> $DIR/eval_order_dependence.rs:27:5
|
21 | x += { x = 20; 2 };
27 | x += {
| ^
|
note: whether read occurs before this write depends on evaluation order
--> $DIR/eval_order_dependence.rs:21:12
--> $DIR/eval_order_dependence.rs:28:9
|
21 | x += { x = 20; 2 };
| ^^^^^^
28 | x = 20;
| ^^^^^^
error: unsequenced read of a variable
--> $DIR/eval_order_dependence.rs:27:24
--> $DIR/eval_order_dependence.rs:40:12
|
27 | let foo = Foo { a: x, .. { x = 6; base } };
| ^
40 | a: x,
| ^
|
note: whether read occurs before this write depends on evaluation order
--> $DIR/eval_order_dependence.rs:27:32
--> $DIR/eval_order_dependence.rs:42:13
|
27 | let foo = Foo { a: x, .. { x = 6; base } };
| ^^^^^
42 | x = 6;
| ^^^^^
error: unsequenced read of a variable
--> $DIR/eval_order_dependence.rs:31:9
--> $DIR/eval_order_dependence.rs:49:9
|
31 | x += { x = 20; 2 };
49 | x += {
| ^
|
note: whether read occurs before this write depends on evaluation order
--> $DIR/eval_order_dependence.rs:31:16
--> $DIR/eval_order_dependence.rs:50:13
|
31 | x += { x = 20; 2 };
| ^^^^^^
50 | x = 20;
| ^^^^^^
error: aborting due to 4 previous errors

View file

@ -1,111 +1,111 @@
error: float has excessive precision
--> $DIR/excessive_precision.rs:25:26
--> $DIR/excessive_precision.rs:23:26
|
25 | const BAD32_1: f32 = 0.123_456_789_f32;
23 | const BAD32_1: f32 = 0.123_456_789_f32;
| ^^^^^^^^^^^^^^^^^ help: consider changing the type or truncating it to: `0.123_456_79`
|
= note: `-D clippy::excessive-precision` implied by `-D warnings`
error: float has excessive precision
--> $DIR/excessive_precision.rs:26:26
--> $DIR/excessive_precision.rs:24:26
|
26 | const BAD32_2: f32 = 0.123_456_789;
24 | const BAD32_2: f32 = 0.123_456_789;
| ^^^^^^^^^^^^^ help: consider changing the type or truncating it to: `0.123_456_79`
error: float has excessive precision
--> $DIR/excessive_precision.rs:27:26
--> $DIR/excessive_precision.rs:25:26
|
27 | const BAD32_3: f32 = 0.100_000_000_000_1;
25 | const BAD32_3: f32 = 0.100_000_000_000_1;
| ^^^^^^^^^^^^^^^^^^^ help: consider changing the type or truncating it to: `0.1`
error: float has excessive precision
--> $DIR/excessive_precision.rs:28:29
--> $DIR/excessive_precision.rs:26:29
|
28 | const BAD32_EDGE: f32 = 1.000_000_9;
26 | const BAD32_EDGE: f32 = 1.000_000_9;
| ^^^^^^^^^^^ help: consider changing the type or truncating it to: `1.000_001`
error: float has excessive precision
--> $DIR/excessive_precision.rs:28:26
|
28 | const BAD64_1: f64 = 0.123_456_789_012_345_67f64;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider changing the type or truncating it to: `0.123_456_789_012_345_66`
error: float has excessive precision
--> $DIR/excessive_precision.rs:29:26
|
29 | const BAD64_2: f64 = 0.123_456_789_012_345_67;
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: consider changing the type or truncating it to: `0.123_456_789_012_345_66`
error: float has excessive precision
--> $DIR/excessive_precision.rs:30:26
|
30 | const BAD64_1: f64 = 0.123_456_789_012_345_67f64;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider changing the type or truncating it to: `0.123_456_789_012_345_66`
error: float has excessive precision
--> $DIR/excessive_precision.rs:31:26
|
31 | const BAD64_2: f64 = 0.123_456_789_012_345_67;
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: consider changing the type or truncating it to: `0.123_456_789_012_345_66`
error: float has excessive precision
--> $DIR/excessive_precision.rs:32:26
|
32 | const BAD64_3: f64 = 0.100_000_000_000_000_000_1;
30 | const BAD64_3: f64 = 0.100_000_000_000_000_000_1;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider changing the type or truncating it to: `0.1`
error: float has excessive precision
--> $DIR/excessive_precision.rs:35:22
--> $DIR/excessive_precision.rs:33:22
|
35 | println!("{:?}", 8.888_888_888_888_888_888_888);
33 | println!("{:?}", 8.888_888_888_888_888_888_888);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider changing the type or truncating it to: `8.888_888_888_888_89`
error: float has excessive precision
--> $DIR/excessive_precision.rs:46:22
--> $DIR/excessive_precision.rs:44:22
|
46 | let bad32: f32 = 1.123_456_789;
44 | let bad32: f32 = 1.123_456_789;
| ^^^^^^^^^^^^^ help: consider changing the type or truncating it to: `1.123_456_8`
error: float has excessive precision
--> $DIR/excessive_precision.rs:47:26
--> $DIR/excessive_precision.rs:45:26
|
47 | let bad32_suf: f32 = 1.123_456_789_f32;
45 | let bad32_suf: f32 = 1.123_456_789_f32;
| ^^^^^^^^^^^^^^^^^ help: consider changing the type or truncating it to: `1.123_456_8`
error: float has excessive precision
--> $DIR/excessive_precision.rs:48:21
--> $DIR/excessive_precision.rs:46:21
|
48 | let bad32_inf = 1.123_456_789_f32;
46 | let bad32_inf = 1.123_456_789_f32;
| ^^^^^^^^^^^^^^^^^ help: consider changing the type or truncating it to: `1.123_456_8`
error: float has excessive precision
--> $DIR/excessive_precision.rs:50:22
--> $DIR/excessive_precision.rs:48:22
|
50 | let bad64: f64 = 0.123_456_789_012_345_67;
48 | let bad64: f64 = 0.123_456_789_012_345_67;
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: consider changing the type or truncating it to: `0.123_456_789_012_345_66`
error: float has excessive precision
--> $DIR/excessive_precision.rs:51:26
--> $DIR/excessive_precision.rs:49:26
|
51 | let bad64_suf: f64 = 0.123_456_789_012_345_67f64;
49 | let bad64_suf: f64 = 0.123_456_789_012_345_67f64;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider changing the type or truncating it to: `0.123_456_789_012_345_66`
error: float has excessive precision
--> $DIR/excessive_precision.rs:52:21
--> $DIR/excessive_precision.rs:50:21
|
52 | let bad64_inf = 0.123_456_789_012_345_67;
50 | let bad64_inf = 0.123_456_789_012_345_67;
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: consider changing the type or truncating it to: `0.123_456_789_012_345_66`
error: float has excessive precision
--> $DIR/excessive_precision.rs:58:36
--> $DIR/excessive_precision.rs:56:36
|
58 | let bad_vec32: Vec<f32> = vec![0.123_456_789];
56 | let bad_vec32: Vec<f32> = vec![0.123_456_789];
| ^^^^^^^^^^^^^ help: consider changing the type or truncating it to: `0.123_456_79`
error: float has excessive precision
--> $DIR/excessive_precision.rs:59:36
--> $DIR/excessive_precision.rs:57:36
|
59 | let bad_vec64: Vec<f64> = vec![0.123_456_789_123_456_789];
57 | let bad_vec64: Vec<f64> = vec![0.123_456_789_123_456_789];
| ^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider changing the type or truncating it to: `0.123_456_789_123_456_78`
error: float has excessive precision
--> $DIR/excessive_precision.rs:63:24
--> $DIR/excessive_precision.rs:61:24
|
63 | let bad_e32: f32 = 1.123_456_788_888e-10;
61 | let bad_e32: f32 = 1.123_456_788_888e-10;
| ^^^^^^^^^^^^^^^^^^^^^ help: consider changing the type or truncating it to: `1.123_456_8e-10`
error: float has excessive precision
--> $DIR/excessive_precision.rs:66:27
--> $DIR/excessive_precision.rs:64:27
|
66 | let bad_bige32: f32 = 1.123_456_788_888E-10;
64 | let bad_bige32: f32 = 1.123_456_788_888E-10;
| ^^^^^^^^^^^^^^^^^^^^^ help: consider changing the type or truncating it to: `1.123_456_8E-10`
error: aborting due to 18 previous errors

View file

@ -1,39 +1,39 @@
error: use of `expect` followed by a function call
--> $DIR/expect_fun_call.rs:34:26
--> $DIR/expect_fun_call.rs:36:26
|
34 | with_none_and_format.expect(&format!("Error {}: fake error", error_code));
36 | with_none_and_format.expect(&format!("Error {}: fake error", error_code));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(|| panic!("Error {}: fake error", error_code))`
|
= note: `-D clippy::expect-fun-call` implied by `-D warnings`
error: use of `expect` followed by a function call
--> $DIR/expect_fun_call.rs:37:26
--> $DIR/expect_fun_call.rs:39:26
|
37 | with_none_and_as_str.expect(format!("Error {}: fake error", error_code).as_str());
39 | with_none_and_as_str.expect(format!("Error {}: fake error", error_code).as_str());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(|| panic!("Error {}: fake error", error_code))`
error: use of `expect` followed by a function call
--> $DIR/expect_fun_call.rs:47:25
--> $DIR/expect_fun_call.rs:49:25
|
47 | with_err_and_format.expect(&format!("Error {}: fake error", error_code));
49 | with_err_and_format.expect(&format!("Error {}: fake error", error_code));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(|_| panic!("Error {}: fake error", error_code))`
error: use of `expect` followed by a function call
--> $DIR/expect_fun_call.rs:50:25
--> $DIR/expect_fun_call.rs:52:25
|
50 | with_err_and_as_str.expect(format!("Error {}: fake error", error_code).as_str());
52 | with_err_and_as_str.expect(format!("Error {}: fake error", error_code).as_str());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(|_| panic!("Error {}: fake error", error_code))`
error: use of `expect` followed by a function call
--> $DIR/expect_fun_call.rs:65:17
--> $DIR/expect_fun_call.rs:67:17
|
65 | Some("foo").expect({ &format!("error") });
67 | Some("foo").expect({ &format!("error") });
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(|| { let msg = { &format!("error") }; panic!(msg) }))`
error: use of `expect` followed by a function call
--> $DIR/expect_fun_call.rs:66:17
--> $DIR/expect_fun_call.rs:68:17
|
66 | Some("foo").expect(format!("error").as_ref());
68 | Some("foo").expect(format!("error").as_ref());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(|| panic!("error"))`
error: aborting due to 6 previous errors

View file

@ -13,15 +13,15 @@ error: the variable `_index` is used as a loop counter. Consider using `for (_in
| ^^^^
error: the variable `count` is used as a loop counter. Consider using `for (count, item) in text.chars().enumerate()` or similar iterators
--> $DIR/explicit_counter_loop.rs:58:19
--> $DIR/explicit_counter_loop.rs:60:19
|
58 | for ch in text.chars() {
60 | for ch in text.chars() {
| ^^^^^^^^^^^^
error: the variable `count` is used as a loop counter. Consider using `for (count, item) in text.chars().enumerate()` or similar iterators
--> $DIR/explicit_counter_loop.rs:69:19
--> $DIR/explicit_counter_loop.rs:71:19
|
69 | for ch in text.chars() {
71 | for ch in text.chars() {
| ^^^^^^^^^^^^
error: aborting due to 4 previous errors

View file

@ -1,39 +1,39 @@
error: use of `write!(stdout(), ...).unwrap()`. Consider using `print!` instead
--> $DIR/explicit_write.rs:28:9
--> $DIR/explicit_write.rs:24:9
|
28 | write!(std::io::stdout(), "test").unwrap();
24 | write!(std::io::stdout(), "test").unwrap();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: `-D clippy::explicit-write` implied by `-D warnings`
error: use of `write!(stderr(), ...).unwrap()`. Consider using `eprint!` instead
--> $DIR/explicit_write.rs:29:9
--> $DIR/explicit_write.rs:25:9
|
29 | write!(std::io::stderr(), "test").unwrap();
25 | write!(std::io::stderr(), "test").unwrap();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: use of `writeln!(stdout(), ...).unwrap()`. Consider using `println!` instead
--> $DIR/explicit_write.rs:30:9
--> $DIR/explicit_write.rs:26:9
|
30 | writeln!(std::io::stdout(), "test").unwrap();
26 | writeln!(std::io::stdout(), "test").unwrap();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: use of `writeln!(stderr(), ...).unwrap()`. Consider using `eprintln!` instead
--> $DIR/explicit_write.rs:31:9
--> $DIR/explicit_write.rs:27:9
|
31 | writeln!(std::io::stderr(), "test").unwrap();
27 | writeln!(std::io::stderr(), "test").unwrap();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: use of `stdout().write_fmt(...).unwrap()`. Consider using `print!` instead
--> $DIR/explicit_write.rs:32:9
--> $DIR/explicit_write.rs:28:9
|
32 | std::io::stdout().write_fmt(format_args!("test")).unwrap();
28 | std::io::stdout().write_fmt(format_args!("test")).unwrap();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: use of `stderr().write_fmt(...).unwrap()`. Consider using `eprint!` instead
--> $DIR/explicit_write.rs:33:9
--> $DIR/explicit_write.rs:29:9
|
33 | std::io::stderr().write_fmt(format_args!("test")).unwrap();
29 | std::io::stderr().write_fmt(format_args!("test")).unwrap();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to 6 previous errors

View file

@ -1,91 +1,91 @@
error: consider implementing `TryFrom` instead
--> $DIR/fallible_impl_from.rs:17:1
--> $DIR/fallible_impl_from.rs:14:1
|
17 | / impl From<String> for Foo {
18 | | fn from(s: String) -> Self {
19 | | Foo(s.parse().unwrap())
20 | | }
21 | | }
14 | / impl From<String> for Foo {
15 | | fn from(s: String) -> Self {
16 | | Foo(s.parse().unwrap())
17 | | }
18 | | }
| |_^
|
note: lint level defined here
--> $DIR/fallible_impl_from.rs:13:9
--> $DIR/fallible_impl_from.rs:10:9
|
13 | #![deny(clippy::fallible_impl_from)]
10 | #![deny(clippy::fallible_impl_from)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
= help: `From` is intended for infallible conversions only. Use `TryFrom` if there's a possibility for the conversion to fail.
note: potential failure(s)
--> $DIR/fallible_impl_from.rs:19:13
--> $DIR/fallible_impl_from.rs:16:13
|
19 | Foo(s.parse().unwrap())
16 | Foo(s.parse().unwrap())
| ^^^^^^^^^^^^^^^^^^
error: consider implementing `TryFrom` instead
--> $DIR/fallible_impl_from.rs:40:1
--> $DIR/fallible_impl_from.rs:35:1
|
40 | / impl From<usize> for Invalid {
41 | | fn from(i: usize) -> Invalid {
42 | | if i != 42 {
43 | | panic!();
35 | / impl From<usize> for Invalid {
36 | | fn from(i: usize) -> Invalid {
37 | | if i != 42 {
38 | | panic!();
... |
46 | | }
47 | | }
41 | | }
42 | | }
| |_^
|
= help: `From` is intended for infallible conversions only. Use `TryFrom` if there's a possibility for the conversion to fail.
note: potential failure(s)
--> $DIR/fallible_impl_from.rs:43:13
--> $DIR/fallible_impl_from.rs:38:13
|
43 | panic!();
38 | panic!();
| ^^^^^^^^^
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
error: consider implementing `TryFrom` instead
--> $DIR/fallible_impl_from.rs:49:1
--> $DIR/fallible_impl_from.rs:44:1
|
49 | / impl From<Option<String>> for Invalid {
50 | | fn from(s: Option<String>) -> Invalid {
51 | | let s = s.unwrap();
52 | | if !s.is_empty() {
44 | / impl From<Option<String>> for Invalid {
45 | | fn from(s: Option<String>) -> Invalid {
46 | | let s = s.unwrap();
47 | | if !s.is_empty() {
... |
58 | | }
59 | | }
53 | | }
54 | | }
| |_^
|
= help: `From` is intended for infallible conversions only. Use `TryFrom` if there's a possibility for the conversion to fail.
note: potential failure(s)
--> $DIR/fallible_impl_from.rs:51:17
--> $DIR/fallible_impl_from.rs:46:17
|
51 | let s = s.unwrap();
46 | let s = s.unwrap();
| ^^^^^^^^^^
52 | if !s.is_empty() {
53 | panic!(42);
47 | if !s.is_empty() {
48 | panic!(42);
| ^^^^^^^^^^^
54 | } else if s.parse::<u32>().unwrap() != 42 {
49 | } else if s.parse::<u32>().unwrap() != 42 {
| ^^^^^^^^^^^^^^^^^^^^^^^^^
55 | panic!("{:?}", s);
50 | panic!("{:?}", s);
| ^^^^^^^^^^^^^^^^^^
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
error: consider implementing `TryFrom` instead
--> $DIR/fallible_impl_from.rs:67:1
--> $DIR/fallible_impl_from.rs:62:1
|
67 | / impl<'a> From<&'a mut <Box<u32> as ProjStrTrait>::ProjString> for Invalid {
68 | | fn from(s: &'a mut <Box<u32> as ProjStrTrait>::ProjString) -> Invalid {
69 | | if s.parse::<u32>().ok().unwrap() != 42 {
70 | | panic!("{:?}", s);
62 | / impl<'a> From<&'a mut <Box<u32> as ProjStrTrait>::ProjString> for Invalid {
63 | | fn from(s: &'a mut <Box<u32> as ProjStrTrait>::ProjString) -> Invalid {
64 | | if s.parse::<u32>().ok().unwrap() != 42 {
65 | | panic!("{:?}", s);
... |
73 | | }
74 | | }
68 | | }
69 | | }
| |_^
|
= help: `From` is intended for infallible conversions only. Use `TryFrom` if there's a possibility for the conversion to fail.
note: potential failure(s)
--> $DIR/fallible_impl_from.rs:69:12
--> $DIR/fallible_impl_from.rs:64:12
|
69 | if s.parse::<u32>().ok().unwrap() != 42 {
64 | if s.parse::<u32>().ok().unwrap() != 42 {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
70 | panic!("{:?}", s);
65 | panic!("{:?}", s);
| ^^^^^^^^^^^^^^^^^^
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)

View file

@ -1,40 +1,40 @@
error: called `filter(p).map(q)` on an `Iterator`. This is more succinctly expressed by calling `.filter_map(..)` instead.
--> $DIR/filter_methods.rs:18:21
--> $DIR/filter_methods.rs:14:21
|
18 | let _: Vec<_> = vec![5; 6].into_iter()
| _____________________^
19 | | .filter(|&x| x == 0)
20 | | .map(|x| x * 2)
| |_____________________________________________^
14 | let _: Vec<_> = vec![5; 6].into_iter().filter(|&x| x == 0).map(|x| x * 2).collect();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: `-D clippy::filter-map` implied by `-D warnings`
error: called `filter(p).flat_map(q)` on an `Iterator`. This is more succinctly expressed by calling `.flat_map(..)` and filtering by returning an empty Iterator.
--> $DIR/filter_methods.rs:23:21
--> $DIR/filter_methods.rs:16:21
|
23 | let _: Vec<_> = vec![5_i8; 6].into_iter()
16 | let _: Vec<_> = vec![5_i8; 6]
| _____________________^
24 | | .filter(|&x| x == 0)
25 | | .flat_map(|x| x.checked_mul(2))
| |_______________________________________________________________^
17 | | .into_iter()
18 | | .filter(|&x| x == 0)
19 | | .flat_map(|x| x.checked_mul(2))
| |_______________________________________^
error: called `filter_map(p).flat_map(q)` on an `Iterator`. This is more succinctly expressed by calling `.flat_map(..)` and filtering by returning an empty Iterator.
--> $DIR/filter_methods.rs:28:21
--> $DIR/filter_methods.rs:22:21
|
28 | let _: Vec<_> = vec![5_i8; 6].into_iter()
22 | let _: Vec<_> = vec![5_i8; 6]
| _____________________^
29 | | .filter_map(|x| x.checked_mul(2))
30 | | .flat_map(|x| x.checked_mul(2))
| |_______________________________________________________________^
23 | | .into_iter()
24 | | .filter_map(|x| x.checked_mul(2))
25 | | .flat_map(|x| x.checked_mul(2))
| |_______________________________________^
error: called `filter_map(p).map(q)` on an `Iterator`. This is more succinctly expressed by only calling `.filter_map(..)` instead.
--> $DIR/filter_methods.rs:33:21
--> $DIR/filter_methods.rs:28:21
|
33 | let _: Vec<_> = vec![5_i8; 6].into_iter()
28 | let _: Vec<_> = vec![5_i8; 6]
| _____________________^
34 | | .filter_map(|x| x.checked_mul(2))
35 | | .map(|x| x.checked_mul(2))
| |__________________________________________________________^
29 | | .into_iter()
30 | | .filter_map(|x| x.checked_mul(2))
31 | | .map(|x| x.checked_mul(2))
| |__________________________________^
error: aborting due to 4 previous errors

View file

@ -1,38 +1,38 @@
error: strict comparison of f32 or f64
--> $DIR/float_cmp.rs:59:5
--> $DIR/float_cmp.rs:69:5
|
59 | ONE as f64 != 2.0;
69 | ONE as f64 != 2.0;
| ^^^^^^^^^^^^^^^^^ help: consider comparing them within some error: `(ONE as f64 - 2.0).abs() < error`
|
= note: `-D clippy::float-cmp` implied by `-D warnings`
note: std::f32::EPSILON and std::f64::EPSILON are available.
--> $DIR/float_cmp.rs:59:5
--> $DIR/float_cmp.rs:69:5
|
59 | ONE as f64 != 2.0;
69 | ONE as f64 != 2.0;
| ^^^^^^^^^^^^^^^^^
error: strict comparison of f32 or f64
--> $DIR/float_cmp.rs:64:5
--> $DIR/float_cmp.rs:74:5
|
64 | x == 1.0;
74 | x == 1.0;
| ^^^^^^^^ help: consider comparing them within some error: `(x - 1.0).abs() < error`
|
note: std::f32::EPSILON and std::f64::EPSILON are available.
--> $DIR/float_cmp.rs:64:5
--> $DIR/float_cmp.rs:74:5
|
64 | x == 1.0;
74 | x == 1.0;
| ^^^^^^^^
error: strict comparison of f32 or f64
--> $DIR/float_cmp.rs:67:5
--> $DIR/float_cmp.rs:77:5
|
67 | twice(x) != twice(ONE as f64);
77 | twice(x) != twice(ONE as f64);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 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.
--> $DIR/float_cmp.rs:67:5
--> $DIR/float_cmp.rs:77:5
|
67 | twice(x) != twice(ONE as f64);
77 | twice(x) != twice(ONE as f64);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to 3 previous errors

View file

@ -1,420 +1,420 @@
error: the loop variable `i` is only used to index `vec`.
--> $DIR/for_loop.rs:38:14
--> $DIR/for_loop.rs:50:14
|
38 | for i in 0..vec.len() {
50 | for i in 0..vec.len() {
| ^^^^^^^^^^^^
|
= note: `-D clippy::needless-range-loop` implied by `-D warnings`
help: consider using an iterator
|
38 | for <item> in &vec {
50 | for <item> in &vec {
| ^^^^^^ ^^^^
error: the loop variable `i` is only used to index `vec`.
--> $DIR/for_loop.rs:47:14
--> $DIR/for_loop.rs:59:14
|
47 | for i in 0..vec.len() {
59 | for i in 0..vec.len() {
| ^^^^^^^^^^^^
help: consider using an iterator
|
47 | for <item> in &vec {
59 | for <item> in &vec {
| ^^^^^^ ^^^^
error: the loop variable `j` is only used to index `STATIC`.
--> $DIR/for_loop.rs:52:14
--> $DIR/for_loop.rs:64:14
|
52 | for j in 0..4 {
64 | for j in 0..4 {
| ^^^^
help: consider using an iterator
|
52 | for <item> in &STATIC {
64 | for <item> in &STATIC {
| ^^^^^^ ^^^^^^^
error: the loop variable `j` is only used to index `CONST`.
--> $DIR/for_loop.rs:56:14
--> $DIR/for_loop.rs:68:14
|
56 | for j in 0..4 {
68 | for j in 0..4 {
| ^^^^
help: consider using an iterator
|
56 | for <item> in &CONST {
68 | for <item> in &CONST {
| ^^^^^^ ^^^^^^
error: the loop variable `i` is used to index `vec`
--> $DIR/for_loop.rs:60:14
--> $DIR/for_loop.rs:72:14
|
60 | for i in 0..vec.len() {
72 | for i in 0..vec.len() {
| ^^^^^^^^^^^^
help: consider using an iterator
|
60 | for (i, <item>) in vec.iter().enumerate() {
72 | for (i, <item>) in vec.iter().enumerate() {
| ^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^
error: the loop variable `i` is only used to index `vec2`.
--> $DIR/for_loop.rs:68:14
|
68 | for i in 0..vec.len() {
| ^^^^^^^^^^^^
help: consider using an iterator
|
68 | for <item> in vec2.iter().take(vec.len()) {
| ^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: the loop variable `i` is only used to index `vec`.
--> $DIR/for_loop.rs:72:14
|
72 | for i in 5..vec.len() {
| ^^^^^^^^^^^^
help: consider using an iterator
|
72 | for <item> in vec.iter().skip(5) {
| ^^^^^^ ^^^^^^^^^^^^^^^^^^
error: the loop variable `i` is only used to index `vec`.
--> $DIR/for_loop.rs:76:14
|
76 | for i in 0..MAX_LEN {
| ^^^^^^^^^^
help: consider using an iterator
|
76 | for <item> in vec.iter().take(MAX_LEN) {
| ^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^
error: the loop variable `i` is only used to index `vec`.
--> $DIR/for_loop.rs:80:14
|
80 | for i in 0..=MAX_LEN {
| ^^^^^^^^^^^
80 | for i in 0..vec.len() {
| ^^^^^^^^^^^^
help: consider using an iterator
|
80 | for <item> in vec.iter().take(MAX_LEN + 1) {
| ^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
80 | for <item> in vec2.iter().take(vec.len()) {
| ^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: the loop variable `i` is only used to index `vec`.
--> $DIR/for_loop.rs:84:14
|
84 | for i in 5..10 {
| ^^^^^
84 | for i in 5..vec.len() {
| ^^^^^^^^^^^^
help: consider using an iterator
|
84 | for <item> in vec.iter().take(10).skip(5) {
| ^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^
84 | for <item> in vec.iter().skip(5) {
| ^^^^^^ ^^^^^^^^^^^^^^^^^^
error: the loop variable `i` is only used to index `vec`.
--> $DIR/for_loop.rs:88:14
|
88 | for i in 5..=10 {
| ^^^^^^
88 | for i in 0..MAX_LEN {
| ^^^^^^^^^^
help: consider using an iterator
|
88 | for <item> in vec.iter().take(10 + 1).skip(5) {
| ^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
88 | for <item> in vec.iter().take(MAX_LEN) {
| ^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^
error: the loop variable `i` is used to index `vec`
error: the loop variable `i` is only used to index `vec`.
--> $DIR/for_loop.rs:92:14
|
92 | for i in 5..vec.len() {
| ^^^^^^^^^^^^
92 | for i in 0..=MAX_LEN {
| ^^^^^^^^^^^
help: consider using an iterator
|
92 | for (i, <item>) in vec.iter().enumerate().skip(5) {
| ^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
92 | for <item> in vec.iter().take(MAX_LEN + 1) {
| ^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: the loop variable `i` is used to index `vec`
error: the loop variable `i` is only used to index `vec`.
--> $DIR/for_loop.rs:96:14
|
96 | for i in 5..10 {
| ^^^^^
help: consider using an iterator
|
96 | for (i, <item>) in vec.iter().enumerate().take(10).skip(5) {
| ^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
96 | for <item> in vec.iter().take(10).skip(5) {
| ^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: this range is empty so this for loop will never run
error: the loop variable `i` is only used to index `vec`.
--> $DIR/for_loop.rs:100:14
|
100 | for i in 10..0 {
100 | for i in 5..=10 {
| ^^^^^^
help: consider using an iterator
|
100 | for <item> in vec.iter().take(10 + 1).skip(5) {
| ^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: the loop variable `i` is used to index `vec`
--> $DIR/for_loop.rs:104:14
|
104 | for i in 5..vec.len() {
| ^^^^^^^^^^^^
help: consider using an iterator
|
104 | for (i, <item>) in vec.iter().enumerate().skip(5) {
| ^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: the loop variable `i` is used to index `vec`
--> $DIR/for_loop.rs:108:14
|
108 | for i in 5..10 {
| ^^^^^
help: consider using an iterator
|
108 | for (i, <item>) in vec.iter().enumerate().take(10).skip(5) {
| ^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: this range is empty so this for loop will never run
--> $DIR/for_loop.rs:112:14
|
112 | for i in 10..0 {
| ^^^^^
|
= note: `-D clippy::reverse-range-loop` implied by `-D warnings`
help: consider using the following if you are attempting to iterate over this range in reverse
|
100 | for i in (0..10).rev() {
112 | for i in (0..10).rev() {
| ^^^^^^^^^^^^^
error: this range is empty so this for loop will never run
--> $DIR/for_loop.rs:104:14
--> $DIR/for_loop.rs:116:14
|
104 | for i in 10..=0 {
116 | for i in 10..=0 {
| ^^^^^^
help: consider using the following if you are attempting to iterate over this range in reverse
|
104 | for i in (0...10).rev() {
116 | for i in (0...10).rev() {
| ^^^^^^^^^^^^^^
error: this range is empty so this for loop will never run
--> $DIR/for_loop.rs:108:14
--> $DIR/for_loop.rs:120:14
|
108 | for i in MAX_LEN..0 {
120 | for i in MAX_LEN..0 {
| ^^^^^^^^^^
help: consider using the following if you are attempting to iterate over this range in reverse
|
108 | for i in (0..MAX_LEN).rev() {
120 | for i in (0..MAX_LEN).rev() {
| ^^^^^^^^^^^^^^^^^^
error: this range is empty so this for loop will never run
--> $DIR/for_loop.rs:112:14
--> $DIR/for_loop.rs:124:14
|
112 | for i in 5..5 {
124 | for i in 5..5 {
| ^^^^
error: this range is empty so this for loop will never run
--> $DIR/for_loop.rs:137:14
--> $DIR/for_loop.rs:149:14
|
137 | for i in 10..5 + 4 {
149 | for i in 10..5 + 4 {
| ^^^^^^^^^
help: consider using the following if you are attempting to iterate over this range in reverse
|
137 | for i in (5 + 4..10).rev() {
149 | for i in (5 + 4..10).rev() {
| ^^^^^^^^^^^^^^^^^
error: this range is empty so this for loop will never run
--> $DIR/for_loop.rs:141:14
--> $DIR/for_loop.rs:153:14
|
141 | for i in (5 + 2)..(3 - 1) {
153 | for i in (5 + 2)..(3 - 1) {
| ^^^^^^^^^^^^^^^^
help: consider using the following if you are attempting to iterate over this range in reverse
|
141 | for i in ((3 - 1)..(5 + 2)).rev() {
153 | for i in ((3 - 1)..(5 + 2)).rev() {
| ^^^^^^^^^^^^^^^^^^^^^^^^
error: this range is empty so this for loop will never run
--> $DIR/for_loop.rs:145:14
--> $DIR/for_loop.rs:157:14
|
145 | for i in (5 + 2)..(8 - 1) {
157 | for i in (5 + 2)..(8 - 1) {
| ^^^^^^^^^^^^^^^^
error: it is more concise to loop over references to containers instead of using explicit iteration methods
--> $DIR/for_loop.rs:167:15
--> $DIR/for_loop.rs:179:15
|
167 | for _v in vec.iter() {}
179 | for _v in vec.iter() {}
| ^^^^^^^^^^ help: to write this more concisely, try: `&vec`
|
= note: `-D clippy::explicit-iter-loop` implied by `-D warnings`
error: it is more concise to loop over references to containers instead of using explicit iteration methods
--> $DIR/for_loop.rs:169:15
--> $DIR/for_loop.rs:181:15
|
169 | for _v in vec.iter_mut() {}
181 | for _v in vec.iter_mut() {}
| ^^^^^^^^^^^^^^ help: to write this more concisely, try: `&mut vec`
error: it is more concise to loop over containers instead of using explicit iteration methods`
--> $DIR/for_loop.rs:172:15
--> $DIR/for_loop.rs:184:15
|
172 | for _v in out_vec.into_iter() {}
184 | for _v in out_vec.into_iter() {}
| ^^^^^^^^^^^^^^^^^^^ help: to write this more concisely, try: `out_vec`
|
= note: `-D clippy::explicit-into-iter-loop` implied by `-D warnings`
error: it is more concise to loop over references to containers instead of using explicit iteration methods
--> $DIR/for_loop.rs:175:15
--> $DIR/for_loop.rs:187:15
|
175 | for _v in array.into_iter() {}
187 | for _v in array.into_iter() {}
| ^^^^^^^^^^^^^^^^^ help: to write this more concisely, try: `&array`
error: it is more concise to loop over references to containers instead of using explicit iteration methods
--> $DIR/for_loop.rs:180:15
|
180 | for _v in [1, 2, 3].iter() {}
| ^^^^^^^^^^^^^^^^ help: to write this more concisely, try: `&[1, 2, 3]`
error: it is more concise to loop over references to containers instead of using explicit iteration methods
--> $DIR/for_loop.rs:184:15
|
184 | for _v in [0; 32].iter() {}
| ^^^^^^^^^^^^^^ help: to write this more concisely, try: `&[0; 32]`
error: it is more concise to loop over references to containers instead of using explicit iteration methods
--> $DIR/for_loop.rs:189:15
|
189 | for _v in ll.iter() {}
| ^^^^^^^^^ help: to write this more concisely, try: `&ll`
error: it is more concise to loop over references to containers instead of using explicit iteration methods
--> $DIR/for_loop.rs:192:15
|
192 | for _v in vd.iter() {}
| ^^^^^^^^^ help: to write this more concisely, try: `&vd`
192 | for _v in [1, 2, 3].iter() {}
| ^^^^^^^^^^^^^^^^ help: to write this more concisely, try: `&[1, 2, 3]`
error: it is more concise to loop over references to containers instead of using explicit iteration methods
--> $DIR/for_loop.rs:195:15
--> $DIR/for_loop.rs:196:15
|
195 | for _v in bh.iter() {}
| ^^^^^^^^^ help: to write this more concisely, try: `&bh`
error: it is more concise to loop over references to containers instead of using explicit iteration methods
--> $DIR/for_loop.rs:198:15
|
198 | for _v in hm.iter() {}
| ^^^^^^^^^ help: to write this more concisely, try: `&hm`
196 | for _v in [0; 32].iter() {}
| ^^^^^^^^^^^^^^ help: to write this more concisely, try: `&[0; 32]`
error: it is more concise to loop over references to containers instead of using explicit iteration methods
--> $DIR/for_loop.rs:201:15
|
201 | for _v in bt.iter() {}
| ^^^^^^^^^ help: to write this more concisely, try: `&bt`
201 | for _v in ll.iter() {}
| ^^^^^^^^^ help: to write this more concisely, try: `&ll`
error: it is more concise to loop over references to containers instead of using explicit iteration methods
--> $DIR/for_loop.rs:204:15
|
204 | for _v in hs.iter() {}
| ^^^^^^^^^ help: to write this more concisely, try: `&hs`
204 | for _v in vd.iter() {}
| ^^^^^^^^^ help: to write this more concisely, try: `&vd`
error: it is more concise to loop over references to containers instead of using explicit iteration methods
--> $DIR/for_loop.rs:207:15
|
207 | for _v in bs.iter() {}
207 | for _v in bh.iter() {}
| ^^^^^^^^^ help: to write this more concisely, try: `&bh`
error: it is more concise to loop over references to containers instead of using explicit iteration methods
--> $DIR/for_loop.rs:210:15
|
210 | for _v in hm.iter() {}
| ^^^^^^^^^ help: to write this more concisely, try: `&hm`
error: it is more concise to loop over references to containers instead of using explicit iteration methods
--> $DIR/for_loop.rs:213:15
|
213 | for _v in bt.iter() {}
| ^^^^^^^^^ help: to write this more concisely, try: `&bt`
error: it is more concise to loop over references to containers instead of using explicit iteration methods
--> $DIR/for_loop.rs:216:15
|
216 | for _v in hs.iter() {}
| ^^^^^^^^^ help: to write this more concisely, try: `&hs`
error: it is more concise to loop over references to containers instead of using explicit iteration methods
--> $DIR/for_loop.rs:219:15
|
219 | for _v in bs.iter() {}
| ^^^^^^^^^ 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
--> $DIR/for_loop.rs:209:15
--> $DIR/for_loop.rs:221:15
|
209 | for _v in vec.iter().next() {}
221 | for _v in vec.iter().next() {}
| ^^^^^^^^^^^^^^^^^
|
= note: `-D clippy::iter-next-loop` implied by `-D warnings`
error: you are collect()ing an iterator and throwing away the result. Consider using an explicit for loop to exhaust the iterator
--> $DIR/for_loop.rs:216:5
--> $DIR/for_loop.rs:228:5
|
216 | vec.iter().cloned().map(|x| out.push(x)).collect::<Vec<_>>();
228 | vec.iter().cloned().map(|x| out.push(x)).collect::<Vec<_>>();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: `-D clippy::unused-collect` implied by `-D warnings`
error: you seem to want to iterate on a map's values
--> $DIR/for_loop.rs:325:19
--> $DIR/for_loop.rs:337:19
|
325 | for (_, v) in &m {
337 | for (_, v) in &m {
| ^^
|
= note: `-D clippy::for-kv-map` implied by `-D warnings`
help: use the corresponding method
|
325 | for v in m.values() {
337 | for v in m.values() {
| ^ ^^^^^^^^^^
error: you seem to want to iterate on a map's values
--> $DIR/for_loop.rs:330:19
--> $DIR/for_loop.rs:342:19
|
330 | for (_, v) in &*m {
342 | for (_, v) in &*m {
| ^^^
help: use the corresponding method
|
330 | for v in (*m).values() {
342 | for v in (*m).values() {
| ^ ^^^^^^^^^^^^^
error: you seem to want to iterate on a map's values
--> $DIR/for_loop.rs:338:19
--> $DIR/for_loop.rs:350:19
|
338 | for (_, v) in &mut m {
350 | for (_, v) in &mut m {
| ^^^^^^
help: use the corresponding method
|
338 | for v in m.values_mut() {
350 | for v in m.values_mut() {
| ^ ^^^^^^^^^^^^^^
error: you seem to want to iterate on a map's values
--> $DIR/for_loop.rs:343:19
--> $DIR/for_loop.rs:355:19
|
343 | for (_, v) in &mut *m {
355 | for (_, v) in &mut *m {
| ^^^^^^^
help: use the corresponding method
|
343 | for v in (*m).values_mut() {
355 | for v in (*m).values_mut() {
| ^ ^^^^^^^^^^^^^^^^^
error: you seem to want to iterate on a map's keys
--> $DIR/for_loop.rs:349:24
--> $DIR/for_loop.rs:361:24
|
349 | for (k, _value) in rm {
361 | for (k, _value) in rm {
| ^^
help: use the corresponding method
|
349 | for k in rm.keys() {
361 | for k in rm.keys() {
| ^ ^^^^^^^^^
error: it looks like you're manually copying between slices
--> $DIR/for_loop.rs:402:14
--> $DIR/for_loop.rs:414:14
|
402 | for i in 0..src.len() {
414 | for i in 0..src.len() {
| ^^^^^^^^^^^^ help: try replacing the loop by: `dst[..src.len()].clone_from_slice(&src[..])`
|
= note: `-D clippy::manual-memcpy` implied by `-D warnings`
error: it looks like you're manually copying between slices
--> $DIR/for_loop.rs:407:14
--> $DIR/for_loop.rs:419:14
|
407 | for i in 0..src.len() {
419 | for i in 0..src.len() {
| ^^^^^^^^^^^^ help: try replacing the loop by: `dst[10..(src.len() + 10)].clone_from_slice(&src[..])`
error: it looks like you're manually copying between slices
--> $DIR/for_loop.rs:412:14
--> $DIR/for_loop.rs:424:14
|
412 | for i in 0..src.len() {
424 | for i in 0..src.len() {
| ^^^^^^^^^^^^ help: try replacing the loop by: `dst[..src.len()].clone_from_slice(&src[10..])`
error: it looks like you're manually copying between slices
--> $DIR/for_loop.rs:417:14
--> $DIR/for_loop.rs:429:14
|
417 | for i in 11..src.len() {
429 | for i in 11..src.len() {
| ^^^^^^^^^^^^^ help: try replacing the loop by: `dst[11..src.len()].clone_from_slice(&src[(11 - 10)..(src.len() - 10)])`
error: it looks like you're manually copying between slices
--> $DIR/for_loop.rs:422:14
--> $DIR/for_loop.rs:434:14
|
422 | for i in 0..dst.len() {
434 | for i in 0..dst.len() {
| ^^^^^^^^^^^^ help: try replacing the loop by: `dst.clone_from_slice(&src[..dst.len()])`
error: it looks like you're manually copying between slices
--> $DIR/for_loop.rs:435:14
|
435 | for i in 10..256 {
| ^^^^^^^
help: try replacing the loop by
|
435 | for i in dst[10..256].clone_from_slice(&src[(10 - 5)..(256 - 5)])
436 | dst2[(10 + 500)..(256 + 500)].clone_from_slice(&src[10..256]) {
|
error: it looks like you're manually copying between slices
--> $DIR/for_loop.rs:447:14
|
447 | for i in 10..LOOP_OFFSET {
447 | for i in 10..256 {
| ^^^^^^^
help: try replacing the loop by
|
447 | for i in dst[10..256].clone_from_slice(&src[(10 - 5)..(256 - 5)])
448 | dst2[(10 + 500)..(256 + 500)].clone_from_slice(&src[10..256]) {
|
error: it looks like you're manually copying between slices
--> $DIR/for_loop.rs:459:14
|
459 | for i in 10..LOOP_OFFSET {
| ^^^^^^^^^^^^^^^ help: try replacing the loop by: `dst[(10 + LOOP_OFFSET)..(LOOP_OFFSET + LOOP_OFFSET)].clone_from_slice(&src[(10 - some_var)..(LOOP_OFFSET - some_var)])`
error: it looks like you're manually copying between slices
--> $DIR/for_loop.rs:460:14
--> $DIR/for_loop.rs:472:14
|
460 | for i in 0..src_vec.len() {
472 | for i in 0..src_vec.len() {
| ^^^^^^^^^^^^^^^^ help: try replacing the loop by: `dst_vec[..src_vec.len()].clone_from_slice(&src_vec[..])`
error: it looks like you're manually copying between slices
--> $DIR/for_loop.rs:489:14
--> $DIR/for_loop.rs:501:14
|
489 | for i in from..from + src.len() {
501 | for i in from..from + src.len() {
| ^^^^^^^^^^^^^^^^^^^^^^ help: try replacing the loop by: `dst[from..from + src.len()].clone_from_slice(&src[0..(from + src.len() - from)])`
error: it looks like you're manually copying between slices
--> $DIR/for_loop.rs:493:14
--> $DIR/for_loop.rs:505:14
|
493 | for i in from..from + 3 {
505 | for i in from..from + 3 {
| ^^^^^^^^^^^^^^ help: try replacing the loop by: `dst[from..from + 3].clone_from_slice(&src[0..(from + 3 - from)])`
error: it looks like you're manually copying between slices
--> $DIR/for_loop.rs:500:14
--> $DIR/for_loop.rs:512:14
|
500 | for i in 0..src.len() {
512 | for i in 0..src.len() {
| ^^^^^^^^^^^^ help: try replacing the loop by: `dst[..src.len()].clone_from_slice(&src[..])`
error: aborting due to 51 previous errors

View file

@ -1,90 +1,19 @@
error: this looks like an `else if` but the `else` is missing
--> $DIR/formatting.rs:25:6
|
25 | } if foo() {
| ^
|
= note: `-D clippy::suspicious-else-formatting` implied by `-D warnings`
= note: to remove this lint, add the missing `else` or add a new line before the second `if`
error: this looks like an `else if` but the `else` is missing
--> $DIR/formatting.rs:32:10
|
32 | } if foo() {
| ^
|
= note: to remove this lint, add the missing `else` or add a new line before the second `if`
error: this looks like an `else if` but the `else` is missing
--> $DIR/formatting.rs:40:10
|
40 | } if foo() {
| ^
|
= note: to remove this lint, add the missing `else` or add a new line before the second `if`
error: this is an `else if` but the formatting might hide it
--> $DIR/formatting.rs:49:6
|
49 | } else
| ______^
50 | | if foo() { // the span of the above error should continue here
| |____^
|
= note: to remove this lint, remove the `else` or remove the new line between `else` and `if`
error: this is an `else if` but the formatting might hide it
--> $DIR/formatting.rs:54:6
|
54 | }
| ______^
55 | | else
56 | | if foo() { // the span of the above error should continue here
| |____^
|
= note: to remove this lint, remove the `else` or remove the new line between `else` and `if`
error: this looks like you are trying to use `.. -= ..`, but you really are doing `.. = (- ..)`
--> $DIR/formatting.rs:81:6
|
81 | a =- 35;
| ^^^^
|
= note: `-D clippy::suspicious-assignment-formatting` implied by `-D warnings`
= note: to remove this lint, use either `-=` or `= -`
error: this looks like you are trying to use `.. *= ..`, but you really are doing `.. = (* ..)`
--> $DIR/formatting.rs:82:6
|
82 | a =* &191;
| ^^^^
|
= note: to remove this lint, use either `*=` or `= *`
error: this looks like you are trying to use `.. != ..`, but you really are doing `.. = (! ..)`
--> $DIR/formatting.rs:85:6
|
85 | b =! false;
| ^^^^
|
= note: to remove this lint, use either `!=` or `= !`
error: possibly missing a comma here
--> $DIR/formatting.rs:94:19
--> $DIR/formatting.rs:88:11
|
94 | -1, -2, -3 // <= no comma here
| ^
88 | -3 // <= no comma here
| ^
|
= note: `-D clippy::possible-missing-comma` implied by `-D warnings`
= note: to remove this lint, add a comma or write the expr in a single line
error: possibly missing a comma here
--> $DIR/formatting.rs:98:19
--> $DIR/formatting.rs:96:11
|
98 | -1, -2, -3 // <= no comma here
| ^
96 | -3 // <= no comma here
| ^
|
= note: to remove this lint, add a comma or write the expr in a single line
error: aborting due to 10 previous errors
error: aborting due to 2 previous errors

View file

@ -1,78 +1,77 @@
error: this function has too many arguments (8/7)
--> $DIR/functions.rs:21:1
--> $DIR/functions.rs:17:1
|
21 | / fn bad(_one: u32, _two: u32, _three: &str, _four: bool, _five: f32, _six: f32, _seven: bool, _eight: ()) {
22 | | }
| |_^
17 | fn bad(_one: u32, _two: u32, _three: &str, _four: bool, _five: f32, _six: f32, _seven: bool, _eight: ()) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: `-D clippy::too-many-arguments` implied by `-D warnings`
error: this function has too many arguments (8/7)
--> $DIR/functions.rs:29:5
--> $DIR/functions.rs:34:5
|
29 | fn bad(_one: u32, _two: u32, _three: &str, _four: bool, _five: f32, _six: f32, _seven: bool, _eight: ());
34 | fn bad(_one: u32, _two: u32, _three: &str, _four: bool, _five: f32, _six: f32, _seven: bool, _eight: ());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: this function has too many arguments (8/7)
--> $DIR/functions.rs:38:5
--> $DIR/functions.rs:43:5
|
38 | fn bad_method(_one: u32, _two: u32, _three: &str, _four: bool, _five: f32, _six: f32, _seven: bool, _eight: ()) {}
43 | fn bad_method(_one: u32, _two: u32, _three: &str, _four: bool, _five: f32, _six: f32, _seven: bool, _eight: ()) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: this public function dereferences a raw pointer but is not marked `unsafe`
--> $DIR/functions.rs:47:34
--> $DIR/functions.rs:52:34
|
47 | println!("{}", unsafe { *p });
52 | println!("{}", unsafe { *p });
| ^
|
= note: `-D clippy::not-unsafe-ptr-arg-deref` implied by `-D warnings`
error: this public function dereferences a raw pointer but is not marked `unsafe`
--> $DIR/functions.rs:48:35
--> $DIR/functions.rs:53:35
|
48 | println!("{:?}", unsafe { p.as_ref() });
53 | println!("{:?}", unsafe { p.as_ref() });
| ^
error: this public function dereferences a raw pointer but is not marked `unsafe`
--> $DIR/functions.rs:49:33
--> $DIR/functions.rs:54:33
|
49 | unsafe { std::ptr::read(p) };
54 | unsafe { std::ptr::read(p) };
| ^
error: this public function dereferences a raw pointer but is not marked `unsafe`
--> $DIR/functions.rs:60:30
--> $DIR/functions.rs:65:30
|
60 | println!("{}", unsafe { *p });
65 | println!("{}", unsafe { *p });
| ^
error: this public function dereferences a raw pointer but is not marked `unsafe`
--> $DIR/functions.rs:61:31
--> $DIR/functions.rs:66:31
|
61 | println!("{:?}", unsafe { p.as_ref() });
66 | println!("{:?}", unsafe { p.as_ref() });
| ^
error: this public function dereferences a raw pointer but is not marked `unsafe`
--> $DIR/functions.rs:62:29
--> $DIR/functions.rs:67:29
|
62 | unsafe { std::ptr::read(p) };
67 | unsafe { std::ptr::read(p) };
| ^
error: this public function dereferences a raw pointer but is not marked `unsafe`
--> $DIR/functions.rs:71:34
--> $DIR/functions.rs:76:34
|
71 | println!("{}", unsafe { *p });
76 | println!("{}", unsafe { *p });
| ^
error: this public function dereferences a raw pointer but is not marked `unsafe`
--> $DIR/functions.rs:72:35
--> $DIR/functions.rs:77:35
|
72 | println!("{:?}", unsafe { p.as_ref() });
77 | println!("{:?}", unsafe { p.as_ref() });
| ^
error: this public function dereferences a raw pointer but is not marked `unsafe`
--> $DIR/functions.rs:73:33
--> $DIR/functions.rs:78:33
|
73 | unsafe { std::ptr::read(p) };
78 | unsafe { std::ptr::read(p) };
| ^
error: aborting due to 12 previous errors

View file

@ -1,39 +1,39 @@
error: Prefer FxHashMap over HashMap, it has better performance and we don't need any collision prevention in clippy
--> $DIR/fxhash.rs:18:24
--> $DIR/fxhash.rs:16:24
|
18 | use std::collections::{HashMap, HashSet};
16 | use std::collections::{HashMap, HashSet};
| ^^^^^^^ help: use: `FxHashMap`
|
= note: `-D clippy::default-hash-types` implied by `-D warnings`
error: Prefer FxHashSet over HashSet, it has better performance and we don't need any collision prevention in clippy
--> $DIR/fxhash.rs:18:33
--> $DIR/fxhash.rs:16:33
|
18 | use std::collections::{HashMap, HashSet};
16 | use std::collections::{HashMap, HashSet};
| ^^^^^^^ help: use: `FxHashSet`
error: Prefer FxHashMap over HashMap, it has better performance and we don't need any collision prevention in clippy
--> $DIR/fxhash.rs:22:15
--> $DIR/fxhash.rs:19:15
|
22 | let _map: HashMap<String, String> = HashMap::default();
19 | let _map: HashMap<String, String> = HashMap::default();
| ^^^^^^^ help: use: `FxHashMap`
error: Prefer FxHashMap over HashMap, it has better performance and we don't need any collision prevention in clippy
--> $DIR/fxhash.rs:22:41
--> $DIR/fxhash.rs:19:41
|
22 | let _map: HashMap<String, String> = HashMap::default();
19 | let _map: HashMap<String, String> = HashMap::default();
| ^^^^^^^ help: use: `FxHashMap`
error: Prefer FxHashSet over HashSet, it has better performance and we don't need any collision prevention in clippy
--> $DIR/fxhash.rs:23:15
--> $DIR/fxhash.rs:20:15
|
23 | let _set: HashSet<String> = HashSet::default();
20 | let _set: HashSet<String> = HashSet::default();
| ^^^^^^^ help: use: `FxHashSet`
error: Prefer FxHashSet over HashSet, it has better performance and we don't need any collision prevention in clippy
--> $DIR/fxhash.rs:23:33
--> $DIR/fxhash.rs:20:33
|
23 | let _set: HashSet<String> = HashSet::default();
20 | let _set: HashSet<String> = HashSet::default();
| ^^^^^^^ help: use: `FxHashSet`
error: aborting due to 6 previous errors

View file

@ -1,75 +1,75 @@
error: called `.get().unwrap()` on a slice. Using `[]` is more clear and more concise
--> $DIR/get_unwrap.rs:37:17
--> $DIR/get_unwrap.rs:41:17
|
37 | let _ = boxed_slice.get(1).unwrap();
41 | let _ = boxed_slice.get(1).unwrap();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `&boxed_slice[1]`
|
= note: `-D clippy::get-unwrap` implied by `-D warnings`
error: called `.get().unwrap()` on a slice. Using `[]` is more clear and more concise
--> $DIR/get_unwrap.rs:38:17
--> $DIR/get_unwrap.rs:42:17
|
38 | let _ = some_slice.get(0).unwrap();
42 | let _ = some_slice.get(0).unwrap();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `&some_slice[0]`
error: called `.get().unwrap()` on a Vec. Using `[]` is more clear and more concise
--> $DIR/get_unwrap.rs:39:17
--> $DIR/get_unwrap.rs:43:17
|
39 | let _ = some_vec.get(0).unwrap();
43 | let _ = some_vec.get(0).unwrap();
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `&some_vec[0]`
error: called `.get().unwrap()` on a VecDeque. Using `[]` is more clear and more concise
--> $DIR/get_unwrap.rs:40:17
--> $DIR/get_unwrap.rs:44:17
|
40 | let _ = some_vecdeque.get(0).unwrap();
44 | let _ = some_vecdeque.get(0).unwrap();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `&some_vecdeque[0]`
error: called `.get().unwrap()` on a HashMap. Using `[]` is more clear and more concise
--> $DIR/get_unwrap.rs:41:17
--> $DIR/get_unwrap.rs:45:17
|
41 | let _ = some_hashmap.get(&1).unwrap();
45 | let _ = some_hashmap.get(&1).unwrap();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `&some_hashmap[&1]`
error: called `.get().unwrap()` on a BTreeMap. Using `[]` is more clear and more concise
--> $DIR/get_unwrap.rs:42:17
--> $DIR/get_unwrap.rs:46:17
|
42 | let _ = some_btreemap.get(&1).unwrap();
46 | let _ = some_btreemap.get(&1).unwrap();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `&some_btreemap[&1]`
error: called `.get_mut().unwrap()` on a slice. Using `[]` is more clear and more concise
--> $DIR/get_unwrap.rs:47:10
--> $DIR/get_unwrap.rs:52:10
|
47 | *boxed_slice.get_mut(0).unwrap() = 1;
52 | *boxed_slice.get_mut(0).unwrap() = 1;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `&mut boxed_slice[0]`
error: called `.get_mut().unwrap()` on a slice. Using `[]` is more clear and more concise
--> $DIR/get_unwrap.rs:48:10
--> $DIR/get_unwrap.rs:53:10
|
48 | *some_slice.get_mut(0).unwrap() = 1;
53 | *some_slice.get_mut(0).unwrap() = 1;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `&mut some_slice[0]`
error: called `.get_mut().unwrap()` on a Vec. Using `[]` is more clear and more concise
--> $DIR/get_unwrap.rs:49:10
--> $DIR/get_unwrap.rs:54:10
|
49 | *some_vec.get_mut(0).unwrap() = 1;
54 | *some_vec.get_mut(0).unwrap() = 1;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `&mut some_vec[0]`
error: called `.get_mut().unwrap()` on a VecDeque. Using `[]` is more clear and more concise
--> $DIR/get_unwrap.rs:50:10
--> $DIR/get_unwrap.rs:55:10
|
50 | *some_vecdeque.get_mut(0).unwrap() = 1;
55 | *some_vecdeque.get_mut(0).unwrap() = 1;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `&mut some_vecdeque[0]`
error: called `.get().unwrap()` on a Vec. Using `[]` is more clear and more concise
--> $DIR/get_unwrap.rs:58:17
--> $DIR/get_unwrap.rs:64:17
|
58 | let _ = some_vec.get(0..1).unwrap().to_vec();
64 | let _ = some_vec.get(0..1).unwrap().to_vec();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `some_vec[0..1]`
error: called `.get_mut().unwrap()` on a Vec. Using `[]` is more clear and more concise
--> $DIR/get_unwrap.rs:59:17
--> $DIR/get_unwrap.rs:65:17
|
59 | let _ = some_vec.get_mut(0..1).unwrap().to_vec();
65 | let _ = some_vec.get_mut(0..1).unwrap().to_vec();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `some_vec[0..1]`
error: aborting due to 12 previous errors

View file

@ -1,67 +1,67 @@
error: identical conversion
--> $DIR/identity_conversion.rs:16:13
--> $DIR/identity_conversion.rs:13:13
|
16 | let _ = T::from(val);
13 | let _ = T::from(val);
| ^^^^^^^^^^^^ help: consider removing `T::from()`: `val`
|
note: lint level defined here
--> $DIR/identity_conversion.rs:13:9
--> $DIR/identity_conversion.rs:10:9
|
13 | #![deny(clippy::identity_conversion)]
10 | #![deny(clippy::identity_conversion)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: identical conversion
--> $DIR/identity_conversion.rs:17:5
--> $DIR/identity_conversion.rs:14:5
|
17 | val.into()
14 | val.into()
| ^^^^^^^^^^ help: consider removing `.into()`: `val`
error: identical conversion
--> $DIR/identity_conversion.rs:29:22
--> $DIR/identity_conversion.rs:26:22
|
29 | let _: i32 = 0i32.into();
26 | let _: i32 = 0i32.into();
| ^^^^^^^^^^^ help: consider removing `.into()`: `0i32`
error: identical conversion
--> $DIR/identity_conversion.rs:50:21
--> $DIR/identity_conversion.rs:47:21
|
50 | let _: String = "foo".to_string().into();
47 | let _: String = "foo".to_string().into();
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: consider removing `.into()`: `"foo".to_string()`
error: identical conversion
--> $DIR/identity_conversion.rs:51:21
--> $DIR/identity_conversion.rs:48:21
|
51 | let _: String = From::from("foo".to_string());
48 | let _: String = From::from("foo".to_string());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider removing `From::from()`: `"foo".to_string()`
error: identical conversion
--> $DIR/identity_conversion.rs:49:13
|
49 | let _ = String::from("foo".to_string());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider removing `String::from()`: `"foo".to_string()`
error: identical conversion
--> $DIR/identity_conversion.rs:50:13
|
50 | let _ = String::from(format!("A: {:04}", 123));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider removing `String::from()`: `format!("A: {:04}", 123)`
error: identical conversion
--> $DIR/identity_conversion.rs:51:13
|
51 | let _ = "".lines().into_iter();
| ^^^^^^^^^^^^^^^^^^^^^^ help: consider removing `.into_iter()`: `"".lines()`
error: identical conversion
--> $DIR/identity_conversion.rs:52:13
|
52 | let _ = String::from("foo".to_string());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider removing `String::from()`: `"foo".to_string()`
error: identical conversion
--> $DIR/identity_conversion.rs:53:13
|
53 | let _ = String::from(format!("A: {:04}", 123));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider removing `String::from()`: `format!("A: {:04}", 123)`
error: identical conversion
--> $DIR/identity_conversion.rs:54:13
|
54 | let _ = "".lines().into_iter();
| ^^^^^^^^^^^^^^^^^^^^^^ help: consider removing `.into_iter()`: `"".lines()`
error: identical conversion
--> $DIR/identity_conversion.rs:55:13
|
55 | let _ = vec![1, 2, 3].into_iter().into_iter();
52 | let _ = vec![1, 2, 3].into_iter().into_iter();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider removing `.into_iter()`: `vec![1, 2, 3].into_iter()`
error: identical conversion
--> $DIR/identity_conversion.rs:56:21
--> $DIR/identity_conversion.rs:53:21
|
56 | let _: String = format!("Hello {}", "world").into();
53 | let _: String = format!("Hello {}", "world").into();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider removing `.into()`: `format!("Hello {}", "world")`
error: aborting due to 10 previous errors

View file

@ -1,51 +1,51 @@
error: the operation is ineffective. Consider reducing it to `x`
--> $DIR/identity_op.rs:23:5
--> $DIR/identity_op.rs:24:5
|
23 | x + 0;
24 | x + 0;
| ^^^^^
|
= note: `-D clippy::identity-op` implied by `-D warnings`
error: the operation is ineffective. Consider reducing it to `x`
--> $DIR/identity_op.rs:24:5
--> $DIR/identity_op.rs:25:5
|
24 | x + (1 - 1);
25 | x + (1 - 1);
| ^^^^^^^^^^^
error: the operation is ineffective. Consider reducing it to `x`
--> $DIR/identity_op.rs:26:5
--> $DIR/identity_op.rs:27:5
|
26 | 0 + x;
27 | 0 + x;
| ^^^^^
error: the operation is ineffective. Consider reducing it to `x`
--> $DIR/identity_op.rs:29:5
--> $DIR/identity_op.rs:30:5
|
29 | x | (0);
30 | x | (0);
| ^^^^^^^
error: the operation is ineffective. Consider reducing it to `x`
--> $DIR/identity_op.rs:32:5
|
32 | x * 1;
| ^^^^^
error: the operation is ineffective. Consider reducing it to `x`
--> $DIR/identity_op.rs:33:5
|
33 | 1 * x;
33 | x * 1;
| ^^^^^
error: the operation is ineffective. Consider reducing it to `x`
--> $DIR/identity_op.rs:39:5
--> $DIR/identity_op.rs:34:5
|
39 | -1 & x;
34 | 1 * x;
| ^^^^^
error: the operation is ineffective. Consider reducing it to `x`
--> $DIR/identity_op.rs:40:5
|
40 | -1 & x;
| ^^^^^^
error: the operation is ineffective. Consider reducing it to `u`
--> $DIR/identity_op.rs:42:5
--> $DIR/identity_op.rs:43:5
|
42 | u & 255;
43 | u & 255;
| ^^^^^^^
error: aborting due to 8 previous errors

View file

@ -1,24 +1,24 @@
error: Unnecessary boolean `not` operation
--> $DIR/if_not_else.rs:19:5
--> $DIR/if_not_else.rs:18:5
|
19 | / if !bla() {
20 | | println!("Bugs");
21 | | } else {
22 | | println!("Bunny");
23 | | }
18 | / if !bla() {
19 | | println!("Bugs");
20 | | } else {
21 | | println!("Bunny");
22 | | }
| |_____^
|
= note: `-D clippy::if-not-else` implied by `-D warnings`
= help: remove the `!` and swap the blocks of the if/else
error: Unnecessary `!=` operation
--> $DIR/if_not_else.rs:24:5
--> $DIR/if_not_else.rs:23:5
|
24 | / if 4 != 5 {
25 | | println!("Bugs");
26 | | } else {
27 | | println!("Bunny");
28 | | }
23 | / if 4 != 5 {
24 | | println!("Bugs");
25 | | } else {
26 | | println!("Bunny");
27 | | }
| |_____^
|
= help: change to `==` and swap the blocks of the if/else

View file

@ -1,34 +1,34 @@
error: Multiple implementations of this structure
--> $DIR/impl.rs:22:1
--> $DIR/impl.rs:19:1
|
22 | / impl MyStruct {
23 | | fn second() {}
24 | | }
19 | / impl MyStruct {
20 | | fn second() {}
21 | | }
| |_^
|
= note: `-D clippy::multiple-inherent-impl` implied by `-D warnings`
note: First implementation here
--> $DIR/impl.rs:18:1
--> $DIR/impl.rs:15:1
|
18 | / impl MyStruct {
19 | | fn first() {}
20 | | }
15 | / impl MyStruct {
16 | | fn first() {}
17 | | }
| |_^
error: Multiple implementations of this structure
--> $DIR/impl.rs:36:5
--> $DIR/impl.rs:33:5
|
36 | / impl super::MyStruct {
37 | | fn third() {}
38 | | }
33 | / impl super::MyStruct {
34 | | fn third() {}
35 | | }
| |_____^
|
note: First implementation here
--> $DIR/impl.rs:18:1
--> $DIR/impl.rs:15:1
|
18 | / impl MyStruct {
19 | | fn first() {}
20 | | }
15 | / impl MyStruct {
16 | | fn first() {}
17 | | }
| |_^
error: aborting due to 2 previous errors

View file

@ -1,136 +1,136 @@
error: impl for `HashMap` should be generalized over different hashers
--> $DIR/implicit_hasher.rs:21:35
--> $DIR/implicit_hasher.rs:20:35
|
21 | impl<K: Hash + Eq, V> Foo<i8> for HashMap<K, V> {
20 | impl<K: Hash + Eq, V> Foo<i8> for HashMap<K, V> {
| ^^^^^^^^^^^^^
|
= note: `-D clippy::implicit-hasher` implied by `-D warnings`
help: consider adding a type parameter
|
21 | impl<K: Hash + Eq, V, S: ::std::hash::BuildHasher + Default> Foo<i8> for HashMap<K, V, S> {
20 | impl<K: Hash + Eq, V, S: ::std::hash::BuildHasher + Default> Foo<i8> for HashMap<K, V, S> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^
help: ...and use generic constructor
|
27 | (HashMap::default(), HashMap::with_capacity_and_hasher(10, Default::default()))
26 | (HashMap::default(), HashMap::with_capacity_and_hasher(10, Default::default()))
| ^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: impl for `HashMap` should be generalized over different hashers
--> $DIR/implicit_hasher.rs:30:36
--> $DIR/implicit_hasher.rs:29:36
|
30 | impl<K: Hash + Eq, V> Foo<i8> for (HashMap<K, V>,) {
29 | impl<K: Hash + Eq, V> Foo<i8> for (HashMap<K, V>,) {
| ^^^^^^^^^^^^^
help: consider adding a type parameter
|
30 | impl<K: Hash + Eq, V, S: ::std::hash::BuildHasher + Default> Foo<i8> for (HashMap<K, V, S>,) {
29 | impl<K: Hash + Eq, V, S: ::std::hash::BuildHasher + Default> Foo<i8> for (HashMap<K, V, S>,) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^
help: ...and use generic constructor
|
32 | ((HashMap::default(),), (HashMap::with_capacity_and_hasher(10, Default::default()),))
31 | ((HashMap::default(),), (HashMap::with_capacity_and_hasher(10, Default::default()),))
| ^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: impl for `HashMap` should be generalized over different hashers
--> $DIR/implicit_hasher.rs:35:19
--> $DIR/implicit_hasher.rs:34:19
|
35 | impl Foo<i16> for HashMap<String, String> {
34 | impl Foo<i16> for HashMap<String, String> {
| ^^^^^^^^^^^^^^^^^^^^^^^
help: consider adding a type parameter
|
35 | impl<S: ::std::hash::BuildHasher + Default> Foo<i16> for HashMap<String, String, S> {
34 | impl<S: ::std::hash::BuildHasher + Default> Foo<i16> for HashMap<String, String, S> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^
help: ...and use generic constructor
|
37 | (HashMap::default(), HashMap::with_capacity_and_hasher(10, Default::default()))
36 | (HashMap::default(), HashMap::with_capacity_and_hasher(10, Default::default()))
| ^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: impl for `HashSet` should be generalized over different hashers
--> $DIR/implicit_hasher.rs:53:32
--> $DIR/implicit_hasher.rs:51:32
|
53 | impl<T: Hash + Eq> Foo<i8> for HashSet<T> {
51 | impl<T: Hash + Eq> Foo<i8> for HashSet<T> {
| ^^^^^^^^^^
help: consider adding a type parameter
|
53 | impl<T: Hash + Eq, S: ::std::hash::BuildHasher + Default> Foo<i8> for HashSet<T, S> {
51 | impl<T: Hash + Eq, S: ::std::hash::BuildHasher + Default> Foo<i8> for HashSet<T, S> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^
help: ...and use generic constructor
|
55 | (HashSet::default(), HashSet::with_capacity_and_hasher(10, Default::default()))
53 | (HashSet::default(), HashSet::with_capacity_and_hasher(10, Default::default()))
| ^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: impl for `HashSet` should be generalized over different hashers
--> $DIR/implicit_hasher.rs:58:19
--> $DIR/implicit_hasher.rs:56:19
|
58 | impl Foo<i16> for HashSet<String> {
56 | impl Foo<i16> for HashSet<String> {
| ^^^^^^^^^^^^^^^
help: consider adding a type parameter
|
58 | impl<S: ::std::hash::BuildHasher + Default> Foo<i16> for HashSet<String, S> {
56 | impl<S: ::std::hash::BuildHasher + Default> Foo<i16> for HashSet<String, S> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^
help: ...and use generic constructor
|
60 | (HashSet::default(), HashSet::with_capacity_and_hasher(10, Default::default()))
58 | (HashSet::default(), HashSet::with_capacity_and_hasher(10, Default::default()))
| ^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: parameter of type `HashMap` should be generalized over different hashers
--> $DIR/implicit_hasher.rs:75:23
--> $DIR/implicit_hasher.rs:73:23
|
75 | pub fn foo(_map: &mut HashMap<i32, i32>, _set: &mut HashSet<i32>) {
73 | pub fn foo(_map: &mut HashMap<i32, i32>, _set: &mut HashSet<i32>) {}
| ^^^^^^^^^^^^^^^^^
help: consider adding a type parameter
|
75 | pub fn foo<S: ::std::hash::BuildHasher>(_map: &mut HashMap<i32, i32, S>, _set: &mut HashSet<i32>) {
73 | pub fn foo<S: ::std::hash::BuildHasher>(_map: &mut HashMap<i32, i32, S>, _set: &mut HashSet<i32>) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^
error: parameter of type `HashSet` should be generalized over different hashers
--> $DIR/implicit_hasher.rs:75:53
--> $DIR/implicit_hasher.rs:73:53
|
75 | pub fn foo(_map: &mut HashMap<i32, i32>, _set: &mut HashSet<i32>) {
73 | pub fn foo(_map: &mut HashMap<i32, i32>, _set: &mut HashSet<i32>) {}
| ^^^^^^^^^^^^
help: consider adding a type parameter
|
75 | pub fn foo<S: ::std::hash::BuildHasher>(_map: &mut HashMap<i32, i32>, _set: &mut HashSet<i32, S>) {
73 | pub fn foo<S: ::std::hash::BuildHasher>(_map: &mut HashMap<i32, i32>, _set: &mut HashSet<i32, S>) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^
error: impl for `HashMap` should be generalized over different hashers
--> $DIR/implicit_hasher.rs:80:43
--> $DIR/implicit_hasher.rs:77:43
|
80 | impl<K: Hash + Eq, V> Foo<u8> for HashMap<K, V> {
77 | impl<K: Hash + Eq, V> Foo<u8> for HashMap<K, V> {
| ^^^^^^^^^^^^^
...
93 | gen!(impl);
| ----------- in this macro invocation
89 | gen!(impl );
| ------------ in this macro invocation
help: consider adding a type parameter
|
80 | impl<K: Hash + Eq, V, S: ::std::hash::BuildHasher + Default> Foo<u8> for HashMap<K, V, S> {
77 | impl<K: Hash + Eq, V, S: ::std::hash::BuildHasher + Default> Foo<u8> for HashMap<K, V, S> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^
help: ...and use generic constructor
|
82 | (HashMap::default(), HashMap::with_capacity_and_hasher(10, Default::default()))
79 | (HashMap::default(), HashMap::with_capacity_and_hasher(10, Default::default()))
| ^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: parameter of type `HashMap` should be generalized over different hashers
--> $DIR/implicit_hasher.rs:88:33
--> $DIR/implicit_hasher.rs:85:33
|
88 | pub fn $name(_map: &mut HashMap<i32, i32>, _set: &mut HashSet<i32>) {
85 | pub fn $name(_map: &mut HashMap<i32, i32>, _set: &mut HashSet<i32>) {}
| ^^^^^^^^^^^^^^^^^
...
94 | gen!(fn bar);
90 | gen!(fn bar);
| ------------- in this macro invocation
help: consider adding a type parameter
|
88 | pub fn $name<S: ::std::hash::BuildHasher>(_map: &mut HashMap<i32, i32, S>, _set: &mut HashSet<i32>) {
85 | pub fn $name<S: ::std::hash::BuildHasher>(_map: &mut HashMap<i32, i32, S>, _set: &mut HashSet<i32>) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^
error: parameter of type `HashSet` should be generalized over different hashers
--> $DIR/implicit_hasher.rs:88:63
--> $DIR/implicit_hasher.rs:85:63
|
88 | pub fn $name(_map: &mut HashMap<i32, i32>, _set: &mut HashSet<i32>) {
85 | pub fn $name(_map: &mut HashMap<i32, i32>, _set: &mut HashSet<i32>) {}
| ^^^^^^^^^^^^
...
94 | gen!(fn bar);
90 | gen!(fn bar);
| ------------- in this macro invocation
help: consider adding a type parameter
|
88 | pub fn $name<S: ::std::hash::BuildHasher>(_map: &mut HashMap<i32, i32>, _set: &mut HashSet<i32, S>) {
85 | pub fn $name<S: ::std::hash::BuildHasher>(_map: &mut HashMap<i32, i32>, _set: &mut HashSet<i32, S>) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^
error: aborting due to 10 previous errors

View file

@ -1,51 +1,51 @@
error: missing return statement
--> $DIR/implicit_return.rs:21:5
--> $DIR/implicit_return.rs:17:5
|
21 | true
17 | true
| ^^^^ help: add `return` as shown: `return true`
|
= note: `-D clippy::implicit-return` implied by `-D warnings`
error: missing return statement
--> $DIR/implicit_return.rs:27:9
--> $DIR/implicit_return.rs:23:9
|
27 | true
23 | true
| ^^^^ help: add `return` as shown: `return true`
error: missing return statement
--> $DIR/implicit_return.rs:29:9
--> $DIR/implicit_return.rs:25:9
|
29 | false
25 | false
| ^^^^^ help: add `return` as shown: `return false`
error: missing return statement
--> $DIR/implicit_return.rs:36:17
--> $DIR/implicit_return.rs:32:17
|
36 | true => false,
32 | true => false,
| ^^^^^ help: add `return` as shown: `return false`
error: missing return statement
--> $DIR/implicit_return.rs:38:13
--> $DIR/implicit_return.rs:33:18
|
38 | true
| ^^^^ help: add `return` as shown: `return true`
33 | false => true,
| ^^^^ help: add `return` as shown: `return true`
error: missing return statement
--> $DIR/implicit_return.rs:46:9
--> $DIR/implicit_return.rs:40:9
|
46 | break true;
40 | break true;
| ^^^^^^^^^^ help: change `break` to `return` as shown: `return true`
error: missing return statement
--> $DIR/implicit_return.rs:52:9
--> $DIR/implicit_return.rs:45:16
|
52 | true
| ^^^^ help: add `return` as shown: `return true`
45 | let _ = || true;
| ^^^^ help: add `return` as shown: `return true`
error: missing return statement
--> $DIR/implicit_return.rs:54:16
--> $DIR/implicit_return.rs:46:16
|
54 | let _ = || true;
46 | let _ = || true;
| ^^^^ help: add `return` as shown: `return true`
error: aborting due to 8 previous errors

View file

@ -1,33 +1,33 @@
error: digits grouped inconsistently by underscores
--> $DIR/inconsistent_digit_grouping.rs:17:16
--> $DIR/inconsistent_digit_grouping.rs:22:16
|
17 | let bad = (1_23_456, 1_234_5678, 1234_567, 1_234.5678_f32, 1.234_5678_f32);
22 | let bad = (1_23_456, 1_234_5678, 1234_567, 1_234.5678_f32, 1.234_5678_f32);
| ^^^^^^^^ help: consider: `123_456`
|
= note: `-D clippy::inconsistent-digit-grouping` implied by `-D warnings`
error: digits grouped inconsistently by underscores
--> $DIR/inconsistent_digit_grouping.rs:17:26
--> $DIR/inconsistent_digit_grouping.rs:22:26
|
17 | let bad = (1_23_456, 1_234_5678, 1234_567, 1_234.5678_f32, 1.234_5678_f32);
22 | let bad = (1_23_456, 1_234_5678, 1234_567, 1_234.5678_f32, 1.234_5678_f32);
| ^^^^^^^^^^ help: consider: `12_345_678`
error: digits grouped inconsistently by underscores
--> $DIR/inconsistent_digit_grouping.rs:17:38
--> $DIR/inconsistent_digit_grouping.rs:22:38
|
17 | let bad = (1_23_456, 1_234_5678, 1234_567, 1_234.5678_f32, 1.234_5678_f32);
22 | let bad = (1_23_456, 1_234_5678, 1234_567, 1_234.5678_f32, 1.234_5678_f32);
| ^^^^^^^^ help: consider: `1_234_567`
error: digits grouped inconsistently by underscores
--> $DIR/inconsistent_digit_grouping.rs:17:48
--> $DIR/inconsistent_digit_grouping.rs:22:48
|
17 | let bad = (1_23_456, 1_234_5678, 1234_567, 1_234.5678_f32, 1.234_5678_f32);
22 | let bad = (1_23_456, 1_234_5678, 1234_567, 1_234.5678_f32, 1.234_5678_f32);
| ^^^^^^^^^^^^^^ help: consider: `1_234.567_8_f32`
error: digits grouped inconsistently by underscores
--> $DIR/inconsistent_digit_grouping.rs:17:64
--> $DIR/inconsistent_digit_grouping.rs:22:64
|
17 | let bad = (1_23_456, 1_234_5678, 1234_567, 1_234.5678_f32, 1.234_5678_f32);
22 | let bad = (1_23_456, 1_234_5678, 1234_567, 1_234.5678_f32, 1.234_5678_f32);
| ^^^^^^^^^^^^^^ help: consider: `1.234_567_8_f32`
error: aborting due to 5 previous errors

View file

@ -1,308 +1,308 @@
error: index out of bounds: the len is 4 but the index is 4
--> $DIR/indexing_slicing.rs:28:5
--> $DIR/indexing_slicing.rs:25:5
|
28 | x[4]; // Ok, let rustc's `const_err` lint handle `usize` indexing on arrays.
25 | x[4]; // Ok, let rustc's `const_err` lint handle `usize` indexing on arrays.
| ^^^^
|
= note: #[deny(const_err)] on by default
error: index out of bounds: the len is 4 but the index is 8
--> $DIR/indexing_slicing.rs:29:5
--> $DIR/indexing_slicing.rs:26:5
|
29 | x[1 << 3]; // Ok, let rustc's `const_err` lint handle `usize` indexing on arrays.
26 | x[1 << 3]; // Ok, let rustc's `const_err` lint handle `usize` indexing on arrays.
| ^^^^^^^^^
error: index out of bounds: the len is 0 but the index is 0
--> $DIR/indexing_slicing.rs:59:5
--> $DIR/indexing_slicing.rs:56:5
|
59 | empty[0]; // Ok, let rustc's `const_err` lint handle `usize` indexing on arrays.
56 | empty[0]; // Ok, let rustc's `const_err` lint handle `usize` indexing on arrays.
| ^^^^^^^^
error: index out of bounds: the len is 4 but the index is 15
--> $DIR/indexing_slicing.rs:90:5
--> $DIR/indexing_slicing.rs:87:5
|
90 | x[N]; // Ok, let rustc's `const_err` lint handle `usize` indexing on arrays.
87 | x[N]; // Ok, let rustc's `const_err` lint handle `usize` indexing on arrays.
| ^^^^
error: indexing may panic.
--> $DIR/indexing_slicing.rs:23:5
--> $DIR/indexing_slicing.rs:20:5
|
23 | x[index];
20 | x[index];
| ^^^^^^^^
|
= note: `-D clippy::indexing-slicing` implied by `-D warnings`
= help: Consider using `.get(n)` or `.get_mut(n)` instead
error: slicing may panic.
--> $DIR/indexing_slicing.rs:24:6
--> $DIR/indexing_slicing.rs:21:6
|
24 | &x[index..];
21 | &x[index..];
| ^^^^^^^^^^
|
= help: Consider using `.get(n..)` or .get_mut(n..)` instead
error: slicing may panic.
--> $DIR/indexing_slicing.rs:25:6
--> $DIR/indexing_slicing.rs:22:6
|
25 | &x[..index];
22 | &x[..index];
| ^^^^^^^^^^
|
= help: Consider using `.get(..n)`or `.get_mut(..n)` instead
error: slicing may panic.
--> $DIR/indexing_slicing.rs:26:6
--> $DIR/indexing_slicing.rs:23:6
|
26 | &x[index_from..index_to];
23 | &x[index_from..index_to];
| ^^^^^^^^^^^^^^^^^^^^^^^
|
= help: Consider using `.get(n..m)` or `.get_mut(n..m)` instead
error: slicing may panic.
--> $DIR/indexing_slicing.rs:27:6
--> $DIR/indexing_slicing.rs:24:6
|
27 | &x[index_from..][..index_to]; // Two lint reports, one for [index_from..] and another for [..index_to].
24 | &x[index_from..][..index_to]; // Two lint reports, one for [index_from..] and another for [..index_to].
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: Consider using `.get(..n)`or `.get_mut(..n)` instead
error: slicing may panic.
--> $DIR/indexing_slicing.rs:27:6
--> $DIR/indexing_slicing.rs:24:6
|
27 | &x[index_from..][..index_to]; // Two lint reports, one for [index_from..] and another for [..index_to].
24 | &x[index_from..][..index_to]; // Two lint reports, one for [index_from..] and another for [..index_to].
| ^^^^^^^^^^^^^^^
|
= help: Consider using `.get(n..)` or .get_mut(n..)` instead
error: range is out of bounds
--> $DIR/indexing_slicing.rs:30:11
--> $DIR/indexing_slicing.rs:27:11
|
30 | &x[..=4];
27 | &x[..=4];
| ^
|
= note: `-D clippy::out-of-bounds-indexing` implied by `-D warnings`
error: range is out of bounds
--> $DIR/indexing_slicing.rs:31:11
--> $DIR/indexing_slicing.rs:28:11
|
31 | &x[1..5];
28 | &x[1..5];
| ^
error: slicing may panic.
--> $DIR/indexing_slicing.rs:32:6
--> $DIR/indexing_slicing.rs:29:6
|
32 | &x[5..][..10]; // Two lint reports, one for [5..] and another for [..10].
29 | &x[5..][..10]; // Two lint reports, one for [5..] and another for [..10].
| ^^^^^^^^^^^^
|
= help: Consider using `.get(..n)`or `.get_mut(..n)` instead
error: range is out of bounds
--> $DIR/indexing_slicing.rs:32:8
--> $DIR/indexing_slicing.rs:29:8
|
32 | &x[5..][..10]; // Two lint reports, one for [5..] and another for [..10].
29 | &x[5..][..10]; // Two lint reports, one for [5..] and another for [..10].
| ^
error: range is out of bounds
--> $DIR/indexing_slicing.rs:33:8
--> $DIR/indexing_slicing.rs:30:8
|
33 | &x[5..];
30 | &x[5..];
| ^
error: range is out of bounds
--> $DIR/indexing_slicing.rs:34:10
--> $DIR/indexing_slicing.rs:31:10
|
34 | &x[..5];
31 | &x[..5];
| ^
error: range is out of bounds
--> $DIR/indexing_slicing.rs:35:8
--> $DIR/indexing_slicing.rs:32:8
|
35 | &x[5..].iter().map(|x| 2 * x).collect::<Vec<i32>>();
32 | &x[5..].iter().map(|x| 2 * x).collect::<Vec<i32>>();
| ^
error: range is out of bounds
--> $DIR/indexing_slicing.rs:36:12
--> $DIR/indexing_slicing.rs:33:12
|
36 | &x[0..=4];
33 | &x[0..=4];
| ^
error: slicing may panic.
--> $DIR/indexing_slicing.rs:37:6
--> $DIR/indexing_slicing.rs:34:6
|
37 | &x[0..][..3];
34 | &x[0..][..3];
| ^^^^^^^^^^^
|
= help: Consider using `.get(..n)`or `.get_mut(..n)` instead
error: slicing may panic.
--> $DIR/indexing_slicing.rs:38:6
--> $DIR/indexing_slicing.rs:35:6
|
38 | &x[1..][..5];
35 | &x[1..][..5];
| ^^^^^^^^^^^
|
= help: Consider using `.get(..n)`or `.get_mut(..n)` instead
error: indexing may panic.
--> $DIR/indexing_slicing.rs:51:5
--> $DIR/indexing_slicing.rs:48:5
|
51 | y[0];
48 | y[0];
| ^^^^
|
= help: Consider using `.get(n)` or `.get_mut(n)` instead
error: slicing may panic.
--> $DIR/indexing_slicing.rs:52:6
--> $DIR/indexing_slicing.rs:49:6
|
52 | &y[1..2];
49 | &y[1..2];
| ^^^^^^^
|
= help: Consider using `.get(n..m)` or `.get_mut(n..m)` instead
error: slicing may panic.
--> $DIR/indexing_slicing.rs:53:6
--> $DIR/indexing_slicing.rs:50:6
|
53 | &y[0..=4];
50 | &y[0..=4];
| ^^^^^^^^
|
= help: Consider using `.get(n..m)` or `.get_mut(n..m)` instead
error: slicing may panic.
--> $DIR/indexing_slicing.rs:54:6
--> $DIR/indexing_slicing.rs:51:6
|
54 | &y[..=4];
51 | &y[..=4];
| ^^^^^^^
|
= help: Consider using `.get(..n)`or `.get_mut(..n)` instead
error: range is out of bounds
--> $DIR/indexing_slicing.rs:60:12
--> $DIR/indexing_slicing.rs:57:12
|
60 | &empty[1..5];
57 | &empty[1..5];
| ^
error: range is out of bounds
--> $DIR/indexing_slicing.rs:61:16
--> $DIR/indexing_slicing.rs:58:16
|
61 | &empty[0..=4];
58 | &empty[0..=4];
| ^
error: range is out of bounds
--> $DIR/indexing_slicing.rs:62:15
--> $DIR/indexing_slicing.rs:59:15
|
62 | &empty[..=4];
59 | &empty[..=4];
| ^
error: range is out of bounds
--> $DIR/indexing_slicing.rs:63:12
--> $DIR/indexing_slicing.rs:60:12
|
63 | &empty[1..];
60 | &empty[1..];
| ^
error: range is out of bounds
--> $DIR/indexing_slicing.rs:64:14
--> $DIR/indexing_slicing.rs:61:14
|
64 | &empty[..4];
61 | &empty[..4];
| ^
error: range is out of bounds
--> $DIR/indexing_slicing.rs:65:16
--> $DIR/indexing_slicing.rs:62:16
|
65 | &empty[0..=0];
62 | &empty[0..=0];
| ^
error: range is out of bounds
--> $DIR/indexing_slicing.rs:66:15
--> $DIR/indexing_slicing.rs:63:15
|
66 | &empty[..=0];
63 | &empty[..=0];
| ^
error: indexing may panic.
--> $DIR/indexing_slicing.rs:74:5
--> $DIR/indexing_slicing.rs:71:5
|
74 | v[0];
71 | v[0];
| ^^^^
|
= help: Consider using `.get(n)` or `.get_mut(n)` instead
error: indexing may panic.
--> $DIR/indexing_slicing.rs:75:5
--> $DIR/indexing_slicing.rs:72:5
|
75 | v[10];
72 | v[10];
| ^^^^^
|
= help: Consider using `.get(n)` or `.get_mut(n)` instead
error: indexing may panic.
--> $DIR/indexing_slicing.rs:76:5
--> $DIR/indexing_slicing.rs:73:5
|
76 | v[1 << 3];
73 | v[1 << 3];
| ^^^^^^^^^
|
= help: Consider using `.get(n)` or `.get_mut(n)` instead
error: slicing may panic.
--> $DIR/indexing_slicing.rs:77:6
--> $DIR/indexing_slicing.rs:74:6
|
77 | &v[10..100];
74 | &v[10..100];
| ^^^^^^^^^^
|
= help: Consider using `.get(n..m)` or `.get_mut(n..m)` instead
error: slicing may panic.
--> $DIR/indexing_slicing.rs:78:6
--> $DIR/indexing_slicing.rs:75:6
|
78 | &x[10..][..100]; // Two lint reports, one for [10..] and another for [..100].
75 | &x[10..][..100]; // Two lint reports, one for [10..] and another for [..100].
| ^^^^^^^^^^^^^^
|
= help: Consider using `.get(..n)`or `.get_mut(..n)` instead
error: range is out of bounds
--> $DIR/indexing_slicing.rs:78:8
--> $DIR/indexing_slicing.rs:75:8
|
78 | &x[10..][..100]; // Two lint reports, one for [10..] and another for [..100].
75 | &x[10..][..100]; // Two lint reports, one for [10..] and another for [..100].
| ^^
error: slicing may panic.
--> $DIR/indexing_slicing.rs:79:6
--> $DIR/indexing_slicing.rs:76:6
|
79 | &v[10..];
76 | &v[10..];
| ^^^^^^^
|
= help: Consider using `.get(n..)` or .get_mut(n..)` instead
error: slicing may panic.
--> $DIR/indexing_slicing.rs:80:6
--> $DIR/indexing_slicing.rs:77:6
|
80 | &v[..100];
77 | &v[..100];
| ^^^^^^^^
|
= help: Consider using `.get(..n)`or `.get_mut(..n)` instead
error: indexing may panic.
--> $DIR/indexing_slicing.rs:92:5
--> $DIR/indexing_slicing.rs:89:5
|
92 | v[N];
89 | v[N];
| ^^^^
|
= help: Consider using `.get(n)` or `.get_mut(n)` instead
error: indexing may panic.
--> $DIR/indexing_slicing.rs:93:5
--> $DIR/indexing_slicing.rs:90:5
|
93 | v[M];
90 | v[M];
| ^^^^
|
= help: Consider using `.get(n)` or `.get_mut(n)` instead
error: range is out of bounds
--> $DIR/indexing_slicing.rs:97:13
--> $DIR/indexing_slicing.rs:94:13
|
97 | &x[num..10]; // should trigger out of bounds error
94 | &x[num..10]; // should trigger out of bounds error
| ^^
error: range is out of bounds
--> $DIR/indexing_slicing.rs:98:8
--> $DIR/indexing_slicing.rs:95:8
|
98 | &x[10..num]; // should trigger out of bounds error
95 | &x[10..num]; // should trigger out of bounds error
| ^^
error: aborting due to 43 previous errors

View file

@ -1,27 +1,27 @@
error: you seem to be trying to use match to destructure a single infallible pattern. Consider using `let`
--> $DIR/infallible_destructuring_match.rs:28:5
--> $DIR/infallible_destructuring_match.rs:25:5
|
28 | / let data = match wrapper {
29 | | SingleVariantEnum::Variant(i) => i,
30 | | };
25 | / let data = match wrapper {
26 | | SingleVariantEnum::Variant(i) => i,
27 | | };
| |______^ help: try this: `let SingleVariantEnum::Variant(data) = wrapper;`
|
= note: `-D clippy::infallible-destructuring-match` implied by `-D warnings`
error: you seem to be trying to use match to destructure a single infallible pattern. Consider using `let`
--> $DIR/infallible_destructuring_match.rs:49:5
--> $DIR/infallible_destructuring_match.rs:46:5
|
49 | / let data = match wrapper {
50 | | TupleStruct(i) => i,
51 | | };
46 | / let data = match wrapper {
47 | | TupleStruct(i) => i,
48 | | };
| |______^ help: try this: `let TupleStruct(data) = wrapper;`
error: you seem to be trying to use match to destructure a single infallible pattern. Consider using `let`
--> $DIR/infallible_destructuring_match.rs:70:5
--> $DIR/infallible_destructuring_match.rs:67:5
|
70 | / let data = match wrapper {
71 | | Ok(i) => i,
72 | | };
67 | / let data = match wrapper {
68 | | Ok(i) => i,
69 | | };
| |______^ help: try this: `let Ok(data) = wrapper;`
error: aborting due to 3 previous errors

View file

@ -1,99 +1,108 @@
error: you are collect()ing an iterator and throwing away the result. Consider using an explicit for loop to exhaust the iterator
--> $DIR/infinite_iter.rs:20:5
--> $DIR/infinite_iter.rs:19:5
|
20 | repeat(0_u8).collect::<Vec<_>>(); // infinite iter
19 | repeat(0_u8).collect::<Vec<_>>(); // infinite iter
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: `-D clippy::unused-collect` implied by `-D warnings`
error: infinite iteration detected
--> $DIR/infinite_iter.rs:20:5
--> $DIR/infinite_iter.rs:19:5
|
20 | repeat(0_u8).collect::<Vec<_>>(); // infinite iter
19 | repeat(0_u8).collect::<Vec<_>>(); // infinite iter
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
note: lint level defined here
--> $DIR/infinite_iter.rs:18:8
--> $DIR/infinite_iter.rs:17:8
|
18 | #[deny(clippy::infinite_iter)]
17 | #[deny(clippy::infinite_iter)]
| ^^^^^^^^^^^^^^^^^^^^^
error: infinite iteration detected
--> $DIR/infinite_iter.rs:20:5
|
20 | (0..8_u32).take_while(square_is_lower_64).cycle().count(); // infinite iter
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: infinite iteration detected
--> $DIR/infinite_iter.rs:21:5
|
21 | (0..8_u32).take_while(square_is_lower_64).cycle().count(); // infinite iter
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: infinite iteration detected
--> $DIR/infinite_iter.rs:22:5
|
22 | (0..8_u64).chain(0..).max(); // infinite iter
21 | (0..8_u64).chain(0..).max(); // infinite iter
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: infinite iteration detected
--> $DIR/infinite_iter.rs:24:5
|
24 | (0..8_u32).rev().cycle().map(|x| x + 1_u32).for_each(|x| println!("{}", x)); // infinite iter
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: infinite iteration detected
--> $DIR/infinite_iter.rs:26:5
|
26 | (0_usize..).flat_map(|x| 0..x).product::<usize>(); // infinite iter
26 | / (0..8_u32)
27 | | .rev()
28 | | .cycle()
29 | | .map(|x| x + 1_u32)
30 | | .for_each(|x| println!("{}", x)); // infinite iter
| |________________________________________^
error: infinite iteration detected
--> $DIR/infinite_iter.rs:32:5
|
32 | (0_usize..).flat_map(|x| 0..x).product::<usize>(); // infinite iter
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: infinite iteration detected
--> $DIR/infinite_iter.rs:27:5
--> $DIR/infinite_iter.rs:33:5
|
27 | (0_u64..).filter(|x| x % 2 == 0).last(); // infinite iter
33 | (0_u64..).filter(|x| x % 2 == 0).last(); // infinite iter
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: possible infinite iteration detected
--> $DIR/infinite_iter.rs:34:5
|
34 | (0..).zip((0..).take_while(square_is_lower_64)).count(); // maybe infinite iter
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
note: lint level defined here
--> $DIR/infinite_iter.rs:32:8
|
32 | #[deny(clippy::maybe_infinite_iter)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: possible infinite iteration detected
--> $DIR/infinite_iter.rs:35:5
|
35 | repeat(42).take_while(|x| *x == 42).chain(0..42).max(); // maybe infinite iter
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: possible infinite iteration detected
--> $DIR/infinite_iter.rs:36:5
|
36 | (1..).scan(0, |state, x| { *state += x; Some(*state) }).min(); // maybe infinite iter
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: possible infinite iteration detected
--> $DIR/infinite_iter.rs:37:5
|
37 | (0..).find(|x| *x == 24); // maybe infinite iter
| ^^^^^^^^^^^^^^^^^^^^^^^^
error: possible infinite iteration detected
--> $DIR/infinite_iter.rs:38:5
|
38 | (0..).position(|x| x == 24); // maybe infinite iter
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: possible infinite iteration detected
--> $DIR/infinite_iter.rs:39:5
|
39 | (0..).any(|x| x == 24); // maybe infinite iter
| ^^^^^^^^^^^^^^^^^^^^^^
error: possible infinite iteration detected
--> $DIR/infinite_iter.rs:40:5
|
40 | (0..).all(|x| x == 24); // maybe infinite iter
40 | (0..).zip((0..).take_while(square_is_lower_64)).count(); // maybe infinite iter
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
note: lint level defined here
--> $DIR/infinite_iter.rs:38:8
|
38 | #[deny(clippy::maybe_infinite_iter)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: possible infinite iteration detected
--> $DIR/infinite_iter.rs:41:5
|
41 | repeat(42).take_while(|x| *x == 42).chain(0..42).max(); // maybe infinite iter
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: possible infinite iteration detected
--> $DIR/infinite_iter.rs:42:5
|
42 | / (1..)
43 | | .scan(0, |state, x| {
44 | | *state += x;
45 | | Some(*state)
46 | | })
47 | | .min(); // maybe infinite iter
| |______________^
error: possible infinite iteration detected
--> $DIR/infinite_iter.rs:48:5
|
48 | (0..).find(|x| *x == 24); // maybe infinite iter
| ^^^^^^^^^^^^^^^^^^^^^^^^
error: possible infinite iteration detected
--> $DIR/infinite_iter.rs:49:5
|
49 | (0..).position(|x| x == 24); // maybe infinite iter
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: possible infinite iteration detected
--> $DIR/infinite_iter.rs:50:5
|
50 | (0..).any(|x| x == 24); // maybe infinite iter
| ^^^^^^^^^^^^^^^^^^^^^^
error: possible infinite iteration detected
--> $DIR/infinite_iter.rs:51:5
|
51 | (0..).all(|x| x == 24); // maybe infinite iter
| ^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to 14 previous errors

View file

@ -1,57 +1,57 @@
error: Variable in the condition are not mutated in the loop body. This either leads to an infinite or to a never running loop.
--> $DIR/infinite_loop.rs:26:11
--> $DIR/infinite_loop.rs:32:11
|
26 | while y < 10 {
32 | while y < 10 {
| ^^^^^^
|
= note: #[deny(clippy::while_immutable_condition)] on by default
error: Variable in the condition are not mutated in the loop body. This either leads to an infinite or to a never running loop.
--> $DIR/infinite_loop.rs:31:11
--> $DIR/infinite_loop.rs:37:11
|
31 | while y < 10 && x < 3 {
37 | while y < 10 && x < 3 {
| ^^^^^^^^^^^^^^^
error: Variable in the condition are not mutated in the loop body. This either leads to an infinite or to a never running loop.
--> $DIR/infinite_loop.rs:38:11
--> $DIR/infinite_loop.rs:44:11
|
38 | while !cond {
44 | while !cond {
| ^^^^^
error: Variable in the condition are not mutated in the loop body. This either leads to an infinite or to a never running loop.
--> $DIR/infinite_loop.rs:82:11
--> $DIR/infinite_loop.rs:88:11
|
82 | while i < 3 {
88 | while i < 3 {
| ^^^^^
error: Variable in the condition are not mutated in the loop body. This either leads to an infinite or to a never running loop.
--> $DIR/infinite_loop.rs:87:11
--> $DIR/infinite_loop.rs:93:11
|
87 | while i < 3 && j > 0 {
93 | while i < 3 && j > 0 {
| ^^^^^^^^^^^^^^
error: Variable in the condition are not mutated in the loop body. This either leads to an infinite or to a never running loop.
--> $DIR/infinite_loop.rs:91:11
--> $DIR/infinite_loop.rs:97:11
|
91 | while i < 3 {
97 | while i < 3 {
| ^^^^^
error: Variable in the condition are not mutated in the loop body. This either leads to an infinite or to a never running loop.
--> $DIR/infinite_loop.rs:106:11
--> $DIR/infinite_loop.rs:112:11
|
106 | while i < 3 {
112 | while i < 3 {
| ^^^^^
error: Variable in the condition are not mutated in the loop body. This either leads to an infinite or to a never running loop.
--> $DIR/infinite_loop.rs:111:11
--> $DIR/infinite_loop.rs:117:11
|
111 | while i < 3 {
117 | while i < 3 {
| ^^^^^
error: Variable in the condition are not mutated in the loop body. This either leads to an infinite or to a never running loop.
--> $DIR/infinite_loop.rs:174:15
--> $DIR/infinite_loop.rs:183:15
|
174 | while self.count < n {
183 | while self.count < n {
| ^^^^^^^^^^^^^^
error: aborting due to 9 previous errors

View file

@ -1,25 +1,27 @@
error: use of `#[inline]` on trait method `default_inline` which has no body
--> $DIR/inline_fn_without_body.rs:18:5
--> $DIR/inline_fn_without_body.rs:14:5
|
18 | #[inline]
14 | #[inline]
| _____-^^^^^^^^
19 | | fn default_inline();
15 | | fn default_inline();
| |____- help: remove
|
= note: `-D clippy::inline-fn-without-body` implied by `-D warnings`
error: use of `#[inline]` on trait method `always_inline` which has no body
--> $DIR/inline_fn_without_body.rs:21:5
--> $DIR/inline_fn_without_body.rs:17:5
|
21 | #[inline(always)]fn always_inline();
| ^^^^^^^^^^^^^^^^^ help: remove
17 | #[inline(always)]
| _____-^^^^^^^^^^^^^^^^
18 | | fn always_inline();
| |____- help: remove
error: use of `#[inline]` on trait method `never_inline` which has no body
--> $DIR/inline_fn_without_body.rs:23:5
--> $DIR/inline_fn_without_body.rs:20:5
|
23 | #[inline(never)]
20 | #[inline(never)]
| _____-^^^^^^^^^^^^^^^
24 | | fn never_inline();
21 | | fn never_inline();
| |____- help: remove
error: aborting due to 3 previous errors

View file

@ -1,43 +1,43 @@
error: Unnecessary `>= y + 1` or `x - 1 >=`
--> $DIR/int_plus_one.rs:20:5
--> $DIR/int_plus_one.rs:16:5
|
20 | x >= y + 1;
16 | x >= y + 1;
| ^^^^^^^^^^
|
= note: `-D clippy::int-plus-one` implied by `-D warnings`
help: change `>= y + 1` to `> y` as shown
|
20 | x > y;
16 | x > y;
| ^^^^^
error: Unnecessary `>= y + 1` or `x - 1 >=`
--> $DIR/int_plus_one.rs:21:5
--> $DIR/int_plus_one.rs:17:5
|
21 | y + 1 <= x;
17 | y + 1 <= x;
| ^^^^^^^^^^
help: change `>= y + 1` to `> y` as shown
|
21 | y < x;
17 | y < x;
| ^^^^^
error: Unnecessary `>= y + 1` or `x - 1 >=`
--> $DIR/int_plus_one.rs:23:5
--> $DIR/int_plus_one.rs:19:5
|
23 | x - 1 >= y;
19 | x - 1 >= y;
| ^^^^^^^^^^
help: change `>= y + 1` to `> y` as shown
|
23 | x > y;
19 | x > y;
| ^^^^^
error: Unnecessary `>= y + 1` or `x - 1 >=`
--> $DIR/int_plus_one.rs:24:5
--> $DIR/int_plus_one.rs:20:5
|
24 | y <= x - 1;
20 | y <= x - 1;
| ^^^^^^^^^^
help: change `>= y + 1` to `> y` as shown
|
24 | y < x;
20 | y < x;
| ^^^^^
error: aborting due to 4 previous errors

View file

@ -1,8 +1,8 @@
error: this .into_iter() call is equivalent to .iter() and will not move the array
--> $DIR/into_iter_on_ref.rs:11:22
--> $DIR/into_iter_on_ref.rs:11:24
|
11 | for _ in [1,2,3].into_iter() {} //~ ERROR equivalent to .iter()
| ^^^^^^^^^ help: call directly: `iter`
11 | for _ in [1, 2, 3].into_iter() {} //~ ERROR equivalent to .iter()
| ^^^^^^^^^ help: call directly: `iter`
|
note: lint level defined here
--> $DIR/into_iter_on_ref.rs:2:9
@ -11,24 +11,24 @@ note: lint level defined here
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
error: this .into_iter() call is equivalent to .iter() and will not move the array
--> $DIR/into_iter_on_ref.rs:13:21
--> $DIR/into_iter_on_ref.rs:13:23
|
13 | let _ = [1,2,3].into_iter(); //~ ERROR equivalent to .iter()
| ^^^^^^^^^ help: call directly: `iter`
13 | let _ = [1, 2, 3].into_iter(); //~ ERROR equivalent to .iter()
| ^^^^^^^^^ help: call directly: `iter`
error: this .into_iter() call is equivalent to .iter() and will not move the Vec
--> $DIR/into_iter_on_ref.rs:15:28
--> $DIR/into_iter_on_ref.rs:15:30
|
15 | let _ = (&vec![1,2,3]).into_iter(); //~ WARN equivalent to .iter()
| ^^^^^^^^^ help: call directly: `iter`
15 | let _ = (&vec![1, 2, 3]).into_iter(); //~ WARN equivalent to .iter()
| ^^^^^^^^^ help: call directly: `iter`
|
= note: `-D clippy::into-iter-on-ref` implied by `-D warnings`
error: this .into_iter() call is equivalent to .iter() and will not move the slice
--> $DIR/into_iter_on_ref.rs:16:44
--> $DIR/into_iter_on_ref.rs:16:46
|
16 | let _ = vec![1,2,3].into_boxed_slice().into_iter(); //~ WARN equivalent to .iter()
| ^^^^^^^^^ help: call directly: `iter`
16 | let _ = vec![1, 2, 3].into_boxed_slice().into_iter(); //~ WARN equivalent to .iter()
| ^^^^^^^^^ help: call directly: `iter`
error: this .into_iter() call is equivalent to .iter() and will not move the slice
--> $DIR/into_iter_on_ref.rs:17:41
@ -43,22 +43,22 @@ error: this .into_iter() call is equivalent to .iter() and will not move the sli
| ^^^^^^^^^ help: call directly: `iter`
error: this .into_iter() call is equivalent to .iter() and will not move the array
--> $DIR/into_iter_on_ref.rs:20:30
--> $DIR/into_iter_on_ref.rs:20:32
|
20 | let _ = (&&&&&&&[1,2,3]).into_iter(); //~ ERROR equivalent to .iter()
| ^^^^^^^^^ help: call directly: `iter`
20 | let _ = (&&&&&&&[1, 2, 3]).into_iter(); //~ ERROR equivalent to .iter()
| ^^^^^^^^^ help: call directly: `iter`
error: this .into_iter() call is equivalent to .iter() and will not move the array
--> $DIR/into_iter_on_ref.rs:21:34
--> $DIR/into_iter_on_ref.rs:21:36
|
21 | let _ = (&&&&mut &&&[1,2,3]).into_iter(); //~ ERROR equivalent to .iter()
| ^^^^^^^^^ help: call directly: `iter`
21 | let _ = (&&&&mut &&&[1, 2, 3]).into_iter(); //~ ERROR equivalent to .iter()
| ^^^^^^^^^ help: call directly: `iter`
error: this .into_iter() call is equivalent to .iter_mut() and will not move the array
--> $DIR/into_iter_on_ref.rs:22:38
--> $DIR/into_iter_on_ref.rs:22:40
|
22 | let _ = (&mut &mut &mut [1,2,3]).into_iter(); //~ ERROR equivalent to .iter_mut()
| ^^^^^^^^^ help: call directly: `iter_mut`
22 | let _ = (&mut &mut &mut [1, 2, 3]).into_iter(); //~ ERROR equivalent to .iter_mut()
| ^^^^^^^^^ help: call directly: `iter_mut`
error: this .into_iter() call is equivalent to .iter() and will not move the Option
--> $DIR/into_iter_on_ref.rs:24:24

View file

@ -1,48 +1,48 @@
error: reference to zeroed memory
--> $DIR/invalid_ref.rs:37:24
--> $DIR/invalid_ref.rs:33:24
|
37 | let ref_zero: &T = std::mem::zeroed(); // warning
33 | let ref_zero: &T = std::mem::zeroed(); // warning
| ^^^^^^^^^^^^^^^^^^
|
= note: #[deny(clippy::invalid_ref)] on by default
= help: Creation of a null reference is undefined behavior; see https://doc.rust-lang.org/reference/behavior-considered-undefined.html
error: reference to zeroed memory
--> $DIR/invalid_ref.rs:41:24
--> $DIR/invalid_ref.rs:37:24
|
41 | let ref_zero: &T = core::mem::zeroed(); // warning
37 | let ref_zero: &T = core::mem::zeroed(); // warning
| ^^^^^^^^^^^^^^^^^^^
|
= help: Creation of a null reference is undefined behavior; see https://doc.rust-lang.org/reference/behavior-considered-undefined.html
error: reference to zeroed memory
--> $DIR/invalid_ref.rs:45:24
--> $DIR/invalid_ref.rs:41:24
|
45 | let ref_zero: &T = std::intrinsics::init(); // warning
41 | let ref_zero: &T = std::intrinsics::init(); // warning
| ^^^^^^^^^^^^^^^^^^^^^^^
|
= help: Creation of a null reference is undefined behavior; see https://doc.rust-lang.org/reference/behavior-considered-undefined.html
error: reference to uninitialized memory
--> $DIR/invalid_ref.rs:45:26
|
45 | let ref_uninit: &T = std::mem::uninitialized(); // warning
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: Creation of a null reference is undefined behavior; see https://doc.rust-lang.org/reference/behavior-considered-undefined.html
error: reference to uninitialized memory
--> $DIR/invalid_ref.rs:49:26
|
49 | let ref_uninit: &T = std::mem::uninitialized(); // warning
| ^^^^^^^^^^^^^^^^^^^^^^^^^
49 | let ref_uninit: &T = core::mem::uninitialized(); // warning
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: Creation of a null reference is undefined behavior; see https://doc.rust-lang.org/reference/behavior-considered-undefined.html
error: reference to uninitialized memory
--> $DIR/invalid_ref.rs:53:26
|
53 | let ref_uninit: &T = core::mem::uninitialized(); // warning
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: Creation of a null reference is undefined behavior; see https://doc.rust-lang.org/reference/behavior-considered-undefined.html
error: reference to uninitialized memory
--> $DIR/invalid_ref.rs:57:26
|
57 | let ref_uninit: &T = std::intrinsics::uninit(); // warning
53 | let ref_uninit: &T = std::intrinsics::uninit(); // warning
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: Creation of a null reference is undefined behavior; see https://doc.rust-lang.org/reference/behavior-considered-undefined.html

View file

@ -1,165 +1,165 @@
error: because of the numeric bounds on `u8` prior to casting, this expression is always false
--> $DIR/invalid_upcast_comparisons.rs:26:5
--> $DIR/invalid_upcast_comparisons.rs:30:5
|
26 | (u8 as u32) > 300;
30 | (u8 as u32) > 300;
| ^^^^^^^^^^^^^^^^^
|
= note: `-D clippy::invalid-upcast-comparisons` implied by `-D warnings`
error: because of the numeric bounds on `u8` prior to casting, this expression is always false
--> $DIR/invalid_upcast_comparisons.rs:27:5
|
27 | (u8 as i32) > 300;
| ^^^^^^^^^^^^^^^^^
error: because of the numeric bounds on `u8` prior to casting, this expression is always false
--> $DIR/invalid_upcast_comparisons.rs:28:5
|
28 | (u8 as u32) == 300;
| ^^^^^^^^^^^^^^^^^^
error: because of the numeric bounds on `u8` prior to casting, this expression is always false
--> $DIR/invalid_upcast_comparisons.rs:29:5
|
29 | (u8 as i32) == 300;
| ^^^^^^^^^^^^^^^^^^
error: because of the numeric bounds on `u8` prior to casting, this expression is always false
--> $DIR/invalid_upcast_comparisons.rs:30:5
|
30 | 300 < (u8 as u32);
| ^^^^^^^^^^^^^^^^^
error: because of the numeric bounds on `u8` prior to casting, this expression is always false
--> $DIR/invalid_upcast_comparisons.rs:31:5
|
31 | 300 < (u8 as i32);
31 | (u8 as i32) > 300;
| ^^^^^^^^^^^^^^^^^
error: because of the numeric bounds on `u8` prior to casting, this expression is always false
--> $DIR/invalid_upcast_comparisons.rs:32:5
|
32 | 300 == (u8 as u32);
32 | (u8 as u32) == 300;
| ^^^^^^^^^^^^^^^^^^
error: because of the numeric bounds on `u8` prior to casting, this expression is always false
--> $DIR/invalid_upcast_comparisons.rs:33:5
|
33 | 300 == (u8 as i32);
33 | (u8 as i32) == 300;
| ^^^^^^^^^^^^^^^^^^
error: because of the numeric bounds on `u8` prior to casting, this expression is always true
error: because of the numeric bounds on `u8` prior to casting, this expression is always false
--> $DIR/invalid_upcast_comparisons.rs:34:5
|
34 | 300 < (u8 as u32);
| ^^^^^^^^^^^^^^^^^
error: because of the numeric bounds on `u8` prior to casting, this expression is always false
--> $DIR/invalid_upcast_comparisons.rs:35:5
|
35 | (u8 as u32) <= 300;
| ^^^^^^^^^^^^^^^^^^
35 | 300 < (u8 as i32);
| ^^^^^^^^^^^^^^^^^
error: because of the numeric bounds on `u8` prior to casting, this expression is always true
error: because of the numeric bounds on `u8` prior to casting, this expression is always false
--> $DIR/invalid_upcast_comparisons.rs:36:5
|
36 | (u8 as i32) <= 300;
36 | 300 == (u8 as u32);
| ^^^^^^^^^^^^^^^^^^
error: because of the numeric bounds on `u8` prior to casting, this expression is always true
error: because of the numeric bounds on `u8` prior to casting, this expression is always false
--> $DIR/invalid_upcast_comparisons.rs:37:5
|
37 | (u8 as u32) != 300;
| ^^^^^^^^^^^^^^^^^^
error: because of the numeric bounds on `u8` prior to casting, this expression is always true
--> $DIR/invalid_upcast_comparisons.rs:38:5
|
38 | (u8 as i32) != 300;
37 | 300 == (u8 as i32);
| ^^^^^^^^^^^^^^^^^^
error: because of the numeric bounds on `u8` prior to casting, this expression is always true
--> $DIR/invalid_upcast_comparisons.rs:39:5
|
39 | 300 >= (u8 as u32);
39 | (u8 as u32) <= 300;
| ^^^^^^^^^^^^^^^^^^
error: because of the numeric bounds on `u8` prior to casting, this expression is always true
--> $DIR/invalid_upcast_comparisons.rs:40:5
|
40 | 300 >= (u8 as i32);
40 | (u8 as i32) <= 300;
| ^^^^^^^^^^^^^^^^^^
error: because of the numeric bounds on `u8` prior to casting, this expression is always true
--> $DIR/invalid_upcast_comparisons.rs:41:5
|
41 | 300 != (u8 as u32);
41 | (u8 as u32) != 300;
| ^^^^^^^^^^^^^^^^^^
error: because of the numeric bounds on `u8` prior to casting, this expression is always true
--> $DIR/invalid_upcast_comparisons.rs:42:5
|
42 | 300 != (u8 as i32);
42 | (u8 as i32) != 300;
| ^^^^^^^^^^^^^^^^^^
error: because of the numeric bounds on `u8` prior to casting, this expression is always false
error: because of the numeric bounds on `u8` prior to casting, this expression is always true
--> $DIR/invalid_upcast_comparisons.rs:43:5
|
43 | 300 >= (u8 as u32);
| ^^^^^^^^^^^^^^^^^^
error: because of the numeric bounds on `u8` prior to casting, this expression is always true
--> $DIR/invalid_upcast_comparisons.rs:44:5
|
44 | 300 >= (u8 as i32);
| ^^^^^^^^^^^^^^^^^^
error: because of the numeric bounds on `u8` prior to casting, this expression is always true
--> $DIR/invalid_upcast_comparisons.rs:45:5
|
45 | (u8 as i32) < 0;
| ^^^^^^^^^^^^^^^
45 | 300 != (u8 as u32);
| ^^^^^^^^^^^^^^^^^^
error: because of the numeric bounds on `u8` prior to casting, this expression is always true
--> $DIR/invalid_upcast_comparisons.rs:46:5
|
46 | -5 != (u8 as i32);
| ^^^^^^^^^^^^^^^^^
error: because of the numeric bounds on `u8` prior to casting, this expression is always true
--> $DIR/invalid_upcast_comparisons.rs:48:5
|
48 | (u8 as i32) >= 0;
| ^^^^^^^^^^^^^^^^
46 | 300 != (u8 as i32);
| ^^^^^^^^^^^^^^^^^^
error: because of the numeric bounds on `u8` prior to casting, this expression is always false
--> $DIR/invalid_upcast_comparisons.rs:49:5
|
49 | -5 == (u8 as i32);
49 | (u8 as i32) < 0;
| ^^^^^^^^^^^^^^^
error: because of the numeric bounds on `u8` prior to casting, this expression is always true
--> $DIR/invalid_upcast_comparisons.rs:50:5
|
50 | -5 != (u8 as i32);
| ^^^^^^^^^^^^^^^^^
error: because of the numeric bounds on `u8` prior to casting, this expression is always false
error: because of the numeric bounds on `u8` prior to casting, this expression is always true
--> $DIR/invalid_upcast_comparisons.rs:52:5
|
52 | 1337 == (u8 as i32);
| ^^^^^^^^^^^^^^^^^^^
52 | (u8 as i32) >= 0;
| ^^^^^^^^^^^^^^^^
error: because of the numeric bounds on `u8` prior to casting, this expression is always false
--> $DIR/invalid_upcast_comparisons.rs:53:5
|
53 | 1337 == (u8 as u32);
| ^^^^^^^^^^^^^^^^^^^
53 | -5 == (u8 as i32);
| ^^^^^^^^^^^^^^^^^
error: because of the numeric bounds on `u8` prior to casting, this expression is always true
--> $DIR/invalid_upcast_comparisons.rs:55:5
|
55 | 1337 != (u8 as i32);
| ^^^^^^^^^^^^^^^^^^^
error: because of the numeric bounds on `u8` prior to casting, this expression is always true
error: because of the numeric bounds on `u8` prior to casting, this expression is always false
--> $DIR/invalid_upcast_comparisons.rs:56:5
|
56 | 1337 != (u8 as u32);
56 | 1337 == (u8 as i32);
| ^^^^^^^^^^^^^^^^^^^
error: because of the numeric bounds on `u8` prior to casting, this expression is always false
--> $DIR/invalid_upcast_comparisons.rs:57:5
|
57 | 1337 == (u8 as u32);
| ^^^^^^^^^^^^^^^^^^^
error: because of the numeric bounds on `u8` prior to casting, this expression is always true
--> $DIR/invalid_upcast_comparisons.rs:71:5
--> $DIR/invalid_upcast_comparisons.rs:59:5
|
71 | (u8 as i32) > -1;
59 | 1337 != (u8 as i32);
| ^^^^^^^^^^^^^^^^^^^
error: because of the numeric bounds on `u8` prior to casting, this expression is always true
--> $DIR/invalid_upcast_comparisons.rs:60:5
|
60 | 1337 != (u8 as u32);
| ^^^^^^^^^^^^^^^^^^^
error: because of the numeric bounds on `u8` prior to casting, this expression is always true
--> $DIR/invalid_upcast_comparisons.rs:74:5
|
74 | (u8 as i32) > -1;
| ^^^^^^^^^^^^^^^^
error: because of the numeric bounds on `u8` prior to casting, this expression is always false
--> $DIR/invalid_upcast_comparisons.rs:72:5
--> $DIR/invalid_upcast_comparisons.rs:75:5
|
72 | (u8 as i32) < -1;
75 | (u8 as i32) < -1;
| ^^^^^^^^^^^^^^^^
error: because of the numeric bounds on `u8` prior to casting, this expression is always false
--> $DIR/invalid_upcast_comparisons.rs:88:5
--> $DIR/invalid_upcast_comparisons.rs:91:5
|
88 | -5 >= (u8 as i32);
91 | -5 >= (u8 as i32);
| ^^^^^^^^^^^^^^^^^
error: aborting due to 27 previous errors

View file

@ -1,7 +1,7 @@
error: expected token: `,`
--> $DIR/issue-3145.rs:12:19
--> $DIR/issue-3145.rs:11:19
|
12 | println!("{}" a); //~ERROR expected token: `,`
11 | println!("{}" a); //~ERROR expected token: `,`
| ^
error: aborting due to previous error

View file

@ -1,13 +1,13 @@
error: this loop could be written as a `for` loop
--> $DIR/issue_2356.rs:27:29
--> $DIR/issue_2356.rs:24:29
|
27 | while let Some(e) = it.next() {
24 | while let Some(e) = it.next() {
| ^^^^^^^^^ help: try: `for e in it { .. }`
|
note: lint level defined here
--> $DIR/issue_2356.rs:13:9
--> $DIR/issue_2356.rs:10:9
|
13 | #![deny(clippy::while_let_on_iterator)]
10 | #![deny(clippy::while_let_on_iterator)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to previous error

View file

@ -1,16 +1,20 @@
error: adding items after statements is confusing, since items exist from the start of the scope
--> $DIR/item_after_statement.rs:22:5
--> $DIR/item_after_statement.rs:21:5
|
22 | fn foo() { println!("foo"); }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
21 | / fn foo() {
22 | | println!("foo");
23 | | }
| |_____^
|
= note: `-D clippy::items-after-statements` implied by `-D warnings`
error: adding items after statements is confusing, since items exist from the start of the scope
--> $DIR/item_after_statement.rs:27:5
--> $DIR/item_after_statement.rs:28:5
|
27 | fn foo() { println!("foo"); }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
28 | / fn foo() {
29 | | println!("foo");
30 | | }
| |_____^
error: aborting due to 2 previous errors

View file

@ -1,40 +1,40 @@
error: digit groups should be smaller
--> $DIR/large_digit_groups.rs:17:16
--> $DIR/large_digit_groups.rs:24:9
|
17 | let bad = (0b1_10110_i64, 0x1_23456_78901_usize, 1_23456_f32, 1_23456.12_f32, 1_23456.12345_f32, 1_23456.12345_6_f32);
| ^^^^^^^^^^^^^ help: consider: `0b11_0110_i64`
24 | 0b1_10110_i64,
| ^^^^^^^^^^^^^ help: consider: `0b11_0110_i64`
|
= note: `-D clippy::large-digit-groups` implied by `-D warnings`
error: digit groups should be smaller
--> $DIR/large_digit_groups.rs:17:31
--> $DIR/large_digit_groups.rs:25:9
|
17 | let bad = (0b1_10110_i64, 0x1_23456_78901_usize, 1_23456_f32, 1_23456.12_f32, 1_23456.12345_f32, 1_23456.12345_6_f32);
| ^^^^^^^^^^^^^^^^^^^^^ help: consider: `0x0123_4567_8901_usize`
25 | 0x1_23456_78901_usize,
| ^^^^^^^^^^^^^^^^^^^^^ help: consider: `0x0123_4567_8901_usize`
error: digit groups should be smaller
--> $DIR/large_digit_groups.rs:17:54
--> $DIR/large_digit_groups.rs:26:9
|
17 | let bad = (0b1_10110_i64, 0x1_23456_78901_usize, 1_23456_f32, 1_23456.12_f32, 1_23456.12345_f32, 1_23456.12345_6_f32);
| ^^^^^^^^^^^ help: consider: `123_456_f32`
26 | 1_23456_f32,
| ^^^^^^^^^^^ help: consider: `123_456_f32`
error: digit groups should be smaller
--> $DIR/large_digit_groups.rs:17:67
--> $DIR/large_digit_groups.rs:27:9
|
17 | let bad = (0b1_10110_i64, 0x1_23456_78901_usize, 1_23456_f32, 1_23456.12_f32, 1_23456.12345_f32, 1_23456.12345_6_f32);
| ^^^^^^^^^^^^^^ help: consider: `123_456.12_f32`
27 | 1_23456.12_f32,
| ^^^^^^^^^^^^^^ help: consider: `123_456.12_f32`
error: digit groups should be smaller
--> $DIR/large_digit_groups.rs:17:83
--> $DIR/large_digit_groups.rs:28:9
|
17 | let bad = (0b1_10110_i64, 0x1_23456_78901_usize, 1_23456_f32, 1_23456.12_f32, 1_23456.12345_f32, 1_23456.12345_6_f32);
| ^^^^^^^^^^^^^^^^^ help: consider: `123_456.123_45_f32`
28 | 1_23456.12345_f32,
| ^^^^^^^^^^^^^^^^^ help: consider: `123_456.123_45_f32`
error: digit groups should be smaller
--> $DIR/large_digit_groups.rs:17:102
--> $DIR/large_digit_groups.rs:29:9
|
17 | let bad = (0b1_10110_i64, 0x1_23456_78901_usize, 1_23456_f32, 1_23456.12_f32, 1_23456.12345_f32, 1_23456.12345_6_f32);
| ^^^^^^^^^^^^^^^^^^^ help: consider: `123_456.123_456_f32`
29 | 1_23456.12345_6_f32,
| ^^^^^^^^^^^^^^^^^^^ help: consider: `123_456.123_456_f32`
error: aborting due to 6 previous errors

View file

@ -1,69 +1,69 @@
error: large size difference between variants
--> $DIR/large_enum_variant.rs:20:5
--> $DIR/large_enum_variant.rs:16:5
|
20 | B([i32; 8000]),
16 | B([i32; 8000]),
| ^^^^^^^^^^^^^^
|
= note: `-D clippy::large-enum-variant` implied by `-D warnings`
help: consider boxing the large fields to reduce the total size of the enum
|
20 | B(Box<[i32; 8000]>),
16 | B(Box<[i32; 8000]>),
| ^^^^^^^^^^^^^^^^
error: large size difference between variants
--> $DIR/large_enum_variant.rs:31:5
--> $DIR/large_enum_variant.rs:27:5
|
31 | C(T, [i32; 8000]),
27 | C(T, [i32; 8000]),
| ^^^^^^^^^^^^^^^^^
|
help: consider boxing the large fields to reduce the total size of the enum
--> $DIR/large_enum_variant.rs:31:5
--> $DIR/large_enum_variant.rs:27:5
|
31 | C(T, [i32; 8000]),
27 | C(T, [i32; 8000]),
| ^^^^^^^^^^^^^^^^^
error: large size difference between variants
--> $DIR/large_enum_variant.rs:44:5
--> $DIR/large_enum_variant.rs:40:5
|
44 | ContainingLargeEnum(LargeEnum),
40 | ContainingLargeEnum(LargeEnum),
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
help: consider boxing the large fields to reduce the total size of the enum
|
44 | ContainingLargeEnum(Box<LargeEnum>),
40 | ContainingLargeEnum(Box<LargeEnum>),
| ^^^^^^^^^^^^^^
error: large size difference between variants
--> $DIR/large_enum_variant.rs:47:5
--> $DIR/large_enum_variant.rs:43:5
|
47 | ContainingMoreThanOneField(i32, [i32; 8000], [i32; 9500]),
43 | ContainingMoreThanOneField(i32, [i32; 8000], [i32; 9500]),
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
help: consider boxing the large fields to reduce the total size of the enum
--> $DIR/large_enum_variant.rs:47:5
--> $DIR/large_enum_variant.rs:43:5
|
47 | ContainingMoreThanOneField(i32, [i32; 8000], [i32; 9500]),
43 | ContainingMoreThanOneField(i32, [i32; 8000], [i32; 9500]),
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: large size difference between variants
--> $DIR/large_enum_variant.rs:54:5
--> $DIR/large_enum_variant.rs:50:5
|
54 | StructLikeLarge { x: [i32; 8000], y: i32 },
50 | StructLikeLarge { x: [i32; 8000], y: i32 },
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
help: consider boxing the large fields to reduce the total size of the enum
--> $DIR/large_enum_variant.rs:54:5
--> $DIR/large_enum_variant.rs:50:5
|
54 | StructLikeLarge { x: [i32; 8000], y: i32 },
50 | StructLikeLarge { x: [i32; 8000], y: i32 },
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: large size difference between variants
--> $DIR/large_enum_variant.rs:59:5
--> $DIR/large_enum_variant.rs:55:5
|
59 | StructLikeLarge2 { x: [i32; 8000] },
55 | StructLikeLarge2 { x: [i32; 8000] },
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
help: consider boxing the large fields to reduce the total size of the enum
|
59 | StructLikeLarge2 { x: Box<[i32; 8000]> },
55 | StructLikeLarge2 { x: Box<[i32; 8000]> },
| ^^^^^^^^^^^^^^^^
error: aborting due to 6 previous errors

View file

@ -1,139 +1,139 @@
error: item `PubOne` has a public `len` method but no corresponding `is_empty` method
--> $DIR/len_zero.rs:18:1
--> $DIR/len_zero.rs:15:1
|
18 | / impl PubOne {
19 | | pub fn len(self: &Self) -> isize {
20 | | 1
21 | | }
22 | | }
15 | / impl PubOne {
16 | | pub fn len(self: &Self) -> isize {
17 | | 1
18 | | }
19 | | }
| |_^
|
= note: `-D clippy::len-without-is-empty` implied by `-D warnings`
error: trait `PubTraitsToo` has a `len` method but no (possibly inherited) `is_empty` method
--> $DIR/len_zero.rs:67:1
--> $DIR/len_zero.rs:64:1
|
67 | / pub trait PubTraitsToo {
68 | | fn len(self: &Self) -> isize;
69 | | }
64 | / pub trait PubTraitsToo {
65 | | fn len(self: &Self) -> isize;
66 | | }
| |_^
error: item `HasIsEmpty` has a public `len` method but a private `is_empty` method
--> $DIR/len_zero.rs:101:1
--> $DIR/len_zero.rs:98:1
|
101 | / impl HasIsEmpty {
102 | | pub fn len(self: &Self) -> isize {
103 | | 1
104 | | }
98 | / impl HasIsEmpty {
99 | | pub fn len(self: &Self) -> isize {
100 | | 1
101 | | }
... |
108 | | }
109 | | }
105 | | }
106 | | }
| |_^
error: item `HasWrongIsEmpty` has a public `len` method but no corresponding `is_empty` method
--> $DIR/len_zero.rs:130:1
--> $DIR/len_zero.rs:127:1
|
130 | / impl HasWrongIsEmpty {
131 | | pub fn len(self: &Self) -> isize {
132 | | 1
133 | | }
127 | / impl HasWrongIsEmpty {
128 | | pub fn len(self: &Self) -> isize {
129 | | 1
130 | | }
... |
137 | | }
138 | | }
134 | | }
135 | | }
| |_^
error: length comparison to zero
--> $DIR/len_zero.rs:151:8
--> $DIR/len_zero.rs:148:8
|
151 | if x.len() == 0 {
148 | if x.len() == 0 {
| ^^^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `x.is_empty()`
|
= note: `-D clippy::len-zero` implied by `-D warnings`
error: length comparison to zero
--> $DIR/len_zero.rs:155:8
--> $DIR/len_zero.rs:152:8
|
155 | if "".len() == 0 {}
152 | if "".len() == 0 {}
| ^^^^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `"".is_empty()`
error: length comparison to zero
--> $DIR/len_zero.rs:167:8
|
167 | if has_is_empty.len() == 0 {
| ^^^^^^^^^^^^^^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `has_is_empty.is_empty()`
error: length comparison to zero
--> $DIR/len_zero.rs:170:8
|
170 | if has_is_empty.len() == 0 {
| ^^^^^^^^^^^^^^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `has_is_empty.is_empty()`
170 | if has_is_empty.len() != 0 {
| ^^^^^^^^^^^^^^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `!has_is_empty.is_empty()`
error: length comparison to zero
--> $DIR/len_zero.rs:173:8
|
173 | if has_is_empty.len() != 0 {
| ^^^^^^^^^^^^^^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `!has_is_empty.is_empty()`
173 | if has_is_empty.len() > 0 {
| ^^^^^^^^^^^^^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `!has_is_empty.is_empty()`
error: length comparison to zero
error: length comparison to one
--> $DIR/len_zero.rs:176:8
|
176 | if has_is_empty.len() > 0 {
| ^^^^^^^^^^^^^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `!has_is_empty.is_empty()`
176 | if has_is_empty.len() < 1 {
| ^^^^^^^^^^^^^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `has_is_empty.is_empty()`
error: length comparison to one
--> $DIR/len_zero.rs:179:8
|
179 | if has_is_empty.len() < 1 {
| ^^^^^^^^^^^^^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `has_is_empty.is_empty()`
error: length comparison to one
--> $DIR/len_zero.rs:182:8
|
182 | if has_is_empty.len() >= 1 {
179 | if has_is_empty.len() >= 1 {
| ^^^^^^^^^^^^^^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `!has_is_empty.is_empty()`
error: length comparison to zero
--> $DIR/len_zero.rs:190:8
|
190 | if 0 == has_is_empty.len() {
| ^^^^^^^^^^^^^^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `has_is_empty.is_empty()`
error: length comparison to zero
--> $DIR/len_zero.rs:193:8
|
193 | if 0 == has_is_empty.len() {
| ^^^^^^^^^^^^^^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `has_is_empty.is_empty()`
193 | if 0 != has_is_empty.len() {
| ^^^^^^^^^^^^^^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `!has_is_empty.is_empty()`
error: length comparison to zero
--> $DIR/len_zero.rs:196:8
|
196 | if 0 != has_is_empty.len() {
| ^^^^^^^^^^^^^^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `!has_is_empty.is_empty()`
196 | if 0 < has_is_empty.len() {
| ^^^^^^^^^^^^^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `!has_is_empty.is_empty()`
error: length comparison to zero
error: length comparison to one
--> $DIR/len_zero.rs:199:8
|
199 | if 0 < has_is_empty.len() {
| ^^^^^^^^^^^^^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `!has_is_empty.is_empty()`
199 | if 1 <= has_is_empty.len() {
| ^^^^^^^^^^^^^^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `!has_is_empty.is_empty()`
error: length comparison to one
--> $DIR/len_zero.rs:202:8
|
202 | if 1 <= has_is_empty.len() {
| ^^^^^^^^^^^^^^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `!has_is_empty.is_empty()`
error: length comparison to one
--> $DIR/len_zero.rs:205:8
|
205 | if 1 > has_is_empty.len() {
202 | if 1 > has_is_empty.len() {
| ^^^^^^^^^^^^^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `has_is_empty.is_empty()`
error: length comparison to zero
--> $DIR/len_zero.rs:219:8
--> $DIR/len_zero.rs:216:8
|
219 | if with_is_empty.len() == 0 {
216 | if with_is_empty.len() == 0 {
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `with_is_empty.is_empty()`
error: length comparison to zero
--> $DIR/len_zero.rs:232:8
--> $DIR/len_zero.rs:229:8
|
232 | if b.len() != 0 {}
229 | if b.len() != 0 {}
| ^^^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `!b.is_empty()`
error: trait `DependsOnFoo` has a `len` method but no (possibly inherited) `is_empty` method
--> $DIR/len_zero.rs:238:1
--> $DIR/len_zero.rs:235:1
|
238 | / pub trait DependsOnFoo: Foo {
239 | | fn len(&mut self) -> usize;
240 | | }
235 | / pub trait DependsOnFoo: Foo {
236 | | fn len(&mut self) -> usize;
237 | | }
| |_^
error: aborting due to 19 previous errors

View file

@ -1,47 +1,47 @@
error: `if _ { .. } else { .. }` is an expression
--> $DIR/let_if_seq.rs:67:5
--> $DIR/let_if_seq.rs:72:5
|
67 | / let mut foo = 0;
68 | | if f() {
69 | | foo = 42;
70 | | }
72 | / let mut foo = 0;
73 | | if f() {
74 | | foo = 42;
75 | | }
| |_____^ help: it is more idiomatic to write: `let <mut> foo = if f() { 42 } else { 0 };`
|
= note: `-D clippy::useless-let-if-seq` implied by `-D warnings`
= note: you might not need `mut` at all
error: `if _ { .. } else { .. }` is an expression
--> $DIR/let_if_seq.rs:72:5
--> $DIR/let_if_seq.rs:77:5
|
72 | / let mut bar = 0;
73 | | if f() {
74 | | f();
75 | | bar = 42;
... |
78 | | f();
79 | | }
77 | / let mut bar = 0;
78 | | if f() {
79 | | f();
80 | | bar = 42;
81 | | } else {
82 | | f();
83 | | }
| |_____^ help: it is more idiomatic to write: `let <mut> bar = if f() { ..; 42 } else { ..; 0 };`
|
= note: you might not need `mut` at all
error: `if _ { .. } else { .. }` is an expression
--> $DIR/let_if_seq.rs:81:5
--> $DIR/let_if_seq.rs:85:5
|
81 | / let quz;
82 | | if f() {
83 | | quz = 42;
84 | | } else {
85 | | quz = 0;
86 | | }
85 | / let quz;
86 | | if f() {
87 | | quz = 42;
88 | | } else {
89 | | quz = 0;
90 | | }
| |_____^ help: it is more idiomatic to write: `let quz = if f() { 42 } else { 0 };`
error: `if _ { .. } else { .. }` is an expression
--> $DIR/let_if_seq.rs:110:5
--> $DIR/let_if_seq.rs:114:5
|
110 | / let mut baz = 0;
111 | | if f() {
112 | | baz = 42;
113 | | }
114 | / let mut baz = 0;
115 | | if f() {
116 | | baz = 42;
117 | | }
| |_____^ help: it is more idiomatic to write: `let <mut> baz = if f() { 42 } else { 0 };`
|
= note: you might not need `mut` at all

View file

@ -1,26 +1,26 @@
error: returning the result of a let binding from a block. Consider returning the expression directly.
--> $DIR/let_return.rs:20:5
--> $DIR/let_return.rs:16:5
|
20 | x
16 | x
| ^
|
= note: `-D clippy::let-and-return` implied by `-D warnings`
note: this expression can be directly returned
--> $DIR/let_return.rs:19:13
--> $DIR/let_return.rs:15:13
|
19 | let x = 5;
15 | let x = 5;
| ^
error: returning the result of a let binding from a block. Consider returning the expression directly.
--> $DIR/let_return.rs:26:9
--> $DIR/let_return.rs:22:9
|
26 | x
22 | x
| ^
|
note: this expression can be directly returned
--> $DIR/let_return.rs:25:17
--> $DIR/let_return.rs:21:17
|
25 | let x = 5;
21 | let x = 5;
| ^
error: aborting due to 2 previous errors

View file

@ -1,15 +1,15 @@
error: this let-binding has unit value. Consider omitting `let _x =`
--> $DIR/let_unit.rs:24:5
--> $DIR/let_unit.rs:20:5
|
24 | let _x = println!("x");
20 | let _x = println!("x");
| ^^^^^^^^^^^^^^^^^^^^^^^
|
= note: `-D clippy::let-unit-value` implied by `-D warnings`
error: this let-binding has unit value. Consider omitting `let _a =`
--> $DIR/let_unit.rs:28:9
--> $DIR/let_unit.rs:24:9
|
28 | let _a = ();
24 | let _a = ();
| ^^^^^^^^^^^^
error: aborting due to 2 previous errors

View file

@ -1,96 +1,122 @@
error: explicit lifetimes given in parameter types where they could be elided (or replaced with `'_` if needed by type declaration)
--> $DIR/lifetimes.rs:17:1
--> $DIR/lifetimes.rs:13:1
|
17 | fn distinct_lifetimes<'a, 'b>(_x: &'a u8, _y: &'b u8, _z: u8) { }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
13 | fn distinct_lifetimes<'a, 'b>(_x: &'a u8, _y: &'b u8, _z: u8) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: `-D clippy::needless-lifetimes` implied by `-D warnings`
error: explicit lifetimes given in parameter types where they could be elided (or replaced with `'_` if needed by type declaration)
--> $DIR/lifetimes.rs:19:1
--> $DIR/lifetimes.rs:15:1
|
19 | fn distinct_and_static<'a, 'b>(_x: &'a u8, _y: &'b u8, _z: &'static u8) { }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: explicit lifetimes given in parameter types where they could be elided (or replaced with `'_` if needed by type declaration)
--> $DIR/lifetimes.rs:27:1
|
27 | fn in_and_out<'a>(x: &'a u8, _y: u8) -> &'a u8 { x }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: explicit lifetimes given in parameter types where they could be elided (or replaced with `'_` if needed by type declaration)
--> $DIR/lifetimes.rs:39:1
|
39 | fn deep_reference_3<'a>(x: &'a u8, _y: u8) -> Result<&'a u8, ()> { Ok(x) }
15 | fn distinct_and_static<'a, 'b>(_x: &'a u8, _y: &'b u8, _z: &'static u8) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: explicit lifetimes given in parameter types where they could be elided (or replaced with `'_` if needed by type declaration)
--> $DIR/lifetimes.rs:42:1
--> $DIR/lifetimes.rs:23:1
|
42 | fn where_clause_without_lt<'a, T>(x: &'a u8, _y: u8) -> Result<&'a u8, ()> where T: Copy { Ok(x) }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
23 | / fn in_and_out<'a>(x: &'a u8, _y: u8) -> &'a u8 {
24 | | x
25 | | }
| |_^
error: explicit lifetimes given in parameter types where they could be elided (or replaced with `'_` if needed by type declaration)
--> $DIR/lifetimes.rs:48:1
--> $DIR/lifetimes.rs:47:1
|
48 | fn lifetime_param_2<'a, 'b>(_x: Ref<'a>, _y: &'b u8) { }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
47 | / fn deep_reference_3<'a>(x: &'a u8, _y: u8) -> Result<&'a u8, ()> {
48 | | Ok(x)
49 | | }
| |_^
error: explicit lifetimes given in parameter types where they could be elided (or replaced with `'_` if needed by type declaration)
--> $DIR/lifetimes.rs:62:1
--> $DIR/lifetimes.rs:52:1
|
62 | / fn fn_bound_2<'a, F, I>(_m: Lt<'a, I>, _f: F) -> Lt<'a, I>
63 | | where for<'x> F: Fn(Lt<'x, I>) -> Lt<'x, I>
64 | | { unreachable!() }
| |__________________^
52 | / fn where_clause_without_lt<'a, T>(x: &'a u8, _y: u8) -> Result<&'a u8, ()>
53 | | where
54 | | T: Copy,
55 | | {
56 | | Ok(x)
57 | | }
| |_^
error: explicit lifetimes given in parameter types where they could be elided (or replaced with `'_` if needed by type declaration)
--> $DIR/lifetimes.rs:87:5
--> $DIR/lifetimes.rs:63:1
|
87 | fn self_and_out<'s>(&'s self) -> &'s u8 { &self.x }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
63 | fn lifetime_param_2<'a, 'b>(_x: Ref<'a>, _y: &'b u8) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: explicit lifetimes given in parameter types where they could be elided (or replaced with `'_` if needed by type declaration)
--> $DIR/lifetimes.rs:91:5
--> $DIR/lifetimes.rs:84:1
|
91 | fn distinct_self_and_in<'s, 't>(&'s self, _x: &'t u8) { }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
84 | / fn fn_bound_2<'a, F, I>(_m: Lt<'a, I>, _f: F) -> Lt<'a, I>
85 | | where
86 | | for<'x> F: Fn(Lt<'x, I>) -> Lt<'x, I>,
87 | | {
88 | | unreachable!()
89 | | }
| |_^
error: explicit lifetimes given in parameter types where they could be elided (or replaced with `'_` if needed by type declaration)
--> $DIR/lifetimes.rs:107:1
--> $DIR/lifetimes.rs:117:5
|
107 | fn struct_with_lt<'a>(_foo: Foo<'a>) -> &'a str { unimplemented!() }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
117 | / fn self_and_out<'s>(&'s self) -> &'s u8 {
118 | | &self.x
119 | | }
| |_____^
error: explicit lifetimes given in parameter types where they could be elided (or replaced with `'_` if needed by type declaration)
--> $DIR/lifetimes.rs:127:1
--> $DIR/lifetimes.rs:125:5
|
127 | fn trait_obj_elided2<'a>(_arg: &'a Drop) -> &'a str { unimplemented!() }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
125 | fn distinct_self_and_in<'s, 't>(&'s self, _x: &'t u8) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: explicit lifetimes given in parameter types where they could be elided (or replaced with `'_` if needed by type declaration)
--> $DIR/lifetimes.rs:131:1
--> $DIR/lifetimes.rs:141:1
|
131 | fn alias_with_lt<'a>(_foo: FooAlias<'a>) -> &'a str { unimplemented!() }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
141 | / fn struct_with_lt<'a>(_foo: Foo<'a>) -> &'a str {
142 | | unimplemented!()
143 | | }
| |_^
error: explicit lifetimes given in parameter types where they could be elided (or replaced with `'_` if needed by type declaration)
--> $DIR/lifetimes.rs:142:1
--> $DIR/lifetimes.rs:171:1
|
142 | fn named_input_elided_output<'a>(_arg: &'a str) -> &str { unimplemented!() }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
171 | / fn trait_obj_elided2<'a>(_arg: &'a Drop) -> &'a str {
172 | | unimplemented!()
173 | | }
| |_^
error: explicit lifetimes given in parameter types where they could be elided (or replaced with `'_` if needed by type declaration)
--> $DIR/lifetimes.rs:146:1
--> $DIR/lifetimes.rs:177:1
|
146 | fn trait_bound_ok<'a, T: WithLifetime<'static>>(_: &'a u8, _: T) { unimplemented!() }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
177 | / fn alias_with_lt<'a>(_foo: FooAlias<'a>) -> &'a str {
178 | | unimplemented!()
179 | | }
| |_^
error: explicit lifetimes given in parameter types where they could be elided (or replaced with `'_` if needed by type declaration)
--> $DIR/lifetimes.rs:176:1
--> $DIR/lifetimes.rs:196:1
|
176 | fn out_return_type_lts<'a>(e: &'a str) -> Cow<'a> { unimplemented!() }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
196 | / fn named_input_elided_output<'a>(_arg: &'a str) -> &str {
197 | | unimplemented!()
198 | | }
| |_^
error: explicit lifetimes given in parameter types where they could be elided (or replaced with `'_` if needed by type declaration)
--> $DIR/lifetimes.rs:204:1
|
204 | / fn trait_bound_ok<'a, T: WithLifetime<'static>>(_: &'a u8, _: T) {
205 | | unimplemented!()
206 | | }
| |_^
error: explicit lifetimes given in parameter types where they could be elided (or replaced with `'_` if needed by type declaration)
--> $DIR/lifetimes.rs:241:1
|
241 | / fn out_return_type_lts<'a>(e: &'a str) -> Cow<'a> {
242 | | unimplemented!()
243 | | }
| |_^
error: aborting due to 15 previous errors

View file

@ -1,11 +1,11 @@
error: the lint `TEST_LINT` is not added to any `LintPass`
--> $DIR/lint_without_lint_pass.rs:12:1
--> $DIR/lint_without_lint_pass.rs:11:1
|
12 | / declare_clippy_lint! {
13 | | pub TEST_LINT,
14 | | correctness,
15 | | ""
16 | | }
11 | / declare_clippy_lint! {
12 | | pub TEST_LINT,
13 | | correctness,
14 | | ""
15 | | }
| |_^
|
note: lint level defined here

View file

@ -1,21 +1,21 @@
error: You are using an explicit closure for cloning elements
--> $DIR/map_clone.rs:16:22
--> $DIR/map_clone.rs:14:22
|
16 | let _: Vec<i8> = vec![5_i8; 6].iter().map(|x| *x).collect();
14 | let _: Vec<i8> = vec![5_i8; 6].iter().map(|x| *x).collect();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: Consider calling the dedicated `cloned` method: `vec![5_i8; 6].iter().cloned()`
|
= note: `-D clippy::map-clone` implied by `-D warnings`
error: You are using an explicit closure for cloning elements
--> $DIR/map_clone.rs:17:26
--> $DIR/map_clone.rs:15:26
|
17 | let _: Vec<String> = vec![String::new()].iter().map(|x| x.clone()).collect();
15 | let _: Vec<String> = vec![String::new()].iter().map(|x| x.clone()).collect();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: Consider calling the dedicated `cloned` method: `vec![String::new()].iter().cloned()`
error: You are using an explicit closure for cloning elements
--> $DIR/map_clone.rs:18:23
--> $DIR/map_clone.rs:16:23
|
18 | let _: Vec<u32> = vec![42, 43].iter().map(|&x| x).collect();
16 | let _: Vec<u32> = vec![42, 43].iter().map(|&x| x).collect();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: Consider calling the dedicated `cloned` method: `vec![42, 43].iter().cloned()`
error: aborting due to 3 previous errors

View file

@ -1,7 +1,7 @@
error: called `map(..).flatten()` on an `Iterator`. This is more succinctly expressed by calling `.flat_map(..)`
--> $DIR/map_flatten.rs:16:21
--> $DIR/map_flatten.rs:14:21
|
16 | let _: Vec<_> = vec![5_i8; 6].into_iter().map(|x| 0..x).flatten().collect();
14 | let _: Vec<_> = vec![5_i8; 6].into_iter().map(|x| 0..x).flatten().collect();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using flat_map instead: `vec![5_i8; 6].into_iter().flat_map(|x| 0..x)`
|
= note: `-D clippy::map-flatten` implied by `-D warnings`

View file

@ -1,74 +1,109 @@
error: this boolean expression can be simplified
--> $DIR/match_bool.rs:35:11
--> $DIR/match_bool.rs:38:11
|
35 | match test && test {
38 | match test && test {
| ^^^^^^^^^^^^ help: try: `test`
|
= note: `-D clippy::nonminimal-bool` implied by `-D warnings`
error: you seem to be trying to match on a boolean expression
--> $DIR/match_bool.rs:14:5
--> $DIR/match_bool.rs:13:5
|
14 | / match test {
15 | | true => 0,
16 | | false => 42,
17 | | };
13 | / match test {
14 | | true => 0,
15 | | false => 42,
16 | | };
| |_____^ help: consider using an if/else expression: `if test { 0 } else { 42 }`
|
= note: `-D clippy::match-bool` implied by `-D warnings`
error: you seem to be trying to match on a boolean expression
--> $DIR/match_bool.rs:20:5
--> $DIR/match_bool.rs:19:5
|
20 | / match option == 1 {
21 | | true => 1,
22 | | false => 0,
23 | | };
19 | / match option == 1 {
20 | | true => 1,
21 | | false => 0,
22 | | };
| |_____^ 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
--> $DIR/match_bool.rs:25:5
--> $DIR/match_bool.rs:24:5
|
24 | / match test {
25 | | true => (),
26 | | false => {
27 | | println!("Noooo!");
28 | | },
29 | | };
| |_____^
help: consider using an if/else expression
|
24 | if !test {
25 | println!("Noooo!");
26 | };
|
25 | / match test {
26 | | true => (),
27 | | false => { println!("Noooo!"); }
28 | | };
| |_____^ help: consider using an if/else expression: `if !test { println!("Noooo!"); }`
error: you seem to be trying to match on a boolean expression
--> $DIR/match_bool.rs:30:5
--> $DIR/match_bool.rs:31:5
|
31 | / match test {
32 | | false => {
33 | | println!("Noooo!");
34 | | },
35 | | _ => (),
36 | | };
| |_____^
help: consider using an if/else expression
|
31 | if !test {
32 | println!("Noooo!");
33 | };
|
30 | / match test {
31 | | false => { println!("Noooo!"); }
32 | | _ => (),
33 | | };
| |_____^ help: consider using an if/else expression: `if !test { println!("Noooo!"); }`
error: you seem to be trying to match on a boolean expression
--> $DIR/match_bool.rs:35:5
--> $DIR/match_bool.rs:38:5
|
38 | / match test && test {
39 | | false => {
40 | | println!("Noooo!");
41 | | },
42 | | _ => (),
43 | | };
| |_____^
help: consider using an if/else expression
|
38 | if !(test && test) {
39 | println!("Noooo!");
40 | };
|
35 | / match test && test {
36 | | false => { println!("Noooo!"); }
37 | | _ => (),
38 | | };
| |_____^ help: consider using an if/else expression: `if !(test && test) { println!("Noooo!"); }`
error: equal expressions as operands to `&&`
--> $DIR/match_bool.rs:35:11
--> $DIR/match_bool.rs:38:11
|
35 | match test && test {
38 | match test && test {
| ^^^^^^^^^^^^
|
= note: #[deny(clippy::eq_op)] on by default
error: you seem to be trying to match on a boolean expression
--> $DIR/match_bool.rs:40:5
--> $DIR/match_bool.rs:45:5
|
45 | / match test {
46 | | false => {
47 | | println!("Noooo!");
48 | | },
... |
51 | | },
52 | | };
| |_____^
help: consider using an if/else expression
|
45 | if test {
46 | println!("Yes!");
47 | } else {
48 | println!("Noooo!");
49 | };
|
40 | / match test {
41 | | false => { println!("Noooo!"); }
42 | | true => { println!("Yes!"); }
43 | | };
| |_____^ help: consider using an if/else expression: `if test { println!("Yes!"); } else { println!("Noooo!"); }`
error: aborting due to 8 previous errors

Some files were not shown because too many files have changed in this diff Show more