diff --git a/clippy_tests/examples/absurd-extreme-comparisons.stderr b/clippy_tests/examples/absurd-extreme-comparisons.stderr index 3bb71cf3c79..d52c9b2a04e 100644 --- a/clippy_tests/examples/absurd-extreme-comparisons.stderr +++ b/clippy_tests/examples/absurd-extreme-comparisons.stderr @@ -1,5 +1,5 @@ error: this comparison involving the minimum or maximum element for this type contains a case that is always true or always false - --> examples/absurd-extreme-comparisons.rs:10:5 + --> absurd-extreme-comparisons.rs:10:5 | 10 | u <= 0; | ^^^^^^ @@ -8,7 +8,7 @@ error: this comparison involving the minimum or maximum element for this type co = 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 - --> examples/absurd-extreme-comparisons.rs:11:5 + --> absurd-extreme-comparisons.rs:11:5 | 11 | u <= Z; | ^^^^^^ @@ -17,7 +17,7 @@ error: this comparison involving the minimum or maximum element for this type co = 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 - --> examples/absurd-extreme-comparisons.rs:12:5 + --> absurd-extreme-comparisons.rs:12:5 | 12 | u < Z; | ^^^^^ @@ -26,7 +26,7 @@ error: this comparison involving the minimum or maximum element for this type co = 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 - --> examples/absurd-extreme-comparisons.rs:13:5 + --> absurd-extreme-comparisons.rs:13:5 | 13 | Z >= u; | ^^^^^^ @@ -35,7 +35,7 @@ error: this comparison involving the minimum or maximum element for this type co = 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 - --> examples/absurd-extreme-comparisons.rs:14:5 + --> absurd-extreme-comparisons.rs:14:5 | 14 | Z > u; | ^^^^^ @@ -44,7 +44,7 @@ error: this comparison involving the minimum or maximum element for this type co = 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 - --> examples/absurd-extreme-comparisons.rs:15:5 + --> absurd-extreme-comparisons.rs:15:5 | 15 | u > std::u32::MAX; | ^^^^^^^^^^^^^^^^^ @@ -53,7 +53,7 @@ error: this comparison involving the minimum or maximum element for this type co = 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 - --> examples/absurd-extreme-comparisons.rs:16:5 + --> absurd-extreme-comparisons.rs:16:5 | 16 | u >= std::u32::MAX; | ^^^^^^^^^^^^^^^^^^ @@ -62,7 +62,7 @@ error: this comparison involving the minimum or maximum element for this type co = 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 - --> examples/absurd-extreme-comparisons.rs:17:5 + --> absurd-extreme-comparisons.rs:17:5 | 17 | std::u32::MAX < u; | ^^^^^^^^^^^^^^^^^ @@ -71,7 +71,7 @@ error: this comparison involving the minimum or maximum element for this type co = 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 - --> examples/absurd-extreme-comparisons.rs:18:5 + --> absurd-extreme-comparisons.rs:18:5 | 18 | std::u32::MAX <= u; | ^^^^^^^^^^^^^^^^^^ @@ -80,7 +80,7 @@ error: this comparison involving the minimum or maximum element for this type co = 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 - --> examples/absurd-extreme-comparisons.rs:19:5 + --> absurd-extreme-comparisons.rs:19:5 | 19 | 1-1 > u; | ^^^^^^^ @@ -89,7 +89,7 @@ error: this comparison involving the minimum or maximum element for this type co = 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 - --> examples/absurd-extreme-comparisons.rs:20:5 + --> absurd-extreme-comparisons.rs:20:5 | 20 | u >= !0; | ^^^^^^^ @@ -98,7 +98,7 @@ error: this comparison involving the minimum or maximum element for this type co = 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 - --> examples/absurd-extreme-comparisons.rs:21:5 + --> absurd-extreme-comparisons.rs:21:5 | 21 | u <= 12 - 2*6; | ^^^^^^^^^^^^^ @@ -107,7 +107,7 @@ error: this comparison involving the minimum or maximum element for this type co = 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 - --> examples/absurd-extreme-comparisons.rs:23:5 + --> absurd-extreme-comparisons.rs:23:5 | 23 | i < -127 - 1; | ^^^^^^^^^^^^ @@ -116,7 +116,7 @@ error: this comparison involving the minimum or maximum element for this type co = 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 - --> examples/absurd-extreme-comparisons.rs:24:5 + --> absurd-extreme-comparisons.rs:24:5 | 24 | std::i8::MAX >= i; | ^^^^^^^^^^^^^^^^^ @@ -125,7 +125,7 @@ error: this comparison involving the minimum or maximum element for this type co = 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 - --> examples/absurd-extreme-comparisons.rs:25:5 + --> absurd-extreme-comparisons.rs:25:5 | 25 | 3-7 < std::i32::MIN; | ^^^^^^^^^^^^^^^^^^^ @@ -134,7 +134,7 @@ error: this comparison involving the minimum or maximum element for this type co = 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 - --> examples/absurd-extreme-comparisons.rs:27:5 + --> absurd-extreme-comparisons.rs:27:5 | 27 | b >= true; | ^^^^^^^^^ @@ -143,7 +143,7 @@ error: this comparison involving the minimum or maximum element for this type co = 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 - --> examples/absurd-extreme-comparisons.rs:28:5 + --> absurd-extreme-comparisons.rs:28:5 | 28 | false > b; | ^^^^^^^^^ @@ -152,7 +152,7 @@ error: this comparison involving the minimum or maximum element for this type co = 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 - --> examples/absurd-extreme-comparisons.rs:31:5 + --> absurd-extreme-comparisons.rs:31:5 | 31 | () < {}; | ^^^^^^^ diff --git a/clippy_tests/examples/approx_const.stderr b/clippy_tests/examples/approx_const.stderr index d446bdf14ba..a33b35197bc 100644 --- a/clippy_tests/examples/approx_const.stderr +++ b/clippy_tests/examples/approx_const.stderr @@ -1,5 +1,5 @@ error: approximate value of `f{32, 64}::consts::E` found. Consider using it directly - --> examples/approx_const.rs:7:16 + --> approx_const.rs:7:16 | 7 | let my_e = 2.7182; | ^^^^^^ @@ -7,7 +7,7 @@ error: approximate value of `f{32, 64}::consts::E` found. Consider using it dire = note: `-D approx-constant` implied by `-D warnings` error: approximate value of `f{32, 64}::consts::E` found. Consider using it directly - --> examples/approx_const.rs:8:20 + --> approx_const.rs:8:20 | 8 | let almost_e = 2.718; | ^^^^^ @@ -15,7 +15,7 @@ error: approximate value of `f{32, 64}::consts::E` found. Consider using it dire = note: `-D approx-constant` implied by `-D warnings` error: approximate value of `f{32, 64}::consts::FRAC_1_PI` found. Consider using it directly - --> examples/approx_const.rs:11:24 + --> approx_const.rs:11:24 | 11 | let my_1_frac_pi = 0.3183; | ^^^^^^ @@ -23,7 +23,7 @@ error: approximate value of `f{32, 64}::consts::FRAC_1_PI` found. Consider using = note: `-D approx-constant` implied by `-D warnings` error: approximate value of `f{32, 64}::consts::FRAC_1_SQRT_2` found. Consider using it directly - --> examples/approx_const.rs:14:28 + --> approx_const.rs:14:28 | 14 | let my_frac_1_sqrt_2 = 0.70710678; | ^^^^^^^^^^ @@ -31,7 +31,7 @@ error: approximate value of `f{32, 64}::consts::FRAC_1_SQRT_2` found. Consider u = note: `-D approx-constant` implied by `-D warnings` error: approximate value of `f{32, 64}::consts::FRAC_1_SQRT_2` found. Consider using it directly - --> examples/approx_const.rs:15:32 + --> approx_const.rs:15:32 | 15 | let almost_frac_1_sqrt_2 = 0.70711; | ^^^^^^^ @@ -39,7 +39,7 @@ error: approximate value of `f{32, 64}::consts::FRAC_1_SQRT_2` found. Consider u = note: `-D approx-constant` implied by `-D warnings` error: approximate value of `f{32, 64}::consts::FRAC_2_PI` found. Consider using it directly - --> examples/approx_const.rs:18:24 + --> approx_const.rs:18:24 | 18 | let my_frac_2_pi = 0.63661977; | ^^^^^^^^^^ @@ -47,7 +47,7 @@ error: approximate value of `f{32, 64}::consts::FRAC_2_PI` found. Consider using = note: `-D approx-constant` implied by `-D warnings` error: approximate value of `f{32, 64}::consts::FRAC_2_SQRT_PI` found. Consider using it directly - --> examples/approx_const.rs:21:27 + --> approx_const.rs:21:27 | 21 | let my_frac_2_sq_pi = 1.128379; | ^^^^^^^^ @@ -55,7 +55,7 @@ error: approximate value of `f{32, 64}::consts::FRAC_2_SQRT_PI` found. Consider = note: `-D approx-constant` implied by `-D warnings` error: approximate value of `f{32, 64}::consts::FRAC_PI_2` found. Consider using it directly - --> examples/approx_const.rs:24:24 + --> approx_const.rs:24:24 | 24 | let my_frac_pi_2 = 1.57079632679; | ^^^^^^^^^^^^^ @@ -63,7 +63,7 @@ error: approximate value of `f{32, 64}::consts::FRAC_PI_2` found. Consider using = note: `-D approx-constant` implied by `-D warnings` error: approximate value of `f{32, 64}::consts::FRAC_PI_3` found. Consider using it directly - --> examples/approx_const.rs:27:24 + --> approx_const.rs:27:24 | 27 | let my_frac_pi_3 = 1.04719755119; | ^^^^^^^^^^^^^ @@ -71,7 +71,7 @@ error: approximate value of `f{32, 64}::consts::FRAC_PI_3` found. Consider using = note: `-D approx-constant` implied by `-D warnings` error: approximate value of `f{32, 64}::consts::FRAC_PI_4` found. Consider using it directly - --> examples/approx_const.rs:30:24 + --> approx_const.rs:30:24 | 30 | let my_frac_pi_4 = 0.785398163397; | ^^^^^^^^^^^^^^ @@ -79,7 +79,7 @@ error: approximate value of `f{32, 64}::consts::FRAC_PI_4` found. Consider using = note: `-D approx-constant` implied by `-D warnings` error: approximate value of `f{32, 64}::consts::FRAC_PI_6` found. Consider using it directly - --> examples/approx_const.rs:33:24 + --> approx_const.rs:33:24 | 33 | let my_frac_pi_6 = 0.523598775598; | ^^^^^^^^^^^^^^ @@ -87,7 +87,7 @@ error: approximate value of `f{32, 64}::consts::FRAC_PI_6` found. Consider using = note: `-D approx-constant` implied by `-D warnings` error: approximate value of `f{32, 64}::consts::FRAC_PI_8` found. Consider using it directly - --> examples/approx_const.rs:36:24 + --> approx_const.rs:36:24 | 36 | let my_frac_pi_8 = 0.3926990816987; | ^^^^^^^^^^^^^^^ @@ -95,7 +95,7 @@ error: approximate value of `f{32, 64}::consts::FRAC_PI_8` found. Consider using = note: `-D approx-constant` implied by `-D warnings` error: approximate value of `f{32, 64}::consts::LN_10` found. Consider using it directly - --> examples/approx_const.rs:39:20 + --> approx_const.rs:39:20 | 39 | let my_ln_10 = 2.302585092994046; | ^^^^^^^^^^^^^^^^^ @@ -103,7 +103,7 @@ error: approximate value of `f{32, 64}::consts::LN_10` found. Consider using it = note: `-D approx-constant` implied by `-D warnings` error: approximate value of `f{32, 64}::consts::LN_2` found. Consider using it directly - --> examples/approx_const.rs:42:19 + --> approx_const.rs:42:19 | 42 | let my_ln_2 = 0.6931471805599453; | ^^^^^^^^^^^^^^^^^^ @@ -111,7 +111,7 @@ error: approximate value of `f{32, 64}::consts::LN_2` found. Consider using it d = note: `-D approx-constant` implied by `-D warnings` error: approximate value of `f{32, 64}::consts::LOG10_E` found. Consider using it directly - --> examples/approx_const.rs:45:22 + --> approx_const.rs:45:22 | 45 | let my_log10_e = 0.43429448190325182; | ^^^^^^^^^^^^^^^^^^^ @@ -119,7 +119,7 @@ error: approximate value of `f{32, 64}::consts::LOG10_E` found. Consider using i = note: `-D approx-constant` implied by `-D warnings` error: approximate value of `f{32, 64}::consts::LOG2_E` found. Consider using it directly - --> examples/approx_const.rs:48:21 + --> approx_const.rs:48:21 | 48 | let my_log2_e = 1.4426950408889634; | ^^^^^^^^^^^^^^^^^^ @@ -127,7 +127,7 @@ error: approximate value of `f{32, 64}::consts::LOG2_E` found. Consider using it = note: `-D approx-constant` implied by `-D warnings` error: approximate value of `f{32, 64}::consts::PI` found. Consider using it directly - --> examples/approx_const.rs:51:17 + --> approx_const.rs:51:17 | 51 | let my_pi = 3.1415; | ^^^^^^ @@ -135,7 +135,7 @@ error: approximate value of `f{32, 64}::consts::PI` found. Consider using it dir = note: `-D approx-constant` implied by `-D warnings` error: approximate value of `f{32, 64}::consts::PI` found. Consider using it directly - --> examples/approx_const.rs:52:21 + --> approx_const.rs:52:21 | 52 | let almost_pi = 3.14; | ^^^^ @@ -143,7 +143,7 @@ error: approximate value of `f{32, 64}::consts::PI` found. Consider using it dir = note: `-D approx-constant` implied by `-D warnings` error: approximate value of `f{32, 64}::consts::SQRT_2` found. Consider using it directly - --> examples/approx_const.rs:55:18 + --> approx_const.rs:55:18 | 55 | let my_sq2 = 1.4142; | ^^^^^^ diff --git a/clippy_tests/examples/arithmetic.stderr b/clippy_tests/examples/arithmetic.stderr index 5e2b9237d6f..f0320672474 100644 --- a/clippy_tests/examples/arithmetic.stderr +++ b/clippy_tests/examples/arithmetic.stderr @@ -1,5 +1,5 @@ error: integer arithmetic detected - --> examples/arithmetic.rs:8:5 + --> arithmetic.rs:8:5 | 8 | 1 + i; | ^^^^^ @@ -7,7 +7,7 @@ error: integer arithmetic detected = note: `-D integer-arithmetic` implied by `-D warnings` error: integer arithmetic detected - --> examples/arithmetic.rs:9:5 + --> arithmetic.rs:9:5 | 9 | i * 2; | ^^^^^ @@ -15,7 +15,7 @@ error: integer arithmetic detected = note: `-D integer-arithmetic` implied by `-D warnings` error: integer arithmetic detected - --> examples/arithmetic.rs:10:5 + --> arithmetic.rs:10:5 | 10 | / 1 % 11 | | i / 2; // no error, this is part of the expression in the preceding line @@ -24,7 +24,7 @@ error: integer arithmetic detected = note: `-D integer-arithmetic` implied by `-D warnings` error: integer arithmetic detected - --> examples/arithmetic.rs:12:5 + --> arithmetic.rs:12:5 | 12 | i - 2 + 2 - i; | ^^^^^^^^^^^^^ @@ -32,7 +32,7 @@ error: integer arithmetic detected = note: `-D integer-arithmetic` implied by `-D warnings` error: integer arithmetic detected - --> examples/arithmetic.rs:13:5 + --> arithmetic.rs:13:5 | 13 | -i; | ^^ @@ -40,7 +40,7 @@ error: integer arithmetic detected = note: `-D integer-arithmetic` implied by `-D warnings` error: floating-point arithmetic detected - --> examples/arithmetic.rs:23:5 + --> arithmetic.rs:23:5 | 23 | f * 2.0; | ^^^^^^^ @@ -48,7 +48,7 @@ error: floating-point arithmetic detected = note: `-D float-arithmetic` implied by `-D warnings` error: floating-point arithmetic detected - --> examples/arithmetic.rs:25:5 + --> arithmetic.rs:25:5 | 25 | 1.0 + f; | ^^^^^^^ @@ -56,7 +56,7 @@ error: floating-point arithmetic detected = note: `-D float-arithmetic` implied by `-D warnings` error: floating-point arithmetic detected - --> examples/arithmetic.rs:26:5 + --> arithmetic.rs:26:5 | 26 | f * 2.0; | ^^^^^^^ @@ -64,7 +64,7 @@ error: floating-point arithmetic detected = note: `-D float-arithmetic` implied by `-D warnings` error: floating-point arithmetic detected - --> examples/arithmetic.rs:27:5 + --> arithmetic.rs:27:5 | 27 | f / 2.0; | ^^^^^^^ @@ -72,7 +72,7 @@ error: floating-point arithmetic detected = note: `-D float-arithmetic` implied by `-D warnings` error: floating-point arithmetic detected - --> examples/arithmetic.rs:28:5 + --> arithmetic.rs:28:5 | 28 | f - 2.0 * 4.2; | ^^^^^^^^^^^^^ @@ -80,7 +80,7 @@ error: floating-point arithmetic detected = note: `-D float-arithmetic` implied by `-D warnings` error: floating-point arithmetic detected - --> examples/arithmetic.rs:29:5 + --> arithmetic.rs:29:5 | 29 | -f; | ^^ diff --git a/clippy_tests/examples/array_indexing.stderr b/clippy_tests/examples/array_indexing.stderr index ef952421231..151ae299503 100644 --- a/clippy_tests/examples/array_indexing.stderr +++ b/clippy_tests/examples/array_indexing.stderr @@ -1,5 +1,5 @@ error: const index is out of bounds - --> examples/array_indexing.rs:12:5 + --> array_indexing.rs:12:5 | 12 | x[4]; | ^^^^ @@ -7,7 +7,7 @@ error: const index is out of bounds = note: `-D out-of-bounds-indexing` implied by `-D warnings` error: const index is out of bounds - --> examples/array_indexing.rs:13:5 + --> array_indexing.rs:13:5 | 13 | x[1 << 3]; | ^^^^^^^^^ @@ -15,7 +15,7 @@ error: const index is out of bounds = note: `-D out-of-bounds-indexing` implied by `-D warnings` error: range is out of bounds - --> examples/array_indexing.rs:14:6 + --> array_indexing.rs:14:6 | 14 | &x[1..5]; | ^^^^^^^ @@ -23,7 +23,7 @@ error: range is out of bounds = note: `-D out-of-bounds-indexing` implied by `-D warnings` error: range is out of bounds - --> examples/array_indexing.rs:16:6 + --> array_indexing.rs:16:6 | 16 | &x[0...4]; | ^^^^^^^^ @@ -31,7 +31,7 @@ error: range is out of bounds = note: `-D out-of-bounds-indexing` implied by `-D warnings` error: range is out of bounds - --> examples/array_indexing.rs:17:6 + --> array_indexing.rs:17:6 | 17 | &x[...4]; | ^^^^^^^ @@ -39,7 +39,7 @@ error: range is out of bounds = note: `-D out-of-bounds-indexing` implied by `-D warnings` error: range is out of bounds - --> examples/array_indexing.rs:21:6 + --> array_indexing.rs:21:6 | 21 | &x[5..]; | ^^^^^^ @@ -47,7 +47,7 @@ error: range is out of bounds = note: `-D out-of-bounds-indexing` implied by `-D warnings` error: range is out of bounds - --> examples/array_indexing.rs:23:6 + --> array_indexing.rs:23:6 | 23 | &x[..5]; | ^^^^^^ @@ -55,7 +55,7 @@ error: range is out of bounds = note: `-D out-of-bounds-indexing` implied by `-D warnings` error: indexing may panic - --> examples/array_indexing.rs:26:5 + --> array_indexing.rs:26:5 | 26 | y[0]; | ^^^^ @@ -63,7 +63,7 @@ error: indexing may panic = note: `-D indexing-slicing` implied by `-D warnings` error: slicing may panic - --> examples/array_indexing.rs:27:6 + --> array_indexing.rs:27:6 | 27 | &y[1..2]; | ^^^^^^^ @@ -71,7 +71,7 @@ error: slicing may panic = note: `-D indexing-slicing` implied by `-D warnings` error: slicing may panic - --> examples/array_indexing.rs:29:6 + --> array_indexing.rs:29:6 | 29 | &y[0...4]; | ^^^^^^^^ @@ -79,7 +79,7 @@ error: slicing may panic = note: `-D indexing-slicing` implied by `-D warnings` error: slicing may panic - --> examples/array_indexing.rs:30:6 + --> array_indexing.rs:30:6 | 30 | &y[...4]; | ^^^^^^^ @@ -87,7 +87,7 @@ error: slicing may panic = note: `-D indexing-slicing` implied by `-D warnings` error: const index is out of bounds - --> examples/array_indexing.rs:33:5 + --> array_indexing.rs:33:5 | 33 | empty[0]; | ^^^^^^^^ @@ -95,7 +95,7 @@ error: const index is out of bounds = note: `-D out-of-bounds-indexing` implied by `-D warnings` error: range is out of bounds - --> examples/array_indexing.rs:34:6 + --> array_indexing.rs:34:6 | 34 | &empty[1..5]; | ^^^^^^^^^^^ @@ -103,7 +103,7 @@ error: range is out of bounds = note: `-D out-of-bounds-indexing` implied by `-D warnings` error: range is out of bounds - --> examples/array_indexing.rs:35:6 + --> array_indexing.rs:35:6 | 35 | &empty[0...4]; | ^^^^^^^^^^^^ @@ -111,7 +111,7 @@ error: range is out of bounds = note: `-D out-of-bounds-indexing` implied by `-D warnings` error: range is out of bounds - --> examples/array_indexing.rs:36:6 + --> array_indexing.rs:36:6 | 36 | &empty[...4]; | ^^^^^^^^^^^ @@ -119,7 +119,7 @@ error: range is out of bounds = note: `-D out-of-bounds-indexing` implied by `-D warnings` error: range is out of bounds - --> examples/array_indexing.rs:40:6 + --> array_indexing.rs:40:6 | 40 | &empty[0...0]; | ^^^^^^^^^^^^ @@ -127,7 +127,7 @@ error: range is out of bounds = note: `-D out-of-bounds-indexing` implied by `-D warnings` error: range is out of bounds - --> examples/array_indexing.rs:41:6 + --> array_indexing.rs:41:6 | 41 | &empty[...0]; | ^^^^^^^^^^^ @@ -135,7 +135,7 @@ error: range is out of bounds = note: `-D out-of-bounds-indexing` implied by `-D warnings` error: range is out of bounds - --> examples/array_indexing.rs:43:6 + --> array_indexing.rs:43:6 | 43 | &empty[1..]; | ^^^^^^^^^^ @@ -143,7 +143,7 @@ error: range is out of bounds = note: `-D out-of-bounds-indexing` implied by `-D warnings` error: range is out of bounds - --> examples/array_indexing.rs:44:6 + --> array_indexing.rs:44:6 | 44 | &empty[..4]; | ^^^^^^^^^^ diff --git a/clippy_tests/examples/assign_ops.stderr b/clippy_tests/examples/assign_ops.stderr index c30ec097f76..f3a7854ceee 100644 --- a/clippy_tests/examples/assign_ops.stderr +++ b/clippy_tests/examples/assign_ops.stderr @@ -1,5 +1,5 @@ error: assign operation detected - --> examples/assign_ops.rs:8:5 + --> assign_ops.rs:8:5 | 8 | i += 2; | ^^^^^^ help: replace it with `i = i + 2` @@ -7,7 +7,7 @@ error: assign operation detected = note: `-D assign-ops` implied by `-D warnings` error: assign operation detected - --> examples/assign_ops.rs:9:5 + --> assign_ops.rs:9:5 | 9 | i += 2 + 17; | ^^^^^^^^^^^ help: replace it with `i = i + 2 + 17` @@ -15,7 +15,7 @@ error: assign operation detected = note: `-D assign-ops` implied by `-D warnings` error: assign operation detected - --> examples/assign_ops.rs:10:5 + --> assign_ops.rs:10:5 | 10 | i -= 6; | ^^^^^^ help: replace it with `i = i - 6` @@ -23,7 +23,7 @@ error: assign operation detected = note: `-D assign-ops` implied by `-D warnings` error: assign operation detected - --> examples/assign_ops.rs:11:5 + --> assign_ops.rs:11:5 | 11 | i -= 2 - 1; | ^^^^^^^^^^ help: replace it with `i = i - (2 - 1)` @@ -31,7 +31,7 @@ error: assign operation detected = note: `-D assign-ops` implied by `-D warnings` error: assign operation detected - --> examples/assign_ops.rs:12:5 + --> assign_ops.rs:12:5 | 12 | i *= 5; | ^^^^^^ help: replace it with `i = i * 5` @@ -39,7 +39,7 @@ error: assign operation detected = note: `-D assign-ops` implied by `-D warnings` error: assign operation detected - --> examples/assign_ops.rs:13:5 + --> assign_ops.rs:13:5 | 13 | i *= 1+5; | ^^^^^^^^ help: replace it with `i = i * (1+5)` @@ -47,7 +47,7 @@ error: assign operation detected = note: `-D assign-ops` implied by `-D warnings` error: assign operation detected - --> examples/assign_ops.rs:14:5 + --> assign_ops.rs:14:5 | 14 | i /= 32; | ^^^^^^^ help: replace it with `i = i / 32` @@ -55,7 +55,7 @@ error: assign operation detected = note: `-D assign-ops` implied by `-D warnings` error: assign operation detected - --> examples/assign_ops.rs:15:5 + --> assign_ops.rs:15:5 | 15 | i /= 32 | 5; | ^^^^^^^^^^^ help: replace it with `i = i / (32 | 5)` @@ -63,7 +63,7 @@ error: assign operation detected = note: `-D assign-ops` implied by `-D warnings` error: assign operation detected - --> examples/assign_ops.rs:16:5 + --> assign_ops.rs:16:5 | 16 | i /= 32 / 5; | ^^^^^^^^^^^ help: replace it with `i = i / (32 / 5)` @@ -71,7 +71,7 @@ error: assign operation detected = note: `-D assign-ops` implied by `-D warnings` error: assign operation detected - --> examples/assign_ops.rs:17:5 + --> assign_ops.rs:17:5 | 17 | i %= 42; | ^^^^^^^ help: replace it with `i = i % 42` @@ -79,7 +79,7 @@ error: assign operation detected = note: `-D assign-ops` implied by `-D warnings` error: assign operation detected - --> examples/assign_ops.rs:18:5 + --> assign_ops.rs:18:5 | 18 | i >>= i; | ^^^^^^^ help: replace it with `i = i >> i` @@ -87,7 +87,7 @@ error: assign operation detected = note: `-D assign-ops` implied by `-D warnings` error: assign operation detected - --> examples/assign_ops.rs:19:5 + --> assign_ops.rs:19:5 | 19 | i <<= 9 + 6 - 7; | ^^^^^^^^^^^^^^^ help: replace it with `i = i << (9 + 6 - 7)` @@ -95,7 +95,7 @@ error: assign operation detected = note: `-D assign-ops` implied by `-D warnings` error: assign operation detected - --> examples/assign_ops.rs:20:5 + --> assign_ops.rs:20:5 | 20 | i += 1 << 5; | ^^^^^^^^^^^ help: replace it with `i = i + (1 << 5)` @@ -103,7 +103,7 @@ error: assign operation detected = note: `-D assign-ops` implied by `-D warnings` error: manual implementation of an assign operation - --> examples/assign_ops.rs:27:5 + --> assign_ops.rs:27:5 | 27 | a = a + 1; | ^^^^^^^^^ help: replace it with `a += 1` @@ -111,7 +111,7 @@ error: manual implementation of an assign operation = note: `-D assign-op-pattern` implied by `-D warnings` error: manual implementation of an assign operation - --> examples/assign_ops.rs:28:5 + --> assign_ops.rs:28:5 | 28 | a = 1 + a; | ^^^^^^^^^ help: replace it with `a += 1` @@ -119,7 +119,7 @@ error: manual implementation of an assign operation = note: `-D assign-op-pattern` implied by `-D warnings` error: manual implementation of an assign operation - --> examples/assign_ops.rs:29:5 + --> assign_ops.rs:29:5 | 29 | a = a - 1; | ^^^^^^^^^ help: replace it with `a -= 1` @@ -127,7 +127,7 @@ error: manual implementation of an assign operation = note: `-D assign-op-pattern` implied by `-D warnings` error: manual implementation of an assign operation - --> examples/assign_ops.rs:30:5 + --> assign_ops.rs:30:5 | 30 | a = a * 99; | ^^^^^^^^^^ help: replace it with `a *= 99` @@ -135,7 +135,7 @@ error: manual implementation of an assign operation = note: `-D assign-op-pattern` implied by `-D warnings` error: manual implementation of an assign operation - --> examples/assign_ops.rs:31:5 + --> assign_ops.rs:31:5 | 31 | a = 42 * a; | ^^^^^^^^^^ help: replace it with `a *= 42` @@ -143,7 +143,7 @@ error: manual implementation of an assign operation = note: `-D assign-op-pattern` implied by `-D warnings` error: manual implementation of an assign operation - --> examples/assign_ops.rs:32:5 + --> assign_ops.rs:32:5 | 32 | a = a / 2; | ^^^^^^^^^ help: replace it with `a /= 2` @@ -151,7 +151,7 @@ error: manual implementation of an assign operation = note: `-D assign-op-pattern` implied by `-D warnings` error: manual implementation of an assign operation - --> examples/assign_ops.rs:33:5 + --> assign_ops.rs:33:5 | 33 | a = a % 5; | ^^^^^^^^^ help: replace it with `a %= 5` @@ -159,7 +159,7 @@ error: manual implementation of an assign operation = note: `-D assign-op-pattern` implied by `-D warnings` error: manual implementation of an assign operation - --> examples/assign_ops.rs:34:5 + --> assign_ops.rs:34:5 | 34 | a = a & 1; | ^^^^^^^^^ help: replace it with `a &= 1` diff --git a/clippy_tests/examples/assign_ops2.stderr b/clippy_tests/examples/assign_ops2.stderr index b27be7d1994..4c1c442e7d2 100644 --- a/clippy_tests/examples/assign_ops2.stderr +++ b/clippy_tests/examples/assign_ops2.stderr @@ -1,5 +1,5 @@ error: variable appears on both sides of an assignment operation - --> examples/assign_ops2.rs:8:5 + --> assign_ops2.rs:8:5 | 8 | a += a + 1; | ^^^^^^^^^^ help: replace it with `a += 1` @@ -7,7 +7,7 @@ error: variable appears on both sides of an assignment operation = note: `-D misrefactored-assign-op` implied by `-D warnings` error: variable appears on both sides of an assignment operation - --> examples/assign_ops2.rs:9:5 + --> assign_ops2.rs:9:5 | 9 | a += 1 + a; | ^^^^^^^^^^ help: replace it with `a += 1` @@ -15,7 +15,7 @@ error: variable appears on both sides of an assignment operation = note: `-D misrefactored-assign-op` implied by `-D warnings` error: variable appears on both sides of an assignment operation - --> examples/assign_ops2.rs:10:5 + --> assign_ops2.rs:10:5 | 10 | a -= a - 1; | ^^^^^^^^^^ help: replace it with `a -= 1` @@ -23,7 +23,7 @@ error: variable appears on both sides of an assignment operation = note: `-D misrefactored-assign-op` implied by `-D warnings` error: variable appears on both sides of an assignment operation - --> examples/assign_ops2.rs:11:5 + --> assign_ops2.rs:11:5 | 11 | a *= a * 99; | ^^^^^^^^^^^ help: replace it with `a *= 99` @@ -31,7 +31,7 @@ error: variable appears on both sides of an assignment operation = note: `-D misrefactored-assign-op` implied by `-D warnings` error: variable appears on both sides of an assignment operation - --> examples/assign_ops2.rs:12:5 + --> assign_ops2.rs:12:5 | 12 | a *= 42 * a; | ^^^^^^^^^^^ help: replace it with `a *= 42` @@ -39,7 +39,7 @@ error: variable appears on both sides of an assignment operation = note: `-D misrefactored-assign-op` implied by `-D warnings` error: variable appears on both sides of an assignment operation - --> examples/assign_ops2.rs:13:5 + --> assign_ops2.rs:13:5 | 13 | a /= a / 2; | ^^^^^^^^^^ help: replace it with `a /= 2` @@ -47,7 +47,7 @@ error: variable appears on both sides of an assignment operation = note: `-D misrefactored-assign-op` implied by `-D warnings` error: variable appears on both sides of an assignment operation - --> examples/assign_ops2.rs:14:5 + --> assign_ops2.rs:14:5 | 14 | a %= a % 5; | ^^^^^^^^^^ help: replace it with `a %= 5` @@ -55,7 +55,7 @@ error: variable appears on both sides of an assignment operation = note: `-D misrefactored-assign-op` implied by `-D warnings` error: variable appears on both sides of an assignment operation - --> examples/assign_ops2.rs:15:5 + --> assign_ops2.rs:15:5 | 15 | a &= a & 1; | ^^^^^^^^^^ help: replace it with `a &= 1` diff --git a/clippy_tests/examples/attrs.stderr b/clippy_tests/examples/attrs.stderr index 534e2acaac3..20766bd32d1 100644 --- a/clippy_tests/examples/attrs.stderr +++ b/clippy_tests/examples/attrs.stderr @@ -1,5 +1,5 @@ error: you have declared `#[inline(always)]` on `test_attr_lint`. This is usually a bad idea - --> examples/attrs.rs:6:1 + --> attrs.rs:6:1 | 6 | #[inline(always)] | ^^^^^^^^^^^^^^^^^ @@ -7,7 +7,7 @@ error: you have declared `#[inline(always)]` on `test_attr_lint`. This is usuall = note: `-D inline-always` implied by `-D warnings` error: the since field must contain a semver-compliant version - --> examples/attrs.rs:27:14 + --> attrs.rs:27:14 | 27 | #[deprecated(since = "forever")] | ^^^^^^^^^^^^^^^^^ @@ -15,7 +15,7 @@ error: the since field must contain a semver-compliant version = note: `-D deprecated-semver` implied by `-D warnings` error: the since field must contain a semver-compliant version - --> examples/attrs.rs:30:14 + --> attrs.rs:30:14 | 30 | #[deprecated(since = "1")] | ^^^^^^^^^^^ diff --git a/clippy_tests/examples/bit_masks.stderr b/clippy_tests/examples/bit_masks.stderr index 0cbff5d48c4..c463946a365 100644 --- a/clippy_tests/examples/bit_masks.stderr +++ b/clippy_tests/examples/bit_masks.stderr @@ -1,5 +1,5 @@ error: &-masking with zero - --> examples/bit_masks.rs:12:5 + --> bit_masks.rs:12:5 | 12 | x & 0 == 0; | ^^^^^^^^^^ @@ -7,7 +7,7 @@ error: &-masking with zero = note: `-D bad-bit-mask` implied by `-D warnings` error: incompatible bit mask: `_ & 2` can never be equal to `1` - --> examples/bit_masks.rs:15:5 + --> bit_masks.rs:15:5 | 15 | x & 2 == 1; | ^^^^^^^^^^ @@ -15,7 +15,7 @@ error: incompatible bit mask: `_ & 2` can never be equal to `1` = note: `-D bad-bit-mask` implied by `-D warnings` error: incompatible bit mask: `_ | 3` can never be equal to `2` - --> examples/bit_masks.rs:19:5 + --> bit_masks.rs:19:5 | 19 | x | 3 == 2; | ^^^^^^^^^^ @@ -23,7 +23,7 @@ error: incompatible bit mask: `_ | 3` can never be equal to `2` = note: `-D bad-bit-mask` implied by `-D warnings` error: incompatible bit mask: `_ & 1` will never be higher than `1` - --> examples/bit_masks.rs:21:5 + --> bit_masks.rs:21:5 | 21 | x & 1 > 1; | ^^^^^^^^^ @@ -31,7 +31,7 @@ error: incompatible bit mask: `_ & 1` will never be higher than `1` = note: `-D bad-bit-mask` implied by `-D warnings` error: incompatible bit mask: `_ | 2` will always be higher than `1` - --> examples/bit_masks.rs:25:5 + --> bit_masks.rs:25:5 | 25 | x | 2 > 1; | ^^^^^^^^^ @@ -39,7 +39,7 @@ error: incompatible bit mask: `_ | 2` will always be higher than `1` = note: `-D bad-bit-mask` implied by `-D warnings` error: incompatible bit mask: `_ & 7` can never be equal to `8` - --> examples/bit_masks.rs:32:5 + --> bit_masks.rs:32:5 | 32 | x & THREE_BITS == 8; | ^^^^^^^^^^^^^^^^^^^ @@ -47,7 +47,7 @@ error: incompatible bit mask: `_ & 7` can never be equal to `8` = note: `-D bad-bit-mask` implied by `-D warnings` error: incompatible bit mask: `_ | 7` will never be lower than `7` - --> examples/bit_masks.rs:33:5 + --> bit_masks.rs:33:5 | 33 | x | EVEN_MORE_REDIRECTION < 7; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -55,7 +55,7 @@ error: incompatible bit mask: `_ | 7` will never be lower than `7` = note: `-D bad-bit-mask` implied by `-D warnings` error: &-masking with zero - --> examples/bit_masks.rs:35:5 + --> bit_masks.rs:35:5 | 35 | 0 & x == 0; | ^^^^^^^^^^ @@ -63,7 +63,7 @@ error: &-masking with zero = note: `-D bad-bit-mask` implied by `-D warnings` error: incompatible bit mask: `_ | 2` will always be higher than `1` - --> examples/bit_masks.rs:39:5 + --> bit_masks.rs:39:5 | 39 | 1 < 2 | x; | ^^^^^^^^^ @@ -71,7 +71,7 @@ error: incompatible bit mask: `_ | 2` will always be higher than `1` = note: `-D bad-bit-mask` implied by `-D warnings` error: incompatible bit mask: `_ | 3` can never be equal to `2` - --> examples/bit_masks.rs:40:5 + --> bit_masks.rs:40:5 | 40 | 2 == 3 | x; | ^^^^^^^^^^ @@ -79,7 +79,7 @@ error: incompatible bit mask: `_ | 3` can never be equal to `2` = note: `-D bad-bit-mask` implied by `-D warnings` error: incompatible bit mask: `_ & 2` can never be equal to `1` - --> examples/bit_masks.rs:41:5 + --> bit_masks.rs:41:5 | 41 | 1 == x & 2; | ^^^^^^^^^^ @@ -87,7 +87,7 @@ error: incompatible bit mask: `_ & 2` can never be equal to `1` = note: `-D bad-bit-mask` implied by `-D warnings` error: ineffective bit mask: `x | 1` compared to `3`, is the same as x compared directly - --> examples/bit_masks.rs:52:5 + --> bit_masks.rs:52:5 | 52 | x | 1 > 3; | ^^^^^^^^^ @@ -95,7 +95,7 @@ error: ineffective bit mask: `x | 1` compared to `3`, is the same as x compared = note: `-D ineffective-bit-mask` implied by `-D warnings` error: ineffective bit mask: `x | 1` compared to `4`, is the same as x compared directly - --> examples/bit_masks.rs:53:5 + --> bit_masks.rs:53:5 | 53 | x | 1 < 4; | ^^^^^^^^^ @@ -103,7 +103,7 @@ error: ineffective bit mask: `x | 1` compared to `4`, is the same as x compared = note: `-D ineffective-bit-mask` implied by `-D warnings` error: ineffective bit mask: `x | 1` compared to `3`, is the same as x compared directly - --> examples/bit_masks.rs:54:5 + --> bit_masks.rs:54:5 | 54 | x | 1 <= 3; | ^^^^^^^^^^ @@ -111,7 +111,7 @@ error: ineffective bit mask: `x | 1` compared to `3`, is the same as x compared = note: `-D ineffective-bit-mask` implied by `-D warnings` error: ineffective bit mask: `x | 1` compared to `8`, is the same as x compared directly - --> examples/bit_masks.rs:55:5 + --> bit_masks.rs:55:5 | 55 | x | 1 >= 8; | ^^^^^^^^^^ diff --git a/clippy_tests/examples/blacklisted_name.stderr b/clippy_tests/examples/blacklisted_name.stderr index 65c4e9211e3..4e0333879d7 100644 --- a/clippy_tests/examples/blacklisted_name.stderr +++ b/clippy_tests/examples/blacklisted_name.stderr @@ -1,5 +1,5 @@ error: use of a blacklisted/placeholder name `foo` - --> examples/blacklisted_name.rs:7:9 + --> blacklisted_name.rs:7:9 | 7 | fn test(foo: ()) {} | ^^^ @@ -7,7 +7,7 @@ error: use of a blacklisted/placeholder name `foo` = note: `-D blacklisted-name` implied by `-D warnings` error: use of a blacklisted/placeholder name `foo` - --> examples/blacklisted_name.rs:10:9 + --> blacklisted_name.rs:10:9 | 10 | let foo = 42; | ^^^ @@ -15,7 +15,7 @@ error: use of a blacklisted/placeholder name `foo` = note: `-D blacklisted-name` implied by `-D warnings` error: use of a blacklisted/placeholder name `bar` - --> examples/blacklisted_name.rs:11:9 + --> blacklisted_name.rs:11:9 | 11 | let bar = 42; | ^^^ @@ -23,7 +23,7 @@ error: use of a blacklisted/placeholder name `bar` = note: `-D blacklisted-name` implied by `-D warnings` error: use of a blacklisted/placeholder name `baz` - --> examples/blacklisted_name.rs:12:9 + --> blacklisted_name.rs:12:9 | 12 | let baz = 42; | ^^^ @@ -31,7 +31,7 @@ error: use of a blacklisted/placeholder name `baz` = note: `-D blacklisted-name` implied by `-D warnings` error: use of a blacklisted/placeholder name `foo` - --> examples/blacklisted_name.rs:18:10 + --> blacklisted_name.rs:18:10 | 18 | (foo, Some(bar), baz @ Some(_)) => (), | ^^^ @@ -39,7 +39,7 @@ error: use of a blacklisted/placeholder name `foo` = note: `-D blacklisted-name` implied by `-D warnings` error: use of a blacklisted/placeholder name `bar` - --> examples/blacklisted_name.rs:18:20 + --> blacklisted_name.rs:18:20 | 18 | (foo, Some(bar), baz @ Some(_)) => (), | ^^^ @@ -47,7 +47,7 @@ error: use of a blacklisted/placeholder name `bar` = note: `-D blacklisted-name` implied by `-D warnings` error: use of a blacklisted/placeholder name `baz` - --> examples/blacklisted_name.rs:18:26 + --> blacklisted_name.rs:18:26 | 18 | (foo, Some(bar), baz @ Some(_)) => (), | ^^^ @@ -55,7 +55,7 @@ error: use of a blacklisted/placeholder name `baz` = note: `-D blacklisted-name` implied by `-D warnings` error: use of a blacklisted/placeholder name `foo` - --> examples/blacklisted_name.rs:23:19 + --> blacklisted_name.rs:23:19 | 23 | fn issue_1647(mut foo: u8) { | ^^^ @@ -63,7 +63,7 @@ error: use of a blacklisted/placeholder name `foo` = note: `-D blacklisted-name` implied by `-D warnings` error: use of a blacklisted/placeholder name `bar` - --> examples/blacklisted_name.rs:24:13 + --> blacklisted_name.rs:24:13 | 24 | let mut bar = 0; | ^^^ @@ -71,7 +71,7 @@ error: use of a blacklisted/placeholder name `bar` = note: `-D blacklisted-name` implied by `-D warnings` error: use of a blacklisted/placeholder name `baz` - --> examples/blacklisted_name.rs:25:21 + --> blacklisted_name.rs:25:21 | 25 | if let Some(mut baz) = Some(42) {} | ^^^ @@ -79,7 +79,7 @@ error: use of a blacklisted/placeholder name `baz` = note: `-D blacklisted-name` implied by `-D warnings` error: use of a blacklisted/placeholder name `bar` - --> examples/blacklisted_name.rs:29:13 + --> blacklisted_name.rs:29:13 | 29 | let ref bar = 0; | ^^^ @@ -87,7 +87,7 @@ error: use of a blacklisted/placeholder name `bar` = note: `-D blacklisted-name` implied by `-D warnings` error: use of a blacklisted/placeholder name `baz` - --> examples/blacklisted_name.rs:30:21 + --> blacklisted_name.rs:30:21 | 30 | if let Some(ref baz) = Some(42) {} | ^^^ @@ -95,7 +95,7 @@ error: use of a blacklisted/placeholder name `baz` = note: `-D blacklisted-name` implied by `-D warnings` error: use of a blacklisted/placeholder name `bar` - --> examples/blacklisted_name.rs:34:17 + --> blacklisted_name.rs:34:17 | 34 | let ref mut bar = 0; | ^^^ @@ -103,7 +103,7 @@ error: use of a blacklisted/placeholder name `bar` = note: `-D blacklisted-name` implied by `-D warnings` error: use of a blacklisted/placeholder name `baz` - --> examples/blacklisted_name.rs:35:25 + --> blacklisted_name.rs:35:25 | 35 | if let Some(ref mut baz) = Some(42) {} | ^^^ diff --git a/clippy_tests/examples/block_in_if_condition.stderr b/clippy_tests/examples/block_in_if_condition.stderr index 425617cdfca..5d598354fd0 100644 --- a/clippy_tests/examples/block_in_if_condition.stderr +++ b/clippy_tests/examples/block_in_if_condition.stderr @@ -1,5 +1,5 @@ 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' - --> examples/block_in_if_condition.rs:30:8 + --> block_in_if_condition.rs:30:8 | 30 | if { | ________^ @@ -19,7 +19,7 @@ error: in an 'if' condition, avoid complex blocks or closures with blocks; inste } ... error: omit braces around single expression condition - --> examples/block_in_if_condition.rs:41:8 + --> block_in_if_condition.rs:41:8 | 41 | if { true } { | ^^^^^^^^ @@ -31,7 +31,7 @@ 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' - --> examples/block_in_if_condition.rs:58:49 + --> block_in_if_condition.rs:58:49 | 58 | if v == 3 && sky == "blue" && predicate(|x| { let target = 3; x == target }, v) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -39,7 +39,7 @@ error: in an 'if' condition, avoid complex blocks or closures with blocks; inste = note: `-D block-in-if-condition-stmt` implied by `-D warnings` 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' - --> examples/block_in_if_condition.rs:61:22 + --> block_in_if_condition.rs:61:22 | 61 | if predicate(|x| { let target = 3; x == target }, v) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -47,7 +47,7 @@ error: in an 'if' condition, avoid complex blocks or closures with blocks; inste = note: `-D block-in-if-condition-stmt` implied by `-D warnings` error: this boolean expression can be simplified - --> examples/block_in_if_condition.rs:67:8 + --> block_in_if_condition.rs:67:8 | 67 | if true && x == 3 { | ^^^^^^^^^^^^^^ help: try `x == 3` diff --git a/clippy_tests/examples/bool_comparison.stderr b/clippy_tests/examples/bool_comparison.stderr index bf053e21b11..c417b44113b 100644 --- a/clippy_tests/examples/bool_comparison.stderr +++ b/clippy_tests/examples/bool_comparison.stderr @@ -1,5 +1,5 @@ error: equality checks against true are unnecessary - --> examples/bool_comparison.rs:7:8 + --> bool_comparison.rs:7:8 | 7 | if x == true { "yes" } else { "no" }; | ^^^^^^^^^ help: try simplifying it as shown: `x` @@ -7,7 +7,7 @@ error: equality checks against true are unnecessary = note: `-D bool-comparison` implied by `-D warnings` error: equality checks against false can be replaced by a negation - --> examples/bool_comparison.rs:8:8 + --> bool_comparison.rs:8:8 | 8 | if x == false { "yes" } else { "no" }; | ^^^^^^^^^^ help: try simplifying it as shown: `!x` @@ -15,7 +15,7 @@ error: equality checks against false can be replaced by a negation = note: `-D bool-comparison` implied by `-D warnings` error: equality checks against true are unnecessary - --> examples/bool_comparison.rs:9:8 + --> bool_comparison.rs:9:8 | 9 | if true == x { "yes" } else { "no" }; | ^^^^^^^^^ help: try simplifying it as shown: `x` @@ -23,7 +23,7 @@ error: equality checks against true are unnecessary = note: `-D bool-comparison` implied by `-D warnings` error: equality checks against false can be replaced by a negation - --> examples/bool_comparison.rs:10:8 + --> bool_comparison.rs:10:8 | 10 | if false == x { "yes" } else { "no" }; | ^^^^^^^^^^ help: try simplifying it as shown: `!x` diff --git a/clippy_tests/examples/booleans.stderr b/clippy_tests/examples/booleans.stderr index 0c3ded9061b..4035ea6373f 100644 --- a/clippy_tests/examples/booleans.stderr +++ b/clippy_tests/examples/booleans.stderr @@ -1,18 +1,18 @@ error: this boolean expression contains a logic bug - --> examples/booleans.rs:12:13 + --> booleans.rs:12:13 | 12 | let _ = a && b || a; | ^^^^^^^^^^^ help: it would look like the following `a` | = note: `-D logic-bug` implied by `-D warnings` help: this expression can be optimized out by applying boolean operations to the outer expression - --> examples/booleans.rs:12:18 + --> booleans.rs:12:18 | 12 | let _ = a && b || a; | ^ error: this boolean expression can be simplified - --> examples/booleans.rs:14:13 + --> booleans.rs:14:13 | 14 | let _ = !true; | ^^^^^ help: try `false` @@ -20,7 +20,7 @@ error: this boolean expression can be simplified = note: `-D nonminimal-bool` implied by `-D warnings` error: this boolean expression can be simplified - --> examples/booleans.rs:15:13 + --> booleans.rs:15:13 | 15 | let _ = !false; | ^^^^^^ help: try `true` @@ -28,7 +28,7 @@ error: this boolean expression can be simplified = note: `-D nonminimal-bool` implied by `-D warnings` error: this boolean expression can be simplified - --> examples/booleans.rs:16:13 + --> booleans.rs:16:13 | 16 | let _ = !!a; | ^^^ help: try `a` @@ -36,20 +36,20 @@ error: this boolean expression can be simplified = note: `-D nonminimal-bool` implied by `-D warnings` error: this boolean expression contains a logic bug - --> examples/booleans.rs:17:13 + --> booleans.rs:17:13 | 17 | let _ = false && a; | ^^^^^^^^^^ help: it would look like the following `false` | = note: `-D logic-bug` implied by `-D warnings` help: this expression can be optimized out by applying boolean operations to the outer expression - --> examples/booleans.rs:17:22 + --> booleans.rs:17:22 | 17 | let _ = false && a; | ^ error: this boolean expression can be simplified - --> examples/booleans.rs:18:13 + --> booleans.rs:18:13 | 18 | let _ = false || a; | ^^^^^^^^^^ help: try `a` @@ -57,7 +57,7 @@ error: this boolean expression can be simplified = note: `-D nonminimal-bool` implied by `-D warnings` error: this boolean expression can be simplified - --> examples/booleans.rs:23:13 + --> booleans.rs:23:13 | 23 | let _ = !(!a && b); | ^^^^^^^^^^ help: try `!b || a` @@ -65,20 +65,20 @@ error: this boolean expression can be simplified = note: `-D nonminimal-bool` implied by `-D warnings` error: this boolean expression contains a logic bug - --> examples/booleans.rs:33:13 + --> booleans.rs:33:13 | 33 | let _ = a == b && a != b; | ^^^^^^^^^^^^^^^^ help: it would look like the following `false` | = note: `-D logic-bug` implied by `-D warnings` help: this expression can be optimized out by applying boolean operations to the outer expression - --> examples/booleans.rs:33:13 + --> booleans.rs:33:13 | 33 | let _ = a == b && a != b; | ^^^^^^ error: this boolean expression can be simplified - --> examples/booleans.rs:34:13 + --> booleans.rs:34:13 | 34 | let _ = a == b && c == 5 && a == b; | ^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -89,7 +89,7 @@ help: try | let _ = !(c != 5 || a != b); error: this boolean expression can be simplified - --> examples/booleans.rs:35:13 + --> booleans.rs:35:13 | 35 | let _ = a == b && c == 5 && b == a; | ^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -100,33 +100,33 @@ help: try | let _ = !(c != 5 || a != b); error: this boolean expression contains a logic bug - --> examples/booleans.rs:36:13 + --> booleans.rs:36:13 | 36 | let _ = a < b && a >= b; | ^^^^^^^^^^^^^^^ help: it would look like the following `false` | = note: `-D logic-bug` implied by `-D warnings` help: this expression can be optimized out by applying boolean operations to the outer expression - --> examples/booleans.rs:36:13 + --> booleans.rs:36:13 | 36 | let _ = a < b && a >= b; | ^^^^^ error: this boolean expression contains a logic bug - --> examples/booleans.rs:37:13 + --> booleans.rs:37:13 | 37 | let _ = a > b && a <= b; | ^^^^^^^^^^^^^^^ help: it would look like the following `false` | = note: `-D logic-bug` implied by `-D warnings` help: this expression can be optimized out by applying boolean operations to the outer expression - --> examples/booleans.rs:37:13 + --> booleans.rs:37:13 | 37 | let _ = a > b && a <= b; | ^^^^^ error: this boolean expression can be simplified - --> examples/booleans.rs:39:13 + --> booleans.rs:39:13 | 39 | let _ = a != b || !(a != b || c == d); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/clippy_tests/examples/box_vec.stderr b/clippy_tests/examples/box_vec.stderr index e1d2a17539d..73ddba686c3 100644 --- a/clippy_tests/examples/box_vec.stderr +++ b/clippy_tests/examples/box_vec.stderr @@ -1,5 +1,5 @@ error: you seem to be trying to use `Box>`. Consider using just `Vec` - --> examples/box_vec.rs:17:18 + --> box_vec.rs:17:18 | 17 | pub fn test(foo: Box>) { | ^^^^^^^^^^^^^^ diff --git a/clippy_tests/examples/cast.stderr b/clippy_tests/examples/cast.stderr index 78970a9b2bb..7b9b81852f1 100644 --- a/clippy_tests/examples/cast.stderr +++ b/clippy_tests/examples/cast.stderr @@ -1,5 +1,5 @@ error: casting i32 to f32 causes a loss of precision (i32 is 32 bits wide, but f32's mantissa is only 23 bits wide) - --> examples/cast.rs:8:5 + --> cast.rs:8:5 | 8 | 1i32 as f32; | ^^^^^^^^^^^ @@ -7,7 +7,7 @@ error: casting i32 to f32 causes a loss of precision (i32 is 32 bits wide, but f = note: `-D 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) - --> examples/cast.rs:9:5 + --> cast.rs:9:5 | 9 | 1i64 as f32; | ^^^^^^^^^^^ @@ -15,7 +15,7 @@ error: casting i64 to f32 causes a loss of precision (i64 is 64 bits wide, but f = note: `-D cast-precision-loss` implied by `-D warnings` error: casting i64 to f64 causes a loss of precision (i64 is 64 bits wide, but f64's mantissa is only 52 bits wide) - --> examples/cast.rs:10:5 + --> cast.rs:10:5 | 10 | 1i64 as f64; | ^^^^^^^^^^^ @@ -23,7 +23,7 @@ error: casting i64 to f64 causes a loss of precision (i64 is 64 bits wide, but f = note: `-D cast-precision-loss` implied by `-D warnings` error: casting u32 to f32 causes a loss of precision (u32 is 32 bits wide, but f32's mantissa is only 23 bits wide) - --> examples/cast.rs:11:5 + --> cast.rs:11:5 | 11 | 1u32 as f32; | ^^^^^^^^^^^ @@ -31,7 +31,7 @@ error: casting u32 to f32 causes a loss of precision (u32 is 32 bits wide, but f = note: `-D cast-precision-loss` implied by `-D warnings` error: casting u64 to f32 causes a loss of precision (u64 is 64 bits wide, but f32's mantissa is only 23 bits wide) - --> examples/cast.rs:12:5 + --> cast.rs:12:5 | 12 | 1u64 as f32; | ^^^^^^^^^^^ @@ -39,7 +39,7 @@ error: casting u64 to f32 causes a loss of precision (u64 is 64 bits wide, but f = note: `-D cast-precision-loss` implied by `-D warnings` error: casting u64 to f64 causes a loss of precision (u64 is 64 bits wide, but f64's mantissa is only 52 bits wide) - --> examples/cast.rs:13:5 + --> cast.rs:13:5 | 13 | 1u64 as f64; | ^^^^^^^^^^^ @@ -47,7 +47,7 @@ error: casting u64 to f64 causes a loss of precision (u64 is 64 bits wide, but f = note: `-D cast-precision-loss` implied by `-D warnings` error: casting f32 to i32 may truncate the value - --> examples/cast.rs:17:5 + --> cast.rs:17:5 | 17 | 1f32 as i32; | ^^^^^^^^^^^ @@ -55,7 +55,7 @@ error: casting f32 to i32 may truncate the value = note: `-D cast-possible-truncation` implied by `-D warnings` error: casting f32 to u32 may truncate the value - --> examples/cast.rs:18:5 + --> cast.rs:18:5 | 18 | 1f32 as u32; | ^^^^^^^^^^^ @@ -63,7 +63,7 @@ error: casting f32 to u32 may truncate the value = note: `-D cast-possible-truncation` implied by `-D warnings` error: casting f32 to u32 may lose the sign of the value - --> examples/cast.rs:18:5 + --> cast.rs:18:5 | 18 | 1f32 as u32; | ^^^^^^^^^^^ @@ -71,7 +71,7 @@ error: casting f32 to u32 may lose the sign of the value = note: `-D cast-sign-loss` implied by `-D warnings` error: casting f64 to f32 may truncate the value - --> examples/cast.rs:19:5 + --> cast.rs:19:5 | 19 | 1f64 as f32; | ^^^^^^^^^^^ @@ -79,7 +79,7 @@ error: casting f64 to f32 may truncate the value = note: `-D cast-possible-truncation` implied by `-D warnings` error: casting i32 to i8 may truncate the value - --> examples/cast.rs:20:5 + --> cast.rs:20:5 | 20 | 1i32 as i8; | ^^^^^^^^^^ @@ -87,7 +87,7 @@ error: casting i32 to i8 may truncate the value = note: `-D cast-possible-truncation` implied by `-D warnings` error: casting i32 to u8 may lose the sign of the value - --> examples/cast.rs:21:5 + --> cast.rs:21:5 | 21 | 1i32 as u8; | ^^^^^^^^^^ @@ -95,7 +95,7 @@ error: casting i32 to u8 may lose the sign of the value = note: `-D cast-sign-loss` implied by `-D warnings` error: casting i32 to u8 may truncate the value - --> examples/cast.rs:21:5 + --> cast.rs:21:5 | 21 | 1i32 as u8; | ^^^^^^^^^^ @@ -103,7 +103,7 @@ error: casting i32 to u8 may truncate the value = note: `-D cast-possible-truncation` implied by `-D warnings` error: casting f64 to isize may truncate the value - --> examples/cast.rs:22:5 + --> cast.rs:22:5 | 22 | 1f64 as isize; | ^^^^^^^^^^^^^ @@ -111,7 +111,7 @@ error: casting f64 to isize may truncate the value = note: `-D cast-possible-truncation` implied by `-D warnings` error: casting f64 to usize may truncate the value - --> examples/cast.rs:23:5 + --> cast.rs:23:5 | 23 | 1f64 as usize; | ^^^^^^^^^^^^^ @@ -119,7 +119,7 @@ error: casting f64 to usize may truncate the value = note: `-D cast-possible-truncation` implied by `-D warnings` error: casting f64 to usize may lose the sign of the value - --> examples/cast.rs:23:5 + --> cast.rs:23:5 | 23 | 1f64 as usize; | ^^^^^^^^^^^^^ @@ -127,7 +127,7 @@ error: casting f64 to usize may lose the sign of the value = note: `-D cast-sign-loss` implied by `-D warnings` error: casting u8 to i8 may wrap around the value - --> examples/cast.rs:25:5 + --> cast.rs:25:5 | 25 | 1u8 as i8; | ^^^^^^^^^ @@ -135,7 +135,7 @@ error: casting u8 to i8 may wrap around the value = note: `-D cast-possible-wrap` implied by `-D warnings` error: casting u16 to i16 may wrap around the value - --> examples/cast.rs:26:5 + --> cast.rs:26:5 | 26 | 1u16 as i16; | ^^^^^^^^^^^ @@ -143,7 +143,7 @@ error: casting u16 to i16 may wrap around the value = note: `-D cast-possible-wrap` implied by `-D warnings` error: casting u32 to i32 may wrap around the value - --> examples/cast.rs:27:5 + --> cast.rs:27:5 | 27 | 1u32 as i32; | ^^^^^^^^^^^ @@ -151,7 +151,7 @@ error: casting u32 to i32 may wrap around the value = note: `-D cast-possible-wrap` implied by `-D warnings` error: casting u64 to i64 may wrap around the value - --> examples/cast.rs:28:5 + --> cast.rs:28:5 | 28 | 1u64 as i64; | ^^^^^^^^^^^ @@ -159,7 +159,7 @@ error: casting u64 to i64 may wrap around the value = note: `-D cast-possible-wrap` implied by `-D warnings` error: casting usize to isize may wrap around the value - --> examples/cast.rs:29:5 + --> cast.rs:29:5 | 29 | 1usize as isize; | ^^^^^^^^^^^^^^^ @@ -167,7 +167,7 @@ error: casting usize to isize may wrap around the value = note: `-D cast-possible-wrap` implied by `-D warnings` error: casting i32 to u32 may lose the sign of the value - --> examples/cast.rs:31:5 + --> cast.rs:31:5 | 31 | 1i32 as u32; | ^^^^^^^^^^^ @@ -175,7 +175,7 @@ error: casting i32 to u32 may lose the sign of the value = note: `-D cast-sign-loss` implied by `-D warnings` error: casting isize to usize may lose the sign of the value - --> examples/cast.rs:32:5 + --> cast.rs:32:5 | 32 | 1isize as usize; | ^^^^^^^^^^^^^^^ @@ -183,7 +183,7 @@ error: casting isize to usize may lose the sign of the value = note: `-D cast-sign-loss` implied by `-D warnings` error: casting isize to i8 may truncate the value - --> examples/cast.rs:35:5 + --> cast.rs:35:5 | 35 | 1isize as i8; | ^^^^^^^^^^^^ @@ -191,7 +191,7 @@ error: casting isize to i8 may truncate the value = note: `-D 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) - --> examples/cast.rs:36:5 + --> cast.rs:36:5 | 36 | 1isize as f64; | ^^^^^^^^^^^^^ @@ -199,7 +199,7 @@ error: casting isize to f64 causes a loss of precision on targets with 64-bit wi = note: `-D 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) - --> examples/cast.rs:37:5 + --> cast.rs:37:5 | 37 | 1usize as f64; | ^^^^^^^^^^^^^ @@ -207,7 +207,7 @@ error: casting usize to f64 causes a loss of precision on targets with 64-bit wi = note: `-D cast-precision-loss` implied by `-D warnings` 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) - --> examples/cast.rs:38:5 + --> cast.rs:38:5 | 38 | 1isize as f32; | ^^^^^^^^^^^^^ @@ -215,7 +215,7 @@ error: casting isize to f32 causes a loss of precision (isize is 32 or 64 bits w = note: `-D cast-precision-loss` implied by `-D warnings` 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) - --> examples/cast.rs:39:5 + --> cast.rs:39:5 | 39 | 1usize as f32; | ^^^^^^^^^^^^^ @@ -223,7 +223,7 @@ error: casting usize to f32 causes a loss of precision (usize is 32 or 64 bits w = note: `-D cast-precision-loss` implied by `-D warnings` error: casting isize to i32 may truncate the value on targets with 64-bit wide pointers - --> examples/cast.rs:40:5 + --> cast.rs:40:5 | 40 | 1isize as i32; | ^^^^^^^^^^^^^ @@ -231,7 +231,7 @@ error: casting isize to i32 may truncate the value on targets with 64-bit wide p = note: `-D cast-possible-truncation` implied by `-D warnings` error: casting isize to u32 may lose the sign of the value - --> examples/cast.rs:41:5 + --> cast.rs:41:5 | 41 | 1isize as u32; | ^^^^^^^^^^^^^ @@ -239,7 +239,7 @@ error: casting isize to u32 may lose the sign of the value = note: `-D cast-sign-loss` implied by `-D warnings` error: casting isize to u32 may truncate the value on targets with 64-bit wide pointers - --> examples/cast.rs:41:5 + --> cast.rs:41:5 | 41 | 1isize as u32; | ^^^^^^^^^^^^^ @@ -247,7 +247,7 @@ error: casting isize to u32 may truncate the value on targets with 64-bit wide p = note: `-D cast-possible-truncation` implied by `-D warnings` error: casting usize to u32 may truncate the value on targets with 64-bit wide pointers - --> examples/cast.rs:42:5 + --> cast.rs:42:5 | 42 | 1usize as u32; | ^^^^^^^^^^^^^ @@ -255,7 +255,7 @@ error: casting usize to u32 may truncate the value on targets with 64-bit wide p = note: `-D cast-possible-truncation` implied by `-D warnings` error: casting usize to i32 may truncate the value on targets with 64-bit wide pointers - --> examples/cast.rs:43:5 + --> cast.rs:43:5 | 43 | 1usize as i32; | ^^^^^^^^^^^^^ @@ -263,7 +263,7 @@ error: casting usize to i32 may truncate the value on targets with 64-bit wide p = note: `-D cast-possible-truncation` implied by `-D warnings` error: casting usize to i32 may wrap around the value on targets with 32-bit wide pointers - --> examples/cast.rs:43:5 + --> cast.rs:43:5 | 43 | 1usize as i32; | ^^^^^^^^^^^^^ @@ -271,7 +271,7 @@ error: casting usize to i32 may wrap around the value on targets with 32-bit wid = note: `-D cast-possible-wrap` implied by `-D warnings` error: casting i64 to isize may truncate the value on targets with 32-bit wide pointers - --> examples/cast.rs:45:5 + --> cast.rs:45:5 | 45 | 1i64 as isize; | ^^^^^^^^^^^^^ @@ -279,7 +279,7 @@ error: casting i64 to isize may truncate the value on targets with 32-bit wide p = note: `-D cast-possible-truncation` implied by `-D warnings` error: casting i64 to usize may lose the sign of the value - --> examples/cast.rs:46:5 + --> cast.rs:46:5 | 46 | 1i64 as usize; | ^^^^^^^^^^^^^ @@ -287,7 +287,7 @@ error: casting i64 to usize may lose the sign of the value = note: `-D cast-sign-loss` implied by `-D warnings` error: casting i64 to usize may truncate the value on targets with 32-bit wide pointers - --> examples/cast.rs:46:5 + --> cast.rs:46:5 | 46 | 1i64 as usize; | ^^^^^^^^^^^^^ @@ -295,7 +295,7 @@ error: casting i64 to usize may truncate the value on targets with 32-bit wide p = note: `-D cast-possible-truncation` implied by `-D warnings` error: casting u64 to isize may truncate the value on targets with 32-bit wide pointers - --> examples/cast.rs:47:5 + --> cast.rs:47:5 | 47 | 1u64 as isize; | ^^^^^^^^^^^^^ @@ -303,7 +303,7 @@ error: casting u64 to isize may truncate the value on targets with 32-bit wide p = note: `-D cast-possible-truncation` implied by `-D warnings` error: casting u64 to isize may wrap around the value on targets with 64-bit wide pointers - --> examples/cast.rs:47:5 + --> cast.rs:47:5 | 47 | 1u64 as isize; | ^^^^^^^^^^^^^ @@ -311,7 +311,7 @@ error: casting u64 to isize may wrap around the value on targets with 64-bit wid = note: `-D cast-possible-wrap` implied by `-D warnings` error: casting u64 to usize may truncate the value on targets with 32-bit wide pointers - --> examples/cast.rs:48:5 + --> cast.rs:48:5 | 48 | 1u64 as usize; | ^^^^^^^^^^^^^ @@ -319,7 +319,7 @@ error: casting u64 to usize may truncate the value on targets with 32-bit wide p = note: `-D cast-possible-truncation` implied by `-D warnings` error: casting u32 to isize may wrap around the value on targets with 32-bit wide pointers - --> examples/cast.rs:49:5 + --> cast.rs:49:5 | 49 | 1u32 as isize; | ^^^^^^^^^^^^^ @@ -327,7 +327,7 @@ error: casting u32 to isize may wrap around the value on targets with 32-bit wid = note: `-D cast-possible-wrap` implied by `-D warnings` error: casting i32 to usize may lose the sign of the value - --> examples/cast.rs:52:5 + --> cast.rs:52:5 | 52 | 1i32 as usize; | ^^^^^^^^^^^^^ @@ -335,7 +335,7 @@ error: casting i32 to usize may lose the sign of the value = note: `-D cast-sign-loss` implied by `-D warnings` error: casting to the same type is unnecessary (`i32` -> `i32`) - --> examples/cast.rs:54:5 + --> cast.rs:54:5 | 54 | 1i32 as i32; | ^^^^^^^^^^^ @@ -343,7 +343,7 @@ error: casting to the same type is unnecessary (`i32` -> `i32`) = note: `-D unnecessary-cast` implied by `-D warnings` error: casting to the same type is unnecessary (`f32` -> `f32`) - --> examples/cast.rs:55:5 + --> cast.rs:55:5 | 55 | 1f32 as f32; | ^^^^^^^^^^^ @@ -351,7 +351,7 @@ error: casting to the same type is unnecessary (`f32` -> `f32`) = note: `-D unnecessary-cast` implied by `-D warnings` error: casting to the same type is unnecessary (`bool` -> `bool`) - --> examples/cast.rs:56:5 + --> cast.rs:56:5 | 56 | false as bool; | ^^^^^^^^^^^^^ diff --git a/clippy_tests/examples/char_lit_as_u8.stderr b/clippy_tests/examples/char_lit_as_u8.stderr index f1b5b867c41..07d09825b53 100644 --- a/clippy_tests/examples/char_lit_as_u8.stderr +++ b/clippy_tests/examples/char_lit_as_u8.stderr @@ -1,5 +1,5 @@ error: casting character literal to u8. `char`s are 4 bytes wide in rust, so casting to u8 truncates them - --> examples/char_lit_as_u8.rs:7:13 + --> char_lit_as_u8.rs:7:13 | 7 | let c = 'a' as u8; | ^^^^^^^^^ diff --git a/clippy_tests/examples/cmp_nan.stderr b/clippy_tests/examples/cmp_nan.stderr index 24776d6c8d5..d20a727cc34 100644 --- a/clippy_tests/examples/cmp_nan.stderr +++ b/clippy_tests/examples/cmp_nan.stderr @@ -1,5 +1,5 @@ error: doomed comparison with NAN, use `std::{f32,f64}::is_nan()` instead - --> examples/cmp_nan.rs:8:5 + --> cmp_nan.rs:8:5 | 8 | x == std::f32::NAN; | ^^^^^^^^^^^^^^^^^^ @@ -7,7 +7,7 @@ error: doomed comparison with NAN, use `std::{f32,f64}::is_nan()` instead = note: `-D cmp-nan` implied by `-D warnings` error: doomed comparison with NAN, use `std::{f32,f64}::is_nan()` instead - --> examples/cmp_nan.rs:9:5 + --> cmp_nan.rs:9:5 | 9 | x != std::f32::NAN; | ^^^^^^^^^^^^^^^^^^ @@ -15,7 +15,7 @@ error: doomed comparison with NAN, use `std::{f32,f64}::is_nan()` instead = note: `-D cmp-nan` implied by `-D warnings` error: doomed comparison with NAN, use `std::{f32,f64}::is_nan()` instead - --> examples/cmp_nan.rs:10:5 + --> cmp_nan.rs:10:5 | 10 | x < std::f32::NAN; | ^^^^^^^^^^^^^^^^^ @@ -23,7 +23,7 @@ error: doomed comparison with NAN, use `std::{f32,f64}::is_nan()` instead = note: `-D cmp-nan` implied by `-D warnings` error: doomed comparison with NAN, use `std::{f32,f64}::is_nan()` instead - --> examples/cmp_nan.rs:11:5 + --> cmp_nan.rs:11:5 | 11 | x > std::f32::NAN; | ^^^^^^^^^^^^^^^^^ @@ -31,7 +31,7 @@ error: doomed comparison with NAN, use `std::{f32,f64}::is_nan()` instead = note: `-D cmp-nan` implied by `-D warnings` error: doomed comparison with NAN, use `std::{f32,f64}::is_nan()` instead - --> examples/cmp_nan.rs:12:5 + --> cmp_nan.rs:12:5 | 12 | x <= std::f32::NAN; | ^^^^^^^^^^^^^^^^^^ @@ -39,7 +39,7 @@ error: doomed comparison with NAN, use `std::{f32,f64}::is_nan()` instead = note: `-D cmp-nan` implied by `-D warnings` error: doomed comparison with NAN, use `std::{f32,f64}::is_nan()` instead - --> examples/cmp_nan.rs:13:5 + --> cmp_nan.rs:13:5 | 13 | x >= std::f32::NAN; | ^^^^^^^^^^^^^^^^^^ @@ -47,7 +47,7 @@ error: doomed comparison with NAN, use `std::{f32,f64}::is_nan()` instead = note: `-D cmp-nan` implied by `-D warnings` error: doomed comparison with NAN, use `std::{f32,f64}::is_nan()` instead - --> examples/cmp_nan.rs:16:5 + --> cmp_nan.rs:16:5 | 16 | y == std::f64::NAN; | ^^^^^^^^^^^^^^^^^^ @@ -55,7 +55,7 @@ error: doomed comparison with NAN, use `std::{f32,f64}::is_nan()` instead = note: `-D cmp-nan` implied by `-D warnings` error: doomed comparison with NAN, use `std::{f32,f64}::is_nan()` instead - --> examples/cmp_nan.rs:17:5 + --> cmp_nan.rs:17:5 | 17 | y != std::f64::NAN; | ^^^^^^^^^^^^^^^^^^ @@ -63,7 +63,7 @@ error: doomed comparison with NAN, use `std::{f32,f64}::is_nan()` instead = note: `-D cmp-nan` implied by `-D warnings` error: doomed comparison with NAN, use `std::{f32,f64}::is_nan()` instead - --> examples/cmp_nan.rs:18:5 + --> cmp_nan.rs:18:5 | 18 | y < std::f64::NAN; | ^^^^^^^^^^^^^^^^^ @@ -71,7 +71,7 @@ error: doomed comparison with NAN, use `std::{f32,f64}::is_nan()` instead = note: `-D cmp-nan` implied by `-D warnings` error: doomed comparison with NAN, use `std::{f32,f64}::is_nan()` instead - --> examples/cmp_nan.rs:19:5 + --> cmp_nan.rs:19:5 | 19 | y > std::f64::NAN; | ^^^^^^^^^^^^^^^^^ @@ -79,7 +79,7 @@ error: doomed comparison with NAN, use `std::{f32,f64}::is_nan()` instead = note: `-D cmp-nan` implied by `-D warnings` error: doomed comparison with NAN, use `std::{f32,f64}::is_nan()` instead - --> examples/cmp_nan.rs:20:5 + --> cmp_nan.rs:20:5 | 20 | y <= std::f64::NAN; | ^^^^^^^^^^^^^^^^^^ @@ -87,7 +87,7 @@ error: doomed comparison with NAN, use `std::{f32,f64}::is_nan()` instead = note: `-D cmp-nan` implied by `-D warnings` error: doomed comparison with NAN, use `std::{f32,f64}::is_nan()` instead - --> examples/cmp_nan.rs:21:5 + --> cmp_nan.rs:21:5 | 21 | y >= std::f64::NAN; | ^^^^^^^^^^^^^^^^^^ diff --git a/clippy_tests/examples/cmp_null.stderr b/clippy_tests/examples/cmp_null.stderr index 6709ad799c4..903ee261e53 100644 --- a/clippy_tests/examples/cmp_null.stderr +++ b/clippy_tests/examples/cmp_null.stderr @@ -1,5 +1,5 @@ error: Comparing with null is better expressed by the .is_null() method - --> examples/cmp_null.rs:11:8 + --> cmp_null.rs:11:8 | 11 | if p == ptr::null() { | ^^^^^^^^^^^^^^^^ @@ -7,7 +7,7 @@ error: Comparing with null is better expressed by the .is_null() method = note: `-D cmp-null` implied by `-D warnings` error: Comparing with null is better expressed by the .is_null() method - --> examples/cmp_null.rs:16:8 + --> cmp_null.rs:16:8 | 16 | if m == ptr::null_mut() { | ^^^^^^^^^^^^^^^^^^^^ diff --git a/clippy_tests/examples/cmp_owned.stderr b/clippy_tests/examples/cmp_owned.stderr index b5fe50094d6..738f890d4b6 100644 --- a/clippy_tests/examples/cmp_owned.stderr +++ b/clippy_tests/examples/cmp_owned.stderr @@ -1,5 +1,5 @@ error: this creates an owned instance just for comparison - --> examples/cmp_owned.rs:8:14 + --> cmp_owned.rs:8:14 | 8 | x != "foo".to_string(); | ^^^^^^^^^^^^^^^^^ help: try `"foo"` @@ -7,7 +7,7 @@ error: this creates an owned instance just for comparison = note: `-D cmp-owned` implied by `-D warnings` error: this creates an owned instance just for comparison - --> examples/cmp_owned.rs:10:9 + --> cmp_owned.rs:10:9 | 10 | "foo".to_string() != x; | ^^^^^^^^^^^^^^^^^ help: try `"foo"` @@ -15,7 +15,7 @@ error: this creates an owned instance just for comparison = note: `-D cmp-owned` implied by `-D warnings` error: this creates an owned instance just for comparison - --> examples/cmp_owned.rs:17:10 + --> cmp_owned.rs:17:10 | 17 | x != "foo".to_owned(); | ^^^^^^^^^^^^^^^^ help: try `"foo"` @@ -23,7 +23,7 @@ error: this creates an owned instance just for comparison = note: `-D cmp-owned` implied by `-D warnings` error: this creates an owned instance just for comparison - --> examples/cmp_owned.rs:19:10 + --> cmp_owned.rs:19:10 | 19 | x != String::from("foo"); | ^^^^^^^^^^^^^^^^^^^ help: try `"foo"` @@ -31,7 +31,7 @@ error: this creates an owned instance just for comparison = note: `-D cmp-owned` implied by `-D warnings` error: this creates an owned instance just for comparison - --> examples/cmp_owned.rs:23:5 + --> cmp_owned.rs:23:5 | 23 | Foo.to_owned() == Foo; | ^^^^^^^^^^^^^^ help: try `Foo` @@ -39,7 +39,7 @@ error: this creates an owned instance just for comparison = note: `-D cmp-owned` implied by `-D warnings` error: this creates an owned instance just for comparison - --> examples/cmp_owned.rs:30:9 + --> cmp_owned.rs:30:9 | 30 | self.to_owned() == *other | ^^^^^^^^^^^^^^^ try calling implementing the comparison without allocating diff --git a/clippy_tests/examples/collapsible_if.stderr b/clippy_tests/examples/collapsible_if.stderr index dbdbae59ca1..df38b9d1acc 100644 --- a/clippy_tests/examples/collapsible_if.stderr +++ b/clippy_tests/examples/collapsible_if.stderr @@ -1,5 +1,5 @@ error: this if statement can be collapsed - --> examples/collapsible_if.rs:8:5 + --> collapsible_if.rs:8:5 | 8 | / if x == "hello" { 9 | | if y == "world" { @@ -15,7 +15,7 @@ help: try | } error: this if statement can be collapsed - --> examples/collapsible_if.rs:14:5 + --> collapsible_if.rs:14:5 | 14 | / if x == "hello" || x == "world" { 15 | | if y == "world" || y == "hello" { @@ -31,7 +31,7 @@ help: try | } error: this if statement can be collapsed - --> examples/collapsible_if.rs:20:5 + --> collapsible_if.rs:20:5 | 20 | / if x == "hello" && x == "world" { 21 | | if y == "world" || y == "hello" { @@ -47,7 +47,7 @@ help: try | } error: this if statement can be collapsed - --> examples/collapsible_if.rs:26:5 + --> collapsible_if.rs:26:5 | 26 | / if x == "hello" || x == "world" { 27 | | if y == "world" && y == "hello" { @@ -63,7 +63,7 @@ help: try | } error: this if statement can be collapsed - --> examples/collapsible_if.rs:32:5 + --> collapsible_if.rs:32:5 | 32 | / if x == "hello" && x == "world" { 33 | | if y == "world" && y == "hello" { @@ -79,7 +79,7 @@ help: try | } error: this if statement can be collapsed - --> examples/collapsible_if.rs:38:5 + --> collapsible_if.rs:38:5 | 38 | / if 42 == 1337 { 39 | | if 'a' != 'A' { @@ -95,7 +95,7 @@ help: try | } error: this `else { if .. }` block can be collapsed - --> examples/collapsible_if.rs:47:12 + --> collapsible_if.rs:47:12 | 47 | } else { | ____________^ @@ -112,7 +112,7 @@ help: try | } error: this `else { if .. }` block can be collapsed - --> examples/collapsible_if.rs:55:12 + --> collapsible_if.rs:55:12 | 55 | } else { | ____________^ @@ -129,7 +129,7 @@ help: try | } error: this `else { if .. }` block can be collapsed - --> examples/collapsible_if.rs:63:12 + --> collapsible_if.rs:63:12 | 63 | } else { | ____________^ @@ -151,7 +151,7 @@ help: try | } error: this `else { if .. }` block can be collapsed - --> examples/collapsible_if.rs:74:12 + --> collapsible_if.rs:74:12 | 74 | } else { | ____________^ @@ -173,7 +173,7 @@ help: try | } error: this `else { if .. }` block can be collapsed - --> examples/collapsible_if.rs:85:12 + --> collapsible_if.rs:85:12 | 85 | } else { | ____________^ @@ -195,7 +195,7 @@ help: try | } error: this `else { if .. }` block can be collapsed - --> examples/collapsible_if.rs:96:12 + --> collapsible_if.rs:96:12 | 96 | } else { | ____________^ @@ -217,7 +217,7 @@ help: try | } error: this `else { if .. }` block can be collapsed - --> examples/collapsible_if.rs:107:12 + --> collapsible_if.rs:107:12 | 107 | } else { | ____________^ diff --git a/clippy_tests/examples/complex_types.stderr b/clippy_tests/examples/complex_types.stderr index 4fff13a5fa0..bb77b1f21aa 100644 --- a/clippy_tests/examples/complex_types.stderr +++ b/clippy_tests/examples/complex_types.stderr @@ -1,5 +1,5 @@ error: very complex type used. Consider factoring parts into `type` definitions - --> examples/complex_types.rs:9:12 + --> complex_types.rs:9:12 | 9 | const CST: (u32, (u32, (u32, (u32, u32)))) = (0, (0, (0, (0, 0)))); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -7,7 +7,7 @@ error: very complex type used. Consider factoring parts into `type` definitions = note: `-D type-complexity` implied by `-D warnings` error: very complex type used. Consider factoring parts into `type` definitions - --> examples/complex_types.rs:10:12 + --> complex_types.rs:10:12 | 10 | static ST: (u32, (u32, (u32, (u32, u32)))) = (0, (0, (0, (0, 0)))); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -15,7 +15,7 @@ error: very complex type used. Consider factoring parts into `type` definitions = note: `-D type-complexity` implied by `-D warnings` error: very complex type used. Consider factoring parts into `type` definitions - --> examples/complex_types.rs:13:8 + --> complex_types.rs:13:8 | 13 | f: Vec>>, | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -23,7 +23,7 @@ error: very complex type used. Consider factoring parts into `type` definitions = note: `-D type-complexity` implied by `-D warnings` error: very complex type used. Consider factoring parts into `type` definitions - --> examples/complex_types.rs:16:11 + --> complex_types.rs:16:11 | 16 | struct TS(Vec>>); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -31,7 +31,7 @@ error: very complex type used. Consider factoring parts into `type` definitions = note: `-D type-complexity` implied by `-D warnings` error: very complex type used. Consider factoring parts into `type` definitions - --> examples/complex_types.rs:19:11 + --> complex_types.rs:19:11 | 19 | Tuple(Vec>>), | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -39,7 +39,7 @@ error: very complex type used. Consider factoring parts into `type` definitions = note: `-D type-complexity` implied by `-D warnings` error: very complex type used. Consider factoring parts into `type` definitions - --> examples/complex_types.rs:20:17 + --> complex_types.rs:20:17 | 20 | Struct { f: Vec>> }, | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -47,7 +47,7 @@ error: very complex type used. Consider factoring parts into `type` definitions = note: `-D type-complexity` implied by `-D warnings` error: very complex type used. Consider factoring parts into `type` definitions - --> examples/complex_types.rs:24:14 + --> complex_types.rs:24:14 | 24 | const A: (u32, (u32, (u32, (u32, u32)))) = (0, (0, (0, (0, 0)))); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -55,7 +55,7 @@ error: very complex type used. Consider factoring parts into `type` definitions = note: `-D type-complexity` implied by `-D warnings` error: very complex type used. Consider factoring parts into `type` definitions - --> examples/complex_types.rs:25:30 + --> complex_types.rs:25:30 | 25 | fn impl_method(&self, p: Vec>>) { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -63,7 +63,7 @@ error: very complex type used. Consider factoring parts into `type` definitions = note: `-D type-complexity` implied by `-D warnings` error: very complex type used. Consider factoring parts into `type` definitions - --> examples/complex_types.rs:29:14 + --> complex_types.rs:29:14 | 29 | const A: Vec>>; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -71,7 +71,7 @@ error: very complex type used. Consider factoring parts into `type` definitions = note: `-D type-complexity` implied by `-D warnings` error: very complex type used. Consider factoring parts into `type` definitions - --> examples/complex_types.rs:30:14 + --> complex_types.rs:30:14 | 30 | type B = Vec>>; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -79,7 +79,7 @@ error: very complex type used. Consider factoring parts into `type` definitions = note: `-D type-complexity` implied by `-D warnings` error: very complex type used. Consider factoring parts into `type` definitions - --> examples/complex_types.rs:31:25 + --> complex_types.rs:31:25 | 31 | fn method(&self, p: Vec>>); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -87,7 +87,7 @@ error: very complex type used. Consider factoring parts into `type` definitions = note: `-D type-complexity` implied by `-D warnings` error: very complex type used. Consider factoring parts into `type` definitions - --> examples/complex_types.rs:32:29 + --> complex_types.rs:32:29 | 32 | fn def_method(&self, p: Vec>>) { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -95,7 +95,7 @@ error: very complex type used. Consider factoring parts into `type` definitions = note: `-D type-complexity` implied by `-D warnings` error: very complex type used. Consider factoring parts into `type` definitions - --> examples/complex_types.rs:35:15 + --> complex_types.rs:35:15 | 35 | fn test1() -> Vec>> { vec![] } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -103,7 +103,7 @@ error: very complex type used. Consider factoring parts into `type` definitions = note: `-D type-complexity` implied by `-D warnings` error: very complex type used. Consider factoring parts into `type` definitions - --> examples/complex_types.rs:37:14 + --> complex_types.rs:37:14 | 37 | fn test2(_x: Vec>>) { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -111,7 +111,7 @@ error: very complex type used. Consider factoring parts into `type` definitions = note: `-D type-complexity` implied by `-D warnings` error: very complex type used. Consider factoring parts into `type` definitions - --> examples/complex_types.rs:40:13 + --> complex_types.rs:40:13 | 40 | let _y: Vec>> = vec![]; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/clippy_tests/examples/copies.stderr b/clippy_tests/examples/copies.stderr index 3c95940e1a9..69f60a77251 100644 --- a/clippy_tests/examples/copies.stderr +++ b/clippy_tests/examples/copies.stderr @@ -1,6 +1,6 @@ error: This else block is redundant. - --> examples/copies.rs:121:20 + --> copies.rs:121:20 | 121 | } else { | ____________________^ @@ -18,7 +18,7 @@ error: This else block is redundant. error: This else block is redundant. - --> examples/copies.rs:131:20 + --> copies.rs:131:20 | 131 | } else { | ____________________^ diff --git a/clippy_tests/examples/cyclomatic_complexity.stderr b/clippy_tests/examples/cyclomatic_complexity.stderr index dd9adfacdc2..53eb7b0a2c8 100644 --- a/clippy_tests/examples/cyclomatic_complexity.stderr +++ b/clippy_tests/examples/cyclomatic_complexity.stderr @@ -1,5 +1,5 @@ error: the function has a cyclomatic complexity of 28 - --> examples/cyclomatic_complexity.rs:7:1 + --> cyclomatic_complexity.rs:7:1 | 7 | / fn main() { 8 | | if true { @@ -14,7 +14,7 @@ error: the function has a cyclomatic complexity of 28 = help: you could split it up into multiple smaller functions error: the function has a cyclomatic complexity of 7 - --> examples/cyclomatic_complexity.rs:92:1 + --> cyclomatic_complexity.rs:92:1 | 92 | / fn kaboom() { 93 | | let n = 0; @@ -29,7 +29,7 @@ error: the function has a cyclomatic complexity of 7 = help: you could split it up into multiple smaller functions error: the function has a cyclomatic complexity of 1 - --> examples/cyclomatic_complexity.rs:138:1 + --> cyclomatic_complexity.rs:138:1 | 138 | / fn lots_of_short_circuits() -> bool { 139 | | true && false && true && false && true && false && true @@ -40,7 +40,7 @@ error: the function has a cyclomatic complexity of 1 = help: you could split it up into multiple smaller functions error: the function has a cyclomatic complexity of 1 - --> examples/cyclomatic_complexity.rs:143:1 + --> cyclomatic_complexity.rs:143:1 | 143 | / fn lots_of_short_circuits2() -> bool { 144 | | true || false || true || false || true || false || true @@ -51,7 +51,7 @@ error: the function has a cyclomatic complexity of 1 = help: you could split it up into multiple smaller functions error: the function has a cyclomatic complexity of 2 - --> examples/cyclomatic_complexity.rs:148:1 + --> cyclomatic_complexity.rs:148:1 | 148 | / fn baa() { 149 | | let x = || match 99 { @@ -66,7 +66,7 @@ error: the function has a cyclomatic complexity of 2 = help: you could split it up into multiple smaller functions error: the function has a cyclomatic complexity of 2 - --> examples/cyclomatic_complexity.rs:149:13 + --> cyclomatic_complexity.rs:149:13 | 149 | let x = || match 99 { | _____________^ @@ -82,7 +82,7 @@ error: the function has a cyclomatic complexity of 2 = help: you could split it up into multiple smaller functions error: the function has a cyclomatic complexity of 2 - --> examples/cyclomatic_complexity.rs:166:1 + --> cyclomatic_complexity.rs:166:1 | 166 | / fn bar() { 167 | | match 99 { @@ -96,7 +96,7 @@ error: the function has a cyclomatic complexity of 2 = help: you could split it up into multiple smaller functions error: the function has a cyclomatic complexity of 2 - --> examples/cyclomatic_complexity.rs:185:1 + --> cyclomatic_complexity.rs:185:1 | 185 | / fn barr() { 186 | | match 99 { @@ -111,7 +111,7 @@ error: the function has a cyclomatic complexity of 2 = help: you could split it up into multiple smaller functions error: the function has a cyclomatic complexity of 3 - --> examples/cyclomatic_complexity.rs:195:1 + --> cyclomatic_complexity.rs:195:1 | 195 | / fn barr2() { 196 | | match 99 { @@ -126,7 +126,7 @@ error: the function has a cyclomatic complexity of 3 = help: you could split it up into multiple smaller functions error: the function has a cyclomatic complexity of 2 - --> examples/cyclomatic_complexity.rs:211:1 + --> cyclomatic_complexity.rs:211:1 | 211 | / fn barrr() { 212 | | match 99 { @@ -141,7 +141,7 @@ error: the function has a cyclomatic complexity of 2 = help: you could split it up into multiple smaller functions error: the function has a cyclomatic complexity of 3 - --> examples/cyclomatic_complexity.rs:221:1 + --> cyclomatic_complexity.rs:221:1 | 221 | / fn barrr2() { 222 | | match 99 { @@ -156,7 +156,7 @@ error: the function has a cyclomatic complexity of 3 = help: you could split it up into multiple smaller functions error: the function has a cyclomatic complexity of 2 - --> examples/cyclomatic_complexity.rs:237:1 + --> cyclomatic_complexity.rs:237:1 | 237 | / fn barrrr() { 238 | | match 99 { @@ -171,7 +171,7 @@ error: the function has a cyclomatic complexity of 2 = help: you could split it up into multiple smaller functions error: the function has a cyclomatic complexity of 3 - --> examples/cyclomatic_complexity.rs:247:1 + --> cyclomatic_complexity.rs:247:1 | 247 | / fn barrrr2() { 248 | | match 99 { @@ -186,7 +186,7 @@ error: the function has a cyclomatic complexity of 3 = help: you could split it up into multiple smaller functions error: the function has a cyclomatic complexity of 2 - --> examples/cyclomatic_complexity.rs:263:1 + --> cyclomatic_complexity.rs:263:1 | 263 | / fn cake() { 264 | | if 4 == 5 { @@ -201,7 +201,7 @@ error: the function has a cyclomatic complexity of 2 = help: you could split it up into multiple smaller functions error: the function has a cyclomatic complexity of 4 - --> examples/cyclomatic_complexity.rs:274:1 + --> cyclomatic_complexity.rs:274:1 | 274 | / pub fn read_file(input_path: &str) -> String { 275 | | use std::fs::File; @@ -216,7 +216,7 @@ error: the function has a cyclomatic complexity of 4 = help: you could split it up into multiple smaller functions error: the function has a cyclomatic complexity of 1 - --> examples/cyclomatic_complexity.rs:305:1 + --> cyclomatic_complexity.rs:305:1 | 305 | / fn void(void: Void) { 306 | | if true { @@ -230,7 +230,7 @@ error: the function has a cyclomatic complexity of 1 = help: you could split it up into multiple smaller functions error: the function has a cyclomatic complexity of 1 - --> examples/cyclomatic_complexity.rs:319:1 + --> cyclomatic_complexity.rs:319:1 | 319 | / fn try() -> Result { 320 | | match 5 { @@ -244,7 +244,7 @@ error: the function has a cyclomatic complexity of 1 = help: you could split it up into multiple smaller functions error: the function has a cyclomatic complexity of 1 - --> examples/cyclomatic_complexity.rs:327:1 + --> cyclomatic_complexity.rs:327:1 | 327 | / fn try_again() -> Result { 328 | | let _ = try!(Ok(42)); @@ -259,7 +259,7 @@ error: the function has a cyclomatic complexity of 1 = help: you could split it up into multiple smaller functions error: the function has a cyclomatic complexity of 1 - --> examples/cyclomatic_complexity.rs:343:1 + --> cyclomatic_complexity.rs:343:1 | 343 | / fn early() -> Result { 344 | | return Ok(5); @@ -274,7 +274,7 @@ error: the function has a cyclomatic complexity of 1 = help: you could split it up into multiple smaller functions error: the function has a cyclomatic complexity of 8 - --> examples/cyclomatic_complexity.rs:356:1 + --> cyclomatic_complexity.rs:356:1 | 356 | / fn early_ret() -> i32 { 357 | | let a = if true { 42 } else { return 0; }; diff --git a/clippy_tests/examples/cyclomatic_complexity_attr_used.stderr b/clippy_tests/examples/cyclomatic_complexity_attr_used.stderr index 67ed1a9e072..b0650fbd92a 100644 --- a/clippy_tests/examples/cyclomatic_complexity_attr_used.stderr +++ b/clippy_tests/examples/cyclomatic_complexity_attr_used.stderr @@ -1,5 +1,5 @@ error: the function has a cyclomatic complexity of 3 - --> examples/cyclomatic_complexity_attr_used.rs:11:1 + --> cyclomatic_complexity_attr_used.rs:11:1 | 11 | / fn kaboom() { 12 | | if 42 == 43 { diff --git a/clippy_tests/examples/derive.stderr b/clippy_tests/examples/derive.stderr index 079238ef044..8c799343b2b 100644 --- a/clippy_tests/examples/derive.stderr +++ b/clippy_tests/examples/derive.stderr @@ -1,12 +1,12 @@ error: you are deriving `Hash` but have implemented `PartialEq` explicitly - --> examples/derive.rs:17:10 + --> derive.rs:17:10 | 17 | #[derive(Hash)] | ^^^^ | = note: `-D derive-hash-xor-eq` implied by `-D warnings` note: `PartialEq` implemented here - --> examples/derive.rs:20:1 + --> derive.rs:20:1 | 20 | / impl PartialEq for Bar { 21 | | fn eq(&self, _: &Bar) -> bool { true } @@ -14,14 +14,14 @@ note: `PartialEq` implemented here | |_^ error: you are deriving `Hash` but have implemented `PartialEq` explicitly - --> examples/derive.rs:24:10 + --> derive.rs:24:10 | 24 | #[derive(Hash)] | ^^^^ | = note: `-D derive-hash-xor-eq` implied by `-D warnings` note: `PartialEq` implemented here - --> examples/derive.rs:27:1 + --> derive.rs:27:1 | 27 | / impl PartialEq for Baz { 28 | | fn eq(&self, _: &Baz) -> bool { true } @@ -29,7 +29,7 @@ note: `PartialEq` implemented here | |_^ error: you are implementing `Hash` explicitly but have derived `PartialEq` - --> examples/derive.rs:34:1 + --> derive.rs:34:1 | 34 | / impl Hash for Bah { 35 | | fn hash(&self, _: &mut H) {} @@ -38,13 +38,13 @@ error: you are implementing `Hash` explicitly but have derived `PartialEq` | = note: `-D derive-hash-xor-eq` implied by `-D warnings` note: `PartialEq` implemented here - --> examples/derive.rs:31:10 + --> derive.rs:31:10 | 31 | #[derive(PartialEq)] | ^^^^^^^^^ error: you are implementing `Clone` explicitly on a `Copy` type - --> examples/derive.rs:41:1 + --> derive.rs:41:1 | 41 | / impl Clone for Qux { 42 | | fn clone(&self) -> Self { Qux } @@ -53,7 +53,7 @@ error: you are implementing `Clone` explicitly on a `Copy` type | = note: `-D expl-impl-clone-on-copy` implied by `-D warnings` note: consider deriving `Clone` or removing `Copy` - --> examples/derive.rs:41:1 + --> derive.rs:41:1 | 41 | / impl Clone for Qux { 42 | | fn clone(&self) -> Self { Qux } @@ -61,7 +61,7 @@ note: consider deriving `Clone` or removing `Copy` | |_^ error: you are implementing `Clone` explicitly on a `Copy` type - --> examples/derive.rs:65:1 + --> derive.rs:65:1 | 65 | / impl<'a> Clone for Lt<'a> { 66 | | fn clone(&self) -> Self { unimplemented!() } @@ -70,7 +70,7 @@ error: you are implementing `Clone` explicitly on a `Copy` type | = note: `-D expl-impl-clone-on-copy` implied by `-D warnings` note: consider deriving `Clone` or removing `Copy` - --> examples/derive.rs:65:1 + --> derive.rs:65:1 | 65 | / impl<'a> Clone for Lt<'a> { 66 | | fn clone(&self) -> Self { unimplemented!() } diff --git a/clippy_tests/examples/diverging_sub_expression.stderr b/clippy_tests/examples/diverging_sub_expression.stderr index b9d95c4fcba..d957d365e8b 100644 --- a/clippy_tests/examples/diverging_sub_expression.stderr +++ b/clippy_tests/examples/diverging_sub_expression.stderr @@ -1,5 +1,5 @@ error: sub-expression diverges - --> examples/diverging_sub_expression.rs:18:10 + --> diverging_sub_expression.rs:18:10 | 18 | b || diverge(); | ^^^^^^^^^ @@ -7,7 +7,7 @@ error: sub-expression diverges = note: `-D diverging-sub-expression` implied by `-D warnings` error: sub-expression diverges - --> examples/diverging_sub_expression.rs:19:10 + --> diverging_sub_expression.rs:19:10 | 19 | b || A.foo(); | ^^^^^^^ @@ -15,7 +15,7 @@ error: sub-expression diverges = note: `-D diverging-sub-expression` implied by `-D warnings` error: sub-expression diverges - --> examples/diverging_sub_expression.rs:28:26 + --> diverging_sub_expression.rs:28:26 | 28 | 6 => true || return, | ^^^^^^ @@ -23,7 +23,7 @@ error: sub-expression diverges = note: `-D diverging-sub-expression` implied by `-D warnings` error: sub-expression diverges - --> examples/diverging_sub_expression.rs:29:26 + --> diverging_sub_expression.rs:29:26 | 29 | 7 => true || continue, | ^^^^^^^^ @@ -31,7 +31,7 @@ error: sub-expression diverges = note: `-D diverging-sub-expression` implied by `-D warnings` error: sub-expression diverges - --> examples/diverging_sub_expression.rs:32:26 + --> diverging_sub_expression.rs:32:26 | 32 | 3 => true || diverge(), | ^^^^^^^^^ @@ -39,7 +39,7 @@ error: sub-expression diverges = note: `-D diverging-sub-expression` implied by `-D warnings` error: sub-expression diverges - --> examples/diverging_sub_expression.rs:37:26 + --> diverging_sub_expression.rs:37:26 | 37 | _ => true || break, | ^^^^^ diff --git a/clippy_tests/examples/dlist.stderr b/clippy_tests/examples/dlist.stderr index aa524c8eb10..0da1d607dab 100644 --- a/clippy_tests/examples/dlist.stderr +++ b/clippy_tests/examples/dlist.stderr @@ -1,5 +1,5 @@ error: I see you're using a LinkedList! Perhaps you meant some other data structure? - --> examples/dlist.rs:13:16 + --> dlist.rs:13:16 | 13 | type Baz = LinkedList; | ^^^^^^^^^^^^^^ @@ -8,7 +8,7 @@ error: I see you're using a LinkedList! Perhaps you meant some other data struct = help: a VecDeque might work error: I see you're using a LinkedList! Perhaps you meant some other data structure? - --> examples/dlist.rs:14:12 + --> dlist.rs:14:12 | 14 | fn foo(LinkedList); | ^^^^^^^^^^^^^^ @@ -17,7 +17,7 @@ error: I see you're using a LinkedList! Perhaps you meant some other data struct = help: a VecDeque might work error: I see you're using a LinkedList! Perhaps you meant some other data structure? - --> examples/dlist.rs:15:24 + --> dlist.rs:15:24 | 15 | const BAR : Option>; | ^^^^^^^^^^^^^^ @@ -26,7 +26,7 @@ error: I see you're using a LinkedList! Perhaps you meant some other data struct = help: a VecDeque might work error: I see you're using a LinkedList! Perhaps you meant some other data structure? - --> examples/dlist.rs:26:15 + --> dlist.rs:26:15 | 26 | fn foo(_: LinkedList) {} | ^^^^^^^^^^^^^^ @@ -35,7 +35,7 @@ error: I see you're using a LinkedList! Perhaps you meant some other data struct = help: a VecDeque might work error: I see you're using a LinkedList! Perhaps you meant some other data structure? - --> examples/dlist.rs:29:39 + --> dlist.rs:29:39 | 29 | pub fn test(my_favourite_linked_list: LinkedList) { | ^^^^^^^^^^^^^^ @@ -44,7 +44,7 @@ error: I see you're using a LinkedList! Perhaps you meant some other data struct = help: a VecDeque might work error: I see you're using a LinkedList! Perhaps you meant some other data structure? - --> examples/dlist.rs:33:29 + --> dlist.rs:33:29 | 33 | pub fn test_ret() -> Option> { | ^^^^^^^^^^^^^^ diff --git a/clippy_tests/examples/doc.stderr b/clippy_tests/examples/doc.stderr index 84e09860c56..92cce6ee459 100644 --- a/clippy_tests/examples/doc.stderr +++ b/clippy_tests/examples/doc.stderr @@ -1,5 +1,5 @@ error: you should put `DOC_MARKDOWN` between ticks in the documentation - --> examples/doc.rs:1:29 + --> doc.rs:1:29 | 1 | //! This file tests for the DOC_MARKDOWN lint | ^^^^^^^^^^^^ @@ -7,7 +7,7 @@ error: you should put `DOC_MARKDOWN` between ticks in the documentation = note: `-D doc-markdown` implied by `-D warnings` error: you should put `foo_bar` between ticks in the documentation - --> examples/doc.rs:8:9 + --> doc.rs:8:9 | 8 | /// The foo_bar function does _nothing_. See also foo::bar. (note the dot there) | ^^^^^^^ @@ -15,7 +15,7 @@ error: you should put `foo_bar` between ticks in the documentation = note: `-D doc-markdown` implied by `-D warnings` error: you should put `foo::bar` between ticks in the documentation - --> examples/doc.rs:8:51 + --> doc.rs:8:51 | 8 | /// The foo_bar function does _nothing_. See also foo::bar. (note the dot there) | ^^^^^^^^ @@ -23,7 +23,7 @@ error: you should put `foo::bar` between ticks in the documentation = note: `-D doc-markdown` implied by `-D warnings` error: you should put `Foo::some_fun` between ticks in the documentation - --> examples/doc.rs:9:84 + --> doc.rs:9:84 | 9 | /// Markdown is _weird_. I mean _really weird_. This \_ is ok. So is `_`. But not Foo::some_fun | ^^^^^^^^^^^^^ @@ -31,7 +31,7 @@ error: you should put `Foo::some_fun` between ticks in the documentation = note: `-D doc-markdown` implied by `-D warnings` error: you should put `is::a::global:path` between ticks in the documentation - --> examples/doc.rs:11:13 + --> doc.rs:11:13 | 11 | /// Here be ::is::a::global:path. | ^^^^^^^^^^^^^^^^^^^^ @@ -39,7 +39,7 @@ error: you should put `is::a::global:path` between ticks in the documentation = note: `-D doc-markdown` implied by `-D warnings` error: you should put `NotInCodeBlock` between ticks in the documentation - --> examples/doc.rs:12:21 + --> doc.rs:12:21 | 12 | /// That's not code ~NotInCodeBlock~. | ^^^^^^^^^^^^^^^ @@ -47,7 +47,7 @@ error: you should put `NotInCodeBlock` between ticks in the documentation = note: `-D doc-markdown` implied by `-D warnings` error: you should put `be_sure_we_got_to_the_end_of_it` between ticks in the documentation - --> examples/doc.rs:13:5 + --> doc.rs:13:5 | 13 | /// be_sure_we_got_to_the_end_of_it | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -55,7 +55,7 @@ error: you should put `be_sure_we_got_to_the_end_of_it` between ticks in the doc = note: `-D doc-markdown` implied by `-D warnings` error: you should put `be_sure_we_got_to_the_end_of_it` between ticks in the documentation - --> examples/doc.rs:27:5 + --> doc.rs:27:5 | 27 | /// be_sure_we_got_to_the_end_of_it | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -63,7 +63,7 @@ error: you should put `be_sure_we_got_to_the_end_of_it` between ticks in the doc = note: `-D doc-markdown` implied by `-D warnings` error: you should put `be_sure_we_got_to_the_end_of_it` between ticks in the documentation - --> examples/doc.rs:34:5 + --> doc.rs:34:5 | 34 | /// be_sure_we_got_to_the_end_of_it | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -71,7 +71,7 @@ error: you should put `be_sure_we_got_to_the_end_of_it` between ticks in the doc = note: `-D doc-markdown` implied by `-D warnings` error: you should put `be_sure_we_got_to_the_end_of_it` between ticks in the documentation - --> examples/doc.rs:48:5 + --> doc.rs:48:5 | 48 | /// be_sure_we_got_to_the_end_of_it | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -79,7 +79,7 @@ error: you should put `be_sure_we_got_to_the_end_of_it` between ticks in the doc = note: `-D doc-markdown` implied by `-D warnings` error: you should put `ß_foo` between ticks in the documentation - --> examples/doc.rs:57:5 + --> doc.rs:57:5 | 57 | /// ß_foo | ^^^^^ @@ -87,7 +87,7 @@ error: you should put `ß_foo` between ticks in the documentation = note: `-D doc-markdown` implied by `-D warnings` error: you should put `ℝ_foo` between ticks in the documentation - --> examples/doc.rs:58:5 + --> doc.rs:58:5 | 58 | /// ℝ_foo | ^^^^^ @@ -95,7 +95,7 @@ error: you should put `ℝ_foo` between ticks in the documentation = note: `-D doc-markdown` implied by `-D warnings` error: you should put `foo_ß` between ticks in the documentation - --> examples/doc.rs:61:5 + --> doc.rs:61:5 | 61 | /// foo_ß | ^^^^^ @@ -103,7 +103,7 @@ error: you should put `foo_ß` between ticks in the documentation = note: `-D doc-markdown` implied by `-D warnings` error: you should put `foo_ℝ` between ticks in the documentation - --> examples/doc.rs:62:5 + --> doc.rs:62:5 | 62 | /// foo_ℝ | ^^^^^ @@ -111,7 +111,7 @@ error: you should put `foo_ℝ` between ticks in the documentation = note: `-D doc-markdown` implied by `-D warnings` error: you should put `be_sure_we_got_to_the_end_of_it` between ticks in the documentation - --> examples/doc.rs:77:5 + --> doc.rs:77:5 | 77 | /// be_sure_we_got_to_the_end_of_it | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -119,7 +119,7 @@ error: you should put `be_sure_we_got_to_the_end_of_it` between ticks in the doc = note: `-D doc-markdown` implied by `-D warnings` error: you should put `link_with_underscores` between ticks in the documentation - --> examples/doc.rs:81:22 + --> doc.rs:81:22 | 81 | /// This test has [a link_with_underscores][chunked-example] inside it. See #823. | ^^^^^^^^^^^^^^^^^^^^^ @@ -127,7 +127,7 @@ error: you should put `link_with_underscores` between ticks in the documentation = note: `-D doc-markdown` implied by `-D warnings` error: you should put `inline_link2` between ticks in the documentation - --> examples/doc.rs:84:21 + --> doc.rs:84:21 | 84 | /// It can also be [inline_link2]. | ^^^^^^^^^^^^ @@ -135,7 +135,7 @@ error: you should put `inline_link2` between ticks in the documentation = note: `-D doc-markdown` implied by `-D warnings` error: you should put `be_sure_we_got_to_the_end_of_it` between ticks in the documentation - --> examples/doc.rs:94:5 + --> doc.rs:94:5 | 94 | /// be_sure_we_got_to_the_end_of_it | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -143,7 +143,7 @@ error: you should put `be_sure_we_got_to_the_end_of_it` between ticks in the doc = note: `-D doc-markdown` implied by `-D warnings` error: you should put `CamelCaseThing` between ticks in the documentation - --> examples/doc.rs:107:22 + --> doc.rs:107:22 | 107 | /// Not a title #897 CamelCaseThing | ^^^^^^^^^^^^^^ @@ -151,7 +151,7 @@ error: you should put `CamelCaseThing` between ticks in the documentation = note: `-D doc-markdown` implied by `-D warnings` error: you should put `be_sure_we_got_to_the_end_of_it` between ticks in the documentation - --> examples/doc.rs:108:5 + --> doc.rs:108:5 | 108 | /// be_sure_we_got_to_the_end_of_it | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -159,7 +159,7 @@ error: you should put `be_sure_we_got_to_the_end_of_it` between ticks in the doc = note: `-D doc-markdown` implied by `-D warnings` error: you should put `be_sure_we_got_to_the_end_of_it` between ticks in the documentation - --> examples/doc.rs:115:5 + --> doc.rs:115:5 | 115 | /// be_sure_we_got_to_the_end_of_it | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -167,7 +167,7 @@ error: you should put `be_sure_we_got_to_the_end_of_it` between ticks in the doc = note: `-D doc-markdown` implied by `-D warnings` error: you should put `be_sure_we_got_to_the_end_of_it` between ticks in the documentation - --> examples/doc.rs:128:5 + --> doc.rs:128:5 | 128 | /// be_sure_we_got_to_the_end_of_it | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -175,7 +175,7 @@ error: you should put `be_sure_we_got_to_the_end_of_it` between ticks in the doc = note: `-D doc-markdown` implied by `-D warnings` error: you should put `FooBar` between ticks in the documentation - --> examples/doc.rs:139:42 + --> doc.rs:139:42 | 139 | /** E.g. serialization of an empty list: FooBar | ^^^^^^ @@ -183,7 +183,7 @@ error: you should put `FooBar` between ticks in the documentation = note: `-D doc-markdown` implied by `-D warnings` error: you should put `BarQuz` between ticks in the documentation - --> examples/doc.rs:144:5 + --> doc.rs:144:5 | 144 | And BarQuz too. | ^^^^^^ @@ -191,7 +191,7 @@ error: you should put `BarQuz` between ticks in the documentation = note: `-D doc-markdown` implied by `-D warnings` error: you should put `be_sure_we_got_to_the_end_of_it` between ticks in the documentation - --> examples/doc.rs:145:1 + --> doc.rs:145:1 | 145 | be_sure_we_got_to_the_end_of_it | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -199,7 +199,7 @@ error: you should put `be_sure_we_got_to_the_end_of_it` between ticks in the doc = note: `-D doc-markdown` implied by `-D warnings` error: you should put `FooBar` between ticks in the documentation - --> examples/doc.rs:150:42 + --> doc.rs:150:42 | 150 | /** E.g. serialization of an empty list: FooBar | ^^^^^^ @@ -207,7 +207,7 @@ error: you should put `FooBar` between ticks in the documentation = note: `-D doc-markdown` implied by `-D warnings` error: you should put `BarQuz` between ticks in the documentation - --> examples/doc.rs:155:5 + --> doc.rs:155:5 | 155 | And BarQuz too. | ^^^^^^ @@ -215,7 +215,7 @@ error: you should put `BarQuz` between ticks in the documentation = note: `-D doc-markdown` implied by `-D warnings` error: you should put `be_sure_we_got_to_the_end_of_it` between ticks in the documentation - --> examples/doc.rs:156:1 + --> doc.rs:156:1 | 156 | be_sure_we_got_to_the_end_of_it | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -223,7 +223,7 @@ error: you should put `be_sure_we_got_to_the_end_of_it` between ticks in the doc = note: `-D doc-markdown` implied by `-D warnings` error: you should put `be_sure_we_got_to_the_end_of_it` between ticks in the documentation - --> examples/doc.rs:167:5 + --> doc.rs:167:5 | 167 | /// be_sure_we_got_to_the_end_of_it | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/clippy_tests/examples/double_neg.stderr b/clippy_tests/examples/double_neg.stderr index 56289b2c4bc..fe0ff3680a5 100644 --- a/clippy_tests/examples/double_neg.stderr +++ b/clippy_tests/examples/double_neg.stderr @@ -1,5 +1,5 @@ error: `--x` could be misinterpreted as pre-decrement by C programmers, is usually a no-op - --> examples/double_neg.rs:9:5 + --> double_neg.rs:9:5 | 9 | --x; | ^^^ diff --git a/clippy_tests/examples/double_parens.stderr b/clippy_tests/examples/double_parens.stderr index c4171026274..bacbeaac476 100644 --- a/clippy_tests/examples/double_parens.stderr +++ b/clippy_tests/examples/double_parens.stderr @@ -1,5 +1,5 @@ error: Consider removing unnecessary double parentheses - --> examples/double_parens.rs:16:5 + --> double_parens.rs:16:5 | 16 | ((0)) | ^^^^^ @@ -7,7 +7,7 @@ error: Consider removing unnecessary double parentheses = note: `-D double-parens` implied by `-D warnings` error: Consider removing unnecessary double parentheses - --> examples/double_parens.rs:20:14 + --> double_parens.rs:20:14 | 20 | dummy_fn((0)); | ^^^ @@ -15,7 +15,7 @@ error: Consider removing unnecessary double parentheses = note: `-D double-parens` implied by `-D warnings` error: Consider removing unnecessary double parentheses - --> examples/double_parens.rs:24:20 + --> double_parens.rs:24:20 | 24 | x.dummy_method((0)); | ^^^ @@ -23,7 +23,7 @@ error: Consider removing unnecessary double parentheses = note: `-D double-parens` implied by `-D warnings` error: Consider removing unnecessary double parentheses - --> examples/double_parens.rs:28:5 + --> double_parens.rs:28:5 | 28 | ((1, 2)) | ^^^^^^^^ @@ -31,7 +31,7 @@ error: Consider removing unnecessary double parentheses = note: `-D double-parens` implied by `-D warnings` error: Consider removing unnecessary double parentheses - --> examples/double_parens.rs:32:5 + --> double_parens.rs:32:5 | 32 | (()) | ^^^^ diff --git a/clippy_tests/examples/drop_forget_copy.stderr b/clippy_tests/examples/drop_forget_copy.stderr index 048eee2b567..8309d9aee2f 100644 --- a/clippy_tests/examples/drop_forget_copy.stderr +++ b/clippy_tests/examples/drop_forget_copy.stderr @@ -1,77 +1,77 @@ error: calls to `std::mem::drop` with a value that implements Copy. Dropping a copy leaves the original intact. - --> examples/drop_forget_copy.rs:33:5 + --> drop_forget_copy.rs:33:5 | 33 | drop(s1); | ^^^^^^^^ | = note: `-D drop-copy` implied by `-D warnings` note: argument has type SomeStruct - --> examples/drop_forget_copy.rs:33:10 + --> drop_forget_copy.rs:33:10 | 33 | drop(s1); | ^^ error: calls to `std::mem::drop` with a value that implements Copy. Dropping a copy leaves the original intact. - --> examples/drop_forget_copy.rs:34:5 + --> drop_forget_copy.rs:34:5 | 34 | drop(s2); | ^^^^^^^^ | = note: `-D drop-copy` implied by `-D warnings` note: argument has type SomeStruct - --> examples/drop_forget_copy.rs:34:10 + --> drop_forget_copy.rs:34:10 | 34 | drop(s2); | ^^ error: calls to `std::mem::drop` with a value that implements Copy. Dropping a copy leaves the original intact. - --> examples/drop_forget_copy.rs:36:5 + --> drop_forget_copy.rs:36:5 | 36 | drop(s4); | ^^^^^^^^ | = note: `-D drop-copy` implied by `-D warnings` note: argument has type SomeStruct - --> examples/drop_forget_copy.rs:36:10 + --> drop_forget_copy.rs:36:10 | 36 | drop(s4); | ^^ error: calls to `std::mem::forget` with a value that implements Copy. Forgetting a copy leaves the original intact. - --> examples/drop_forget_copy.rs:39:5 + --> drop_forget_copy.rs:39:5 | 39 | forget(s1); | ^^^^^^^^^^ | = note: `-D forget-copy` implied by `-D warnings` note: argument has type SomeStruct - --> examples/drop_forget_copy.rs:39:12 + --> drop_forget_copy.rs:39:12 | 39 | forget(s1); | ^^ error: calls to `std::mem::forget` with a value that implements Copy. Forgetting a copy leaves the original intact. - --> examples/drop_forget_copy.rs:40:5 + --> drop_forget_copy.rs:40:5 | 40 | forget(s2); | ^^^^^^^^^^ | = note: `-D forget-copy` implied by `-D warnings` note: argument has type SomeStruct - --> examples/drop_forget_copy.rs:40:12 + --> drop_forget_copy.rs:40:12 | 40 | forget(s2); | ^^ error: calls to `std::mem::forget` with a value that implements Copy. Forgetting a copy leaves the original intact. - --> examples/drop_forget_copy.rs:42:5 + --> drop_forget_copy.rs:42:5 | 42 | forget(s4); | ^^^^^^^^^^ | = note: `-D forget-copy` implied by `-D warnings` note: argument has type SomeStruct - --> examples/drop_forget_copy.rs:42:12 + --> drop_forget_copy.rs:42:12 | 42 | forget(s4); | ^^ diff --git a/clippy_tests/examples/drop_forget_ref.stderr b/clippy_tests/examples/drop_forget_ref.stderr index 0bb49c0f0a9..47cd9a9a903 100644 --- a/clippy_tests/examples/drop_forget_ref.stderr +++ b/clippy_tests/examples/drop_forget_ref.stderr @@ -1,233 +1,233 @@ error: calls to `std::mem::drop` with a reference instead of an owned value. Dropping a reference does nothing. - --> examples/drop_forget_ref.rs:12:5 + --> drop_forget_ref.rs:12:5 | 12 | drop(&SomeStruct); | ^^^^^^^^^^^^^^^^^ | = note: `-D drop-ref` implied by `-D warnings` note: argument has type &SomeStruct - --> examples/drop_forget_ref.rs:12:10 + --> drop_forget_ref.rs:12:10 | 12 | drop(&SomeStruct); | ^^^^^^^^^^^ error: calls to `std::mem::forget` with a reference instead of an owned value. Forgetting a reference does nothing. - --> examples/drop_forget_ref.rs:13:5 + --> drop_forget_ref.rs:13:5 | 13 | forget(&SomeStruct); | ^^^^^^^^^^^^^^^^^^^ | = note: `-D forget-ref` implied by `-D warnings` note: argument has type &SomeStruct - --> examples/drop_forget_ref.rs:13:12 + --> drop_forget_ref.rs:13:12 | 13 | forget(&SomeStruct); | ^^^^^^^^^^^ error: calls to `std::mem::drop` with a reference instead of an owned value. Dropping a reference does nothing. - --> examples/drop_forget_ref.rs:16:5 + --> drop_forget_ref.rs:16:5 | 16 | drop(&owned1); | ^^^^^^^^^^^^^ | = note: `-D drop-ref` implied by `-D warnings` note: argument has type &SomeStruct - --> examples/drop_forget_ref.rs:16:10 + --> drop_forget_ref.rs:16:10 | 16 | drop(&owned1); | ^^^^^^^ error: calls to `std::mem::drop` with a reference instead of an owned value. Dropping a reference does nothing. - --> examples/drop_forget_ref.rs:17:5 + --> drop_forget_ref.rs:17:5 | 17 | drop(&&owned1); | ^^^^^^^^^^^^^^ | = note: `-D drop-ref` implied by `-D warnings` note: argument has type &&SomeStruct - --> examples/drop_forget_ref.rs:17:10 + --> drop_forget_ref.rs:17:10 | 17 | drop(&&owned1); | ^^^^^^^^ error: calls to `std::mem::drop` with a reference instead of an owned value. Dropping a reference does nothing. - --> examples/drop_forget_ref.rs:18:5 + --> drop_forget_ref.rs:18:5 | 18 | drop(&mut owned1); | ^^^^^^^^^^^^^^^^^ | = note: `-D drop-ref` implied by `-D warnings` note: argument has type &mut SomeStruct - --> examples/drop_forget_ref.rs:18:10 + --> drop_forget_ref.rs:18:10 | 18 | drop(&mut owned1); | ^^^^^^^^^^^ error: calls to `std::mem::forget` with a reference instead of an owned value. Forgetting a reference does nothing. - --> examples/drop_forget_ref.rs:21:5 + --> drop_forget_ref.rs:21:5 | 21 | forget(&owned2); | ^^^^^^^^^^^^^^^ | = note: `-D forget-ref` implied by `-D warnings` note: argument has type &SomeStruct - --> examples/drop_forget_ref.rs:21:12 + --> drop_forget_ref.rs:21:12 | 21 | forget(&owned2); | ^^^^^^^ error: calls to `std::mem::forget` with a reference instead of an owned value. Forgetting a reference does nothing. - --> examples/drop_forget_ref.rs:22:5 + --> drop_forget_ref.rs:22:5 | 22 | forget(&&owned2); | ^^^^^^^^^^^^^^^^ | = note: `-D forget-ref` implied by `-D warnings` note: argument has type &&SomeStruct - --> examples/drop_forget_ref.rs:22:12 + --> drop_forget_ref.rs:22:12 | 22 | forget(&&owned2); | ^^^^^^^^ error: calls to `std::mem::forget` with a reference instead of an owned value. Forgetting a reference does nothing. - --> examples/drop_forget_ref.rs:23:5 + --> drop_forget_ref.rs:23:5 | 23 | forget(&mut owned2); | ^^^^^^^^^^^^^^^^^^^ | = note: `-D forget-ref` implied by `-D warnings` note: argument has type &mut SomeStruct - --> examples/drop_forget_ref.rs:23:12 + --> drop_forget_ref.rs:23:12 | 23 | forget(&mut owned2); | ^^^^^^^^^^^ error: calls to `std::mem::drop` with a reference instead of an owned value. Dropping a reference does nothing. - --> examples/drop_forget_ref.rs:27:5 + --> drop_forget_ref.rs:27:5 | 27 | drop(reference1); | ^^^^^^^^^^^^^^^^ | = note: `-D drop-ref` implied by `-D warnings` note: argument has type &SomeStruct - --> examples/drop_forget_ref.rs:27:10 + --> drop_forget_ref.rs:27:10 | 27 | drop(reference1); | ^^^^^^^^^^ error: calls to `std::mem::forget` with a reference instead of an owned value. Forgetting a reference does nothing. - --> examples/drop_forget_ref.rs:28:5 + --> drop_forget_ref.rs:28:5 | 28 | forget(&*reference1); | ^^^^^^^^^^^^^^^^^^^^ | = note: `-D forget-ref` implied by `-D warnings` note: argument has type &SomeStruct - --> examples/drop_forget_ref.rs:28:12 + --> drop_forget_ref.rs:28:12 | 28 | forget(&*reference1); | ^^^^^^^^^^^^ error: calls to `std::mem::drop` with a reference instead of an owned value. Dropping a reference does nothing. - --> examples/drop_forget_ref.rs:31:5 + --> drop_forget_ref.rs:31:5 | 31 | drop(reference2); | ^^^^^^^^^^^^^^^^ | = note: `-D drop-ref` implied by `-D warnings` note: argument has type &mut SomeStruct - --> examples/drop_forget_ref.rs:31:10 + --> drop_forget_ref.rs:31:10 | 31 | drop(reference2); | ^^^^^^^^^^ error: calls to `std::mem::forget` with a reference instead of an owned value. Forgetting a reference does nothing. - --> examples/drop_forget_ref.rs:33:5 + --> drop_forget_ref.rs:33:5 | 33 | forget(reference3); | ^^^^^^^^^^^^^^^^^^ | = note: `-D forget-ref` implied by `-D warnings` note: argument has type &mut SomeStruct - --> examples/drop_forget_ref.rs:33:12 + --> drop_forget_ref.rs:33:12 | 33 | forget(reference3); | ^^^^^^^^^^ error: calls to `std::mem::drop` with a reference instead of an owned value. Dropping a reference does nothing. - --> examples/drop_forget_ref.rs:36:5 + --> drop_forget_ref.rs:36:5 | 36 | drop(reference4); | ^^^^^^^^^^^^^^^^ | = note: `-D drop-ref` implied by `-D warnings` note: argument has type &SomeStruct - --> examples/drop_forget_ref.rs:36:10 + --> drop_forget_ref.rs:36:10 | 36 | drop(reference4); | ^^^^^^^^^^ error: calls to `std::mem::forget` with a reference instead of an owned value. Forgetting a reference does nothing. - --> examples/drop_forget_ref.rs:37:5 + --> drop_forget_ref.rs:37:5 | 37 | forget(reference4); | ^^^^^^^^^^^^^^^^^^ | = note: `-D forget-ref` implied by `-D warnings` note: argument has type &SomeStruct - --> examples/drop_forget_ref.rs:37:12 + --> drop_forget_ref.rs:37:12 | 37 | forget(reference4); | ^^^^^^^^^^ error: calls to `std::mem::drop` with a reference instead of an owned value. Dropping a reference does nothing. - --> examples/drop_forget_ref.rs:42:5 + --> drop_forget_ref.rs:42:5 | 42 | drop(&val); | ^^^^^^^^^^ | = note: `-D drop-ref` implied by `-D warnings` note: argument has type &T - --> examples/drop_forget_ref.rs:42:10 + --> drop_forget_ref.rs:42:10 | 42 | drop(&val); | ^^^^ error: calls to `std::mem::forget` with a reference instead of an owned value. Forgetting a reference does nothing. - --> examples/drop_forget_ref.rs:48:5 + --> drop_forget_ref.rs:48:5 | 48 | forget(&val); | ^^^^^^^^^^^^ | = note: `-D forget-ref` implied by `-D warnings` note: argument has type &T - --> examples/drop_forget_ref.rs:48:12 + --> drop_forget_ref.rs:48:12 | 48 | forget(&val); | ^^^^ error: calls to `std::mem::drop` with a reference instead of an owned value. Dropping a reference does nothing. - --> examples/drop_forget_ref.rs:56:5 + --> drop_forget_ref.rs:56:5 | 56 | std::mem::drop(&SomeStruct); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D drop-ref` implied by `-D warnings` note: argument has type &SomeStruct - --> examples/drop_forget_ref.rs:56:20 + --> drop_forget_ref.rs:56:20 | 56 | std::mem::drop(&SomeStruct); | ^^^^^^^^^^^ error: calls to `std::mem::forget` with a reference instead of an owned value. Forgetting a reference does nothing. - --> examples/drop_forget_ref.rs:59:5 + --> drop_forget_ref.rs:59:5 | 59 | std::mem::forget(&SomeStruct); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D forget-ref` implied by `-D warnings` note: argument has type &SomeStruct - --> examples/drop_forget_ref.rs:59:22 + --> drop_forget_ref.rs:59:22 | 59 | std::mem::forget(&SomeStruct); | ^^^^^^^^^^^ diff --git a/clippy_tests/examples/duplicate_underscore_argument.stderr b/clippy_tests/examples/duplicate_underscore_argument.stderr index 0e08c65a5a3..b6d710cc854 100644 --- a/clippy_tests/examples/duplicate_underscore_argument.stderr +++ b/clippy_tests/examples/duplicate_underscore_argument.stderr @@ -1,5 +1,5 @@ error: `darth` already exists, having another argument having almost the same name makes code comprehension and documentation more difficult - --> examples/duplicate_underscore_argument.rs:7:23 + --> duplicate_underscore_argument.rs:7:23 | 7 | fn join_the_dark_side(darth: i32, _darth: i32) {} | ^^^^^ diff --git a/clippy_tests/examples/empty_enum.stderr b/clippy_tests/examples/empty_enum.stderr index c439a26ef4a..64a9d54986d 100644 --- a/clippy_tests/examples/empty_enum.stderr +++ b/clippy_tests/examples/empty_enum.stderr @@ -1,12 +1,12 @@ error: enum with no variants - --> examples/empty_enum.rs:7:1 + --> empty_enum.rs:7:1 | 7 | enum Empty {} | ^^^^^^^^^^^^^ | = note: `-D empty-enum` implied by `-D warnings` help: consider using the uninhabited type `!` or a wrapper around it - --> examples/empty_enum.rs:7:1 + --> empty_enum.rs:7:1 | 7 | enum Empty {} | ^^^^^^^^^^^^^ diff --git a/clippy_tests/examples/entry.stderr b/clippy_tests/examples/entry.stderr index 2f61611efdb..8b26a80ff90 100644 --- a/clippy_tests/examples/entry.stderr +++ b/clippy_tests/examples/entry.stderr @@ -1,5 +1,5 @@ error: usage of `contains_key` followed by `insert` on a `HashMap` - --> examples/entry.rs:13:5 + --> entry.rs:13:5 | 13 | if !m.contains_key(&k) { m.insert(k, v); } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `m.entry(k).or_insert(v)` @@ -7,7 +7,7 @@ error: usage of `contains_key` followed by `insert` on a `HashMap` = note: `-D map-entry` implied by `-D warnings` error: usage of `contains_key` followed by `insert` on a `HashMap` - --> examples/entry.rs:17:5 + --> entry.rs:17:5 | 17 | if !m.contains_key(&k) { foo(); m.insert(k, v); } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `m.entry(k)` @@ -15,7 +15,7 @@ error: usage of `contains_key` followed by `insert` on a `HashMap` = note: `-D map-entry` implied by `-D warnings` error: usage of `contains_key` followed by `insert` on a `HashMap` - --> examples/entry.rs:21:5 + --> entry.rs:21:5 | 21 | if !m.contains_key(&k) { m.insert(k, v) } else { None }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `m.entry(k)` @@ -23,7 +23,7 @@ error: usage of `contains_key` followed by `insert` on a `HashMap` = note: `-D map-entry` implied by `-D warnings` error: usage of `contains_key` followed by `insert` on a `HashMap` - --> examples/entry.rs:25:5 + --> entry.rs:25:5 | 25 | if m.contains_key(&k) { None } else { m.insert(k, v) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `m.entry(k)` @@ -31,7 +31,7 @@ error: usage of `contains_key` followed by `insert` on a `HashMap` = note: `-D map-entry` implied by `-D warnings` error: usage of `contains_key` followed by `insert` on a `HashMap` - --> examples/entry.rs:29:5 + --> entry.rs:29:5 | 29 | if !m.contains_key(&k) { foo(); m.insert(k, v) } else { None }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `m.entry(k)` @@ -39,7 +39,7 @@ error: usage of `contains_key` followed by `insert` on a `HashMap` = note: `-D map-entry` implied by `-D warnings` error: usage of `contains_key` followed by `insert` on a `HashMap` - --> examples/entry.rs:33:5 + --> entry.rs:33:5 | 33 | if m.contains_key(&k) { None } else { foo(); m.insert(k, v) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `m.entry(k)` @@ -47,7 +47,7 @@ error: usage of `contains_key` followed by `insert` on a `HashMap` = note: `-D map-entry` implied by `-D warnings` error: usage of `contains_key` followed by `insert` on a `BTreeMap` - --> examples/entry.rs:37:5 + --> entry.rs:37:5 | 37 | if !m.contains_key(&k) { foo(); m.insert(k, v) } else { None }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `m.entry(k)` diff --git a/clippy_tests/examples/enum_glob_use.stderr b/clippy_tests/examples/enum_glob_use.stderr index df21b86bb52..47535fe574d 100644 --- a/clippy_tests/examples/enum_glob_use.stderr +++ b/clippy_tests/examples/enum_glob_use.stderr @@ -1,5 +1,5 @@ error: don't use glob imports for enum variants - --> examples/enum_glob_use.rs:6:1 + --> enum_glob_use.rs:6:1 | 6 | use std::cmp::Ordering::*; | ^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -7,7 +7,7 @@ error: don't use glob imports for enum variants = note: `-D enum-glob-use` implied by `-D warnings` error: don't use glob imports for enum variants - --> examples/enum_glob_use.rs:12:1 + --> enum_glob_use.rs:12:1 | 12 | use self::Enum::*; | ^^^^^^^^^^^^^^^^^^ diff --git a/clippy_tests/examples/enum_variants.stderr b/clippy_tests/examples/enum_variants.stderr index 0bdd2113469..0b8dd1ba7d8 100644 --- a/clippy_tests/examples/enum_variants.stderr +++ b/clippy_tests/examples/enum_variants.stderr @@ -1,5 +1,5 @@ error: Variant name ends with the enum's name - --> examples/enum_variants.rs:14:5 + --> enum_variants.rs:14:5 | 14 | cFoo, | ^^^^ @@ -7,7 +7,7 @@ error: Variant name ends with the enum's name = note: `-D enum-variant-names` implied by `-D warnings` error: Variant name starts with the enum's name - --> examples/enum_variants.rs:25:5 + --> enum_variants.rs:25:5 | 25 | FoodGood, | ^^^^^^^^ @@ -15,7 +15,7 @@ error: Variant name starts with the enum's name = note: `-D enum-variant-names` implied by `-D warnings` error: Variant name starts with the enum's name - --> examples/enum_variants.rs:26:5 + --> enum_variants.rs:26:5 | 26 | FoodMiddle, | ^^^^^^^^^^ @@ -23,7 +23,7 @@ error: Variant name starts with the enum's name = note: `-D enum-variant-names` implied by `-D warnings` error: Variant name starts with the enum's name - --> examples/enum_variants.rs:27:5 + --> enum_variants.rs:27:5 | 27 | FoodBad, | ^^^^^^^ @@ -31,7 +31,7 @@ error: Variant name starts with the enum's name = note: `-D enum-variant-names` implied by `-D warnings` error: All variants have the same prefix: `Food` - --> examples/enum_variants.rs:24:1 + --> enum_variants.rs:24:1 | 24 | / enum Food { 25 | | FoodGood, @@ -44,7 +44,7 @@ error: All variants have the same prefix: `Food` = help: remove the prefixes and use full paths to the variants instead of glob imports error: All variants have the same prefix: `CallType` - --> examples/enum_variants.rs:34:1 + --> enum_variants.rs:34:1 | 34 | / enum BadCallType { 35 | | CallTypeCall, @@ -57,7 +57,7 @@ error: All variants have the same prefix: `CallType` = help: remove the prefixes and use full paths to the variants instead of glob imports error: All variants have the same prefix: `Constant` - --> examples/enum_variants.rs:45:1 + --> enum_variants.rs:45:1 | 45 | / enum Consts { 46 | | ConstantInt, @@ -70,7 +70,7 @@ error: All variants have the same prefix: `Constant` = help: remove the prefixes and use full paths to the variants instead of glob imports error: All variants have the same prefix: `With` - --> examples/enum_variants.rs:78:1 + --> enum_variants.rs:78:1 | 78 | / enum Seallll { 79 | | WithOutCake, @@ -83,7 +83,7 @@ error: All variants have the same prefix: `With` = help: remove the prefixes and use full paths to the variants instead of glob imports error: All variants have the same prefix: `Prefix` - --> examples/enum_variants.rs:84:1 + --> enum_variants.rs:84:1 | 84 | / enum NonCaps { 85 | | Prefix的, @@ -96,7 +96,7 @@ error: All variants have the same prefix: `Prefix` = help: remove the prefixes and use full paths to the variants instead of glob imports error: All variants have the same prefix: `With` - --> examples/enum_variants.rs:90:1 + --> enum_variants.rs:90:1 | 90 | / pub enum PubSeall { 91 | | WithOutCake, diff --git a/clippy_tests/examples/enums_clike.stderr b/clippy_tests/examples/enums_clike.stderr index 868fd810653..51fa29d74aa 100644 --- a/clippy_tests/examples/enums_clike.stderr +++ b/clippy_tests/examples/enums_clike.stderr @@ -1,5 +1,5 @@ error: Clike enum variant discriminant is not portable to 32-bit targets - --> examples/enums_clike.rs:10:5 + --> enums_clike.rs:10:5 | 10 | X = 0x1_0000_0000, | ^^^^^^^^^^^^^^^^^ @@ -7,7 +7,7 @@ error: Clike enum variant discriminant is not portable to 32-bit targets = note: `-D enum-clike-unportable-variant` implied by `-D warnings` error: Clike enum variant discriminant is not portable to 32-bit targets - --> examples/enums_clike.rs:17:5 + --> enums_clike.rs:17:5 | 17 | X = 0x1_0000_0000, | ^^^^^^^^^^^^^^^^^ @@ -15,7 +15,7 @@ error: Clike enum variant discriminant is not portable to 32-bit targets = note: `-D enum-clike-unportable-variant` implied by `-D warnings` error: Clike enum variant discriminant is not portable to 32-bit targets - --> examples/enums_clike.rs:20:5 + --> enums_clike.rs:20:5 | 20 | A = 0xFFFF_FFFF, | ^^^^^^^^^^^^^^^ @@ -23,7 +23,7 @@ error: Clike enum variant discriminant is not portable to 32-bit targets = note: `-D enum-clike-unportable-variant` implied by `-D warnings` error: Clike enum variant discriminant is not portable to 32-bit targets - --> examples/enums_clike.rs:27:5 + --> enums_clike.rs:27:5 | 27 | Z = 0xFFFF_FFFF, | ^^^^^^^^^^^^^^^ @@ -31,7 +31,7 @@ error: Clike enum variant discriminant is not portable to 32-bit targets = note: `-D enum-clike-unportable-variant` implied by `-D warnings` error: Clike enum variant discriminant is not portable to 32-bit targets - --> examples/enums_clike.rs:28:5 + --> enums_clike.rs:28:5 | 28 | A = 0x1_0000_0000, | ^^^^^^^^^^^^^^^^^ @@ -39,7 +39,7 @@ error: Clike enum variant discriminant is not portable to 32-bit targets = note: `-D enum-clike-unportable-variant` implied by `-D warnings` error: Clike enum variant discriminant is not portable to 32-bit targets - --> examples/enums_clike.rs:30:5 + --> enums_clike.rs:30:5 | 30 | C = (std::i32::MIN as isize) - 1, | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -47,7 +47,7 @@ error: Clike enum variant discriminant is not portable to 32-bit targets = note: `-D enum-clike-unportable-variant` implied by `-D warnings` error: Clike enum variant discriminant is not portable to 32-bit targets - --> examples/enums_clike.rs:36:5 + --> enums_clike.rs:36:5 | 36 | Z = 0xFFFF_FFFF, | ^^^^^^^^^^^^^^^ @@ -55,7 +55,7 @@ error: Clike enum variant discriminant is not portable to 32-bit targets = note: `-D enum-clike-unportable-variant` implied by `-D warnings` error: Clike enum variant discriminant is not portable to 32-bit targets - --> examples/enums_clike.rs:37:5 + --> enums_clike.rs:37:5 | 37 | A = 0x1_0000_0000, | ^^^^^^^^^^^^^^^^^ diff --git a/clippy_tests/examples/eq_op.stderr b/clippy_tests/examples/eq_op.stderr index 55d4d2c5146..372d584e7bc 100644 --- a/clippy_tests/examples/eq_op.stderr +++ b/clippy_tests/examples/eq_op.stderr @@ -1,5 +1,5 @@ error: this boolean expression can be simplified - --> examples/eq_op.rs:37:5 + --> eq_op.rs:37:5 | 37 | true && true; | ^^^^^^^^^^^^ help: try `true` @@ -7,7 +7,7 @@ error: this boolean expression can be simplified = note: `-D nonminimal-bool` implied by `-D warnings` error: this boolean expression can be simplified - --> examples/eq_op.rs:39:5 + --> eq_op.rs:39:5 | 39 | true || true; | ^^^^^^^^^^^^ help: try `true` @@ -15,7 +15,7 @@ error: this boolean expression can be simplified = note: `-D nonminimal-bool` implied by `-D warnings` error: this boolean expression can be simplified - --> examples/eq_op.rs:45:5 + --> eq_op.rs:45:5 | 45 | a == b && b == a; | ^^^^^^^^^^^^^^^^ help: try `a == b` @@ -23,7 +23,7 @@ error: this boolean expression can be simplified = note: `-D nonminimal-bool` implied by `-D warnings` error: this boolean expression can be simplified - --> examples/eq_op.rs:46:5 + --> eq_op.rs:46:5 | 46 | a != b && b != a; | ^^^^^^^^^^^^^^^^ help: try `a != b` @@ -31,7 +31,7 @@ error: this boolean expression can be simplified = note: `-D nonminimal-bool` implied by `-D warnings` error: this boolean expression can be simplified - --> examples/eq_op.rs:47:5 + --> eq_op.rs:47:5 | 47 | a < b && b > a; | ^^^^^^^^^^^^^^ help: try `a < b` @@ -39,7 +39,7 @@ error: this boolean expression can be simplified = note: `-D nonminimal-bool` implied by `-D warnings` error: this boolean expression can be simplified - --> examples/eq_op.rs:48:5 + --> eq_op.rs:48:5 | 48 | a <= b && b >= a; | ^^^^^^^^^^^^^^^^ help: try `a <= b` @@ -47,7 +47,7 @@ error: this boolean expression can be simplified = note: `-D nonminimal-bool` implied by `-D warnings` error: equal expressions as operands to `==` - --> examples/eq_op.rs:10:5 + --> eq_op.rs:10:5 | 10 | 1 == 1; | ^^^^^^ @@ -55,7 +55,7 @@ error: equal expressions as operands to `==` = note: `-D eq-op` implied by `-D warnings` error: equal expressions as operands to `==` - --> examples/eq_op.rs:11:5 + --> eq_op.rs:11:5 | 11 | "no" == "no"; | ^^^^^^^^^^^^ @@ -63,7 +63,7 @@ error: equal expressions as operands to `==` = note: `-D eq-op` implied by `-D warnings` error: equal expressions as operands to `!=` - --> examples/eq_op.rs:13:5 + --> eq_op.rs:13:5 | 13 | false != false; | ^^^^^^^^^^^^^^ @@ -71,7 +71,7 @@ error: equal expressions as operands to `!=` = note: `-D eq-op` implied by `-D warnings` error: equal expressions as operands to `<` - --> examples/eq_op.rs:14:5 + --> eq_op.rs:14:5 | 14 | 1.5 < 1.5; | ^^^^^^^^^ @@ -79,7 +79,7 @@ error: equal expressions as operands to `<` = note: `-D eq-op` implied by `-D warnings` error: equal expressions as operands to `>=` - --> examples/eq_op.rs:15:5 + --> eq_op.rs:15:5 | 15 | 1u64 >= 1u64; | ^^^^^^^^^^^^ @@ -87,7 +87,7 @@ error: equal expressions as operands to `>=` = note: `-D eq-op` implied by `-D warnings` error: equal expressions as operands to `&` - --> examples/eq_op.rs:18:5 + --> eq_op.rs:18:5 | 18 | (1 as u64) & (1 as u64); | ^^^^^^^^^^^^^^^^^^^^^^^ @@ -95,7 +95,7 @@ error: equal expressions as operands to `&` = note: `-D eq-op` implied by `-D warnings` error: equal expressions as operands to `^` - --> examples/eq_op.rs:19:5 + --> eq_op.rs:19:5 | 19 | 1 ^ ((((((1)))))); | ^^^^^^^^^^^^^^^^^ @@ -103,7 +103,7 @@ error: equal expressions as operands to `^` = note: `-D eq-op` implied by `-D warnings` error: equal expressions as operands to `<` - --> examples/eq_op.rs:22:5 + --> eq_op.rs:22:5 | 22 | (-(2) < -(2)); | ^^^^^^^^^^^^^ @@ -111,7 +111,7 @@ error: equal expressions as operands to `<` = note: `-D eq-op` implied by `-D warnings` error: equal expressions as operands to `==` - --> examples/eq_op.rs:23:5 + --> eq_op.rs:23:5 | 23 | ((1 + 1) & (1 + 1) == (1 + 1) & (1 + 1)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -119,7 +119,7 @@ error: equal expressions as operands to `==` = note: `-D eq-op` implied by `-D warnings` error: equal expressions as operands to `&` - --> examples/eq_op.rs:23:6 + --> eq_op.rs:23:6 | 23 | ((1 + 1) & (1 + 1) == (1 + 1) & (1 + 1)); | ^^^^^^^^^^^^^^^^^ @@ -127,7 +127,7 @@ error: equal expressions as operands to `&` = note: `-D eq-op` implied by `-D warnings` error: equal expressions as operands to `&` - --> examples/eq_op.rs:23:27 + --> eq_op.rs:23:27 | 23 | ((1 + 1) & (1 + 1) == (1 + 1) & (1 + 1)); | ^^^^^^^^^^^^^^^^^ @@ -135,7 +135,7 @@ error: equal expressions as operands to `&` = note: `-D eq-op` implied by `-D warnings` error: equal expressions as operands to `==` - --> examples/eq_op.rs:24:5 + --> eq_op.rs:24:5 | 24 | (1 * 2) + (3 * 4) == 1 * 2 + 3 * 4; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -143,7 +143,7 @@ error: equal expressions as operands to `==` = note: `-D eq-op` implied by `-D warnings` error: equal expressions as operands to `!=` - --> examples/eq_op.rs:27:5 + --> eq_op.rs:27:5 | 27 | ([1] != [1]); | ^^^^^^^^^^^^ @@ -151,7 +151,7 @@ error: equal expressions as operands to `!=` = note: `-D eq-op` implied by `-D warnings` error: equal expressions as operands to `!=` - --> examples/eq_op.rs:28:5 + --> eq_op.rs:28:5 | 28 | ((1, 2) != (1, 2)); | ^^^^^^^^^^^^^^^^^^ @@ -159,7 +159,7 @@ error: equal expressions as operands to `!=` = note: `-D eq-op` implied by `-D warnings` error: equal expressions as operands to `==` - --> examples/eq_op.rs:32:5 + --> eq_op.rs:32:5 | 32 | 1 + 1 == 2; | ^^^^^^^^^^ @@ -167,7 +167,7 @@ error: equal expressions as operands to `==` = note: `-D eq-op` implied by `-D warnings` error: equal expressions as operands to `==` - --> examples/eq_op.rs:33:5 + --> eq_op.rs:33:5 | 33 | 1 - 1 == 0; | ^^^^^^^^^^ @@ -175,7 +175,7 @@ error: equal expressions as operands to `==` = note: `-D eq-op` implied by `-D warnings` error: equal expressions as operands to `-` - --> examples/eq_op.rs:33:5 + --> eq_op.rs:33:5 | 33 | 1 - 1 == 0; | ^^^^^ @@ -183,7 +183,7 @@ error: equal expressions as operands to `-` = note: `-D eq-op` implied by `-D warnings` error: equal expressions as operands to `-` - --> examples/eq_op.rs:35:5 + --> eq_op.rs:35:5 | 35 | 1 - 1; | ^^^^^ @@ -191,7 +191,7 @@ error: equal expressions as operands to `-` = note: `-D eq-op` implied by `-D warnings` error: equal expressions as operands to `/` - --> examples/eq_op.rs:36:5 + --> eq_op.rs:36:5 | 36 | 1 / 1; | ^^^^^ @@ -199,7 +199,7 @@ error: equal expressions as operands to `/` = note: `-D eq-op` implied by `-D warnings` error: equal expressions as operands to `&&` - --> examples/eq_op.rs:37:5 + --> eq_op.rs:37:5 | 37 | true && true; | ^^^^^^^^^^^^ @@ -207,7 +207,7 @@ error: equal expressions as operands to `&&` = note: `-D eq-op` implied by `-D warnings` error: equal expressions as operands to `||` - --> examples/eq_op.rs:39:5 + --> eq_op.rs:39:5 | 39 | true || true; | ^^^^^^^^^^^^ @@ -215,7 +215,7 @@ error: equal expressions as operands to `||` = note: `-D eq-op` implied by `-D warnings` error: equal expressions as operands to `&&` - --> examples/eq_op.rs:45:5 + --> eq_op.rs:45:5 | 45 | a == b && b == a; | ^^^^^^^^^^^^^^^^ @@ -223,7 +223,7 @@ error: equal expressions as operands to `&&` = note: `-D eq-op` implied by `-D warnings` error: equal expressions as operands to `&&` - --> examples/eq_op.rs:46:5 + --> eq_op.rs:46:5 | 46 | a != b && b != a; | ^^^^^^^^^^^^^^^^ @@ -231,7 +231,7 @@ error: equal expressions as operands to `&&` = note: `-D eq-op` implied by `-D warnings` error: equal expressions as operands to `&&` - --> examples/eq_op.rs:47:5 + --> eq_op.rs:47:5 | 47 | a < b && b > a; | ^^^^^^^^^^^^^^ @@ -239,7 +239,7 @@ error: equal expressions as operands to `&&` = note: `-D eq-op` implied by `-D warnings` error: equal expressions as operands to `&&` - --> examples/eq_op.rs:48:5 + --> eq_op.rs:48:5 | 48 | a <= b && b >= a; | ^^^^^^^^^^^^^^^^ @@ -247,7 +247,7 @@ error: equal expressions as operands to `&&` = note: `-D eq-op` implied by `-D warnings` error: equal expressions as operands to `==` - --> examples/eq_op.rs:51:5 + --> eq_op.rs:51:5 | 51 | a == a; | ^^^^^^ @@ -255,7 +255,7 @@ error: equal expressions as operands to `==` = note: `-D eq-op` implied by `-D warnings` error: taken reference of right operand - --> examples/eq_op.rs:89:13 + --> eq_op.rs:89:13 | 89 | let z = x & &y; | ^^^^-- diff --git a/clippy_tests/examples/eta.stderr b/clippy_tests/examples/eta.stderr index 938a7ad5b78..c66a3f4355d 100644 --- a/clippy_tests/examples/eta.stderr +++ b/clippy_tests/examples/eta.stderr @@ -1,5 +1,5 @@ error: redundant closure found - --> examples/eta.rs:7:27 + --> eta.rs:7:27 | 7 | let a = Some(1u8).map(|a| foo(a)); | ^^^^^^^^^^ help: remove closure as shown: `foo` @@ -7,7 +7,7 @@ error: redundant closure found = note: `-D redundant-closure` implied by `-D warnings` error: redundant closure found - --> examples/eta.rs:8:10 + --> eta.rs:8:10 | 8 | meta(|a| foo(a)); | ^^^^^^^^^^ help: remove closure as shown: `foo` @@ -15,7 +15,7 @@ error: redundant closure found = note: `-D redundant-closure` implied by `-D warnings` error: redundant closure found - --> examples/eta.rs:9:27 + --> eta.rs:9:27 | 9 | let c = Some(1u8).map(|a| {1+2; foo}(a)); | ^^^^^^^^^^^^^^^^^ help: remove closure as shown: `{1+2; foo}` @@ -23,7 +23,7 @@ error: redundant closure found = note: `-D redundant-closure` implied by `-D warnings` error: this expression borrows a reference that is immediately dereferenced by the compiler - --> examples/eta.rs:11:21 + --> eta.rs:11:21 | 11 | all(&[1, 2, 3], &&2, |x, y| below(x, y)); //is adjusted | ^^^ @@ -31,7 +31,7 @@ error: this expression borrows a reference that is immediately dereferenced by t = note: `-D needless-borrow` implied by `-D warnings` error: redundant closure found - --> examples/eta.rs:18:27 + --> eta.rs:18:27 | 18 | let e = Some(1u8).map(|a| generic(a)); | ^^^^^^^^^^^^^^ help: remove closure as shown: `generic` diff --git a/clippy_tests/examples/eval_order_dependence.stderr b/clippy_tests/examples/eval_order_dependence.stderr index 4089938e7d2..3e7d8eb21a4 100644 --- a/clippy_tests/examples/eval_order_dependence.stderr +++ b/clippy_tests/examples/eval_order_dependence.stderr @@ -1,51 +1,51 @@ error: unsequenced read of a variable - --> examples/eval_order_dependence.rs:8:28 + --> eval_order_dependence.rs:8:28 | 8 | let a = { x = 1; 1 } + x; | ^ | = note: `-D eval-order-dependence` implied by `-D warnings` note: whether read occurs before this write depends on evaluation order - --> examples/eval_order_dependence.rs:8:15 + --> eval_order_dependence.rs:8:15 | 8 | let a = { x = 1; 1 } + x; | ^^^^^ error: unsequenced read of a variable - --> examples/eval_order_dependence.rs:11:5 + --> eval_order_dependence.rs:11:5 | 11 | x += { x = 20; 2 }; | ^ | = note: `-D eval-order-dependence` implied by `-D warnings` note: whether read occurs before this write depends on evaluation order - --> examples/eval_order_dependence.rs:11:12 + --> eval_order_dependence.rs:11:12 | 11 | x += { x = 20; 2 }; | ^^^^^^ error: unsequenced read of a variable - --> examples/eval_order_dependence.rs:17:24 + --> eval_order_dependence.rs:17:24 | 17 | let foo = Foo { a: x, .. { x = 6; base } }; | ^ | = note: `-D eval-order-dependence` implied by `-D warnings` note: whether read occurs before this write depends on evaluation order - --> examples/eval_order_dependence.rs:17:32 + --> eval_order_dependence.rs:17:32 | 17 | let foo = Foo { a: x, .. { x = 6; base } }; | ^^^^^ error: unsequenced read of a variable - --> examples/eval_order_dependence.rs:21:9 + --> eval_order_dependence.rs:21:9 | 21 | x += { x = 20; 2 }; | ^ | = note: `-D eval-order-dependence` implied by `-D warnings` note: whether read occurs before this write depends on evaluation order - --> examples/eval_order_dependence.rs:21:16 + --> eval_order_dependence.rs:21:16 | 21 | x += { x = 20; 2 }; | ^^^^^^ diff --git a/clippy_tests/examples/filter_methods.stderr b/clippy_tests/examples/filter_methods.stderr index 7221e019dbd..099f1da5364 100644 --- a/clippy_tests/examples/filter_methods.stderr +++ b/clippy_tests/examples/filter_methods.stderr @@ -1,5 +1,5 @@ error: called `filter(p).map(q)` on an `Iterator`. This is more succinctly expressed by calling `.filter_map(..)` instead. - --> examples/filter_methods.rs:8:21 + --> filter_methods.rs:8:21 | 8 | let _: Vec<_> = vec![5; 6].into_iter() | _____________________^ @@ -10,7 +10,7 @@ error: called `filter(p).map(q)` on an `Iterator`. This is more succinctly expre = note: `-D 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. - --> examples/filter_methods.rs:13:21 + --> filter_methods.rs:13:21 | 13 | let _: Vec<_> = vec![5_i8; 6].into_iter() | _____________________^ @@ -21,7 +21,7 @@ error: called `filter(p).flat_map(q)` on an `Iterator`. This is more succinctly = note: `-D filter-map` implied by `-D warnings` 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. - --> examples/filter_methods.rs:18:21 + --> filter_methods.rs:18:21 | 18 | let _: Vec<_> = vec![5_i8; 6].into_iter() | _____________________^ @@ -32,7 +32,7 @@ error: called `filter_map(p).flat_map(q)` on an `Iterator`. This is more succinc = note: `-D filter-map` implied by `-D warnings` error: called `filter_map(p).map(q)` on an `Iterator`. This is more succinctly expressed by only calling `.filter_map(..)` instead. - --> examples/filter_methods.rs:23:21 + --> filter_methods.rs:23:21 | 23 | let _: Vec<_> = vec![5_i8; 6].into_iter() | _____________________^ diff --git a/clippy_tests/examples/float_cmp.stderr b/clippy_tests/examples/float_cmp.stderr index 802c9b8bba7..4890899a48d 100644 --- a/clippy_tests/examples/float_cmp.stderr +++ b/clippy_tests/examples/float_cmp.stderr @@ -1,103 +1,103 @@ error: strict comparison of f32 or f64 - --> examples/float_cmp.rs:43:5 + --> float_cmp.rs:43:5 | 43 | ONE == 1f32; | ^^^^^^^^^^^ help: consider comparing them within some error `(ONE - 1f32).abs() < error` | = note: `-D float-cmp` implied by `-D warnings` note: std::f32::EPSILON and std::f64::EPSILON are available. - --> examples/float_cmp.rs:43:5 + --> float_cmp.rs:43:5 | 43 | ONE == 1f32; | ^^^^^^^^^^^ error: strict comparison of f32 or f64 - --> examples/float_cmp.rs:44:5 + --> float_cmp.rs:44:5 | 44 | ONE == 1.0 + 0.0; | ^^^^^^^^^^^^^^^^ help: consider comparing them within some error `(ONE - (1.0 + 0.0)).abs() < error` | = note: `-D float-cmp` implied by `-D warnings` note: std::f32::EPSILON and std::f64::EPSILON are available. - --> examples/float_cmp.rs:44:5 + --> float_cmp.rs:44:5 | 44 | ONE == 1.0 + 0.0; | ^^^^^^^^^^^^^^^^ error: strict comparison of f32 or f64 - --> examples/float_cmp.rs:45:5 + --> float_cmp.rs:45:5 | 45 | ONE + ONE == ZERO + ONE + ONE; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider comparing them within some error `(ONE + ONE - (ZERO + ONE + ONE)).abs() < error` | = note: `-D float-cmp` implied by `-D warnings` note: std::f32::EPSILON and std::f64::EPSILON are available. - --> examples/float_cmp.rs:45:5 + --> float_cmp.rs:45:5 | 45 | ONE + ONE == ZERO + ONE + ONE; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: strict comparison of f32 or f64 - --> examples/float_cmp.rs:46:5 + --> float_cmp.rs:46:5 | 46 | ONE != 2.0; | ^^^^^^^^^^ help: consider comparing them within some error `(ONE - 2.0).abs() < error` | = note: `-D float-cmp` implied by `-D warnings` note: std::f32::EPSILON and std::f64::EPSILON are available. - --> examples/float_cmp.rs:46:5 + --> float_cmp.rs:46:5 | 46 | ONE != 2.0; | ^^^^^^^^^^ error: strict comparison of f32 or f64 - --> examples/float_cmp.rs:48:5 + --> float_cmp.rs:48:5 | 48 | twice(ONE) != ONE; | ^^^^^^^^^^^^^^^^^ help: consider comparing them within some error `(twice(ONE) - ONE).abs() < error` | = note: `-D float-cmp` implied by `-D warnings` note: std::f32::EPSILON and std::f64::EPSILON are available. - --> examples/float_cmp.rs:48:5 + --> float_cmp.rs:48:5 | 48 | twice(ONE) != ONE; | ^^^^^^^^^^^^^^^^^ error: strict comparison of f32 or f64 - --> examples/float_cmp.rs:49:5 + --> float_cmp.rs:49:5 | 49 | ONE as f64 != 2.0; | ^^^^^^^^^^^^^^^^^ help: consider comparing them within some error `(ONE as f64 - 2.0).abs() < error` | = note: `-D float-cmp` implied by `-D warnings` note: std::f32::EPSILON and std::f64::EPSILON are available. - --> examples/float_cmp.rs:49:5 + --> float_cmp.rs:49:5 | 49 | ONE as f64 != 2.0; | ^^^^^^^^^^^^^^^^^ error: strict comparison of f32 or f64 - --> examples/float_cmp.rs:54:5 + --> float_cmp.rs:54:5 | 54 | x == 1.0; | ^^^^^^^^ help: consider comparing them within some error `(x - 1.0).abs() < error` | = note: `-D float-cmp` implied by `-D warnings` note: std::f32::EPSILON and std::f64::EPSILON are available. - --> examples/float_cmp.rs:54:5 + --> float_cmp.rs:54:5 | 54 | x == 1.0; | ^^^^^^^^ error: strict comparison of f32 or f64 - --> examples/float_cmp.rs:57:5 + --> float_cmp.rs:57:5 | 57 | twice(x) != twice(ONE as f64); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider comparing them within some error `(twice(x) - twice(ONE as f64)).abs() < error` | = note: `-D float-cmp` implied by `-D warnings` note: std::f32::EPSILON and std::f64::EPSILON are available. - --> examples/float_cmp.rs:57:5 + --> float_cmp.rs:57:5 | 57 | twice(x) != twice(ONE as f64); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/clippy_tests/examples/for_loop.stderr b/clippy_tests/examples/for_loop.stderr index 432ec659fcc..c3ecebcbec2 100644 --- a/clippy_tests/examples/for_loop.stderr +++ b/clippy_tests/examples/for_loop.stderr @@ -1,5 +1,5 @@ error: for loop over `option`, which is an `Option`. This is more readably written as an `if let` statement. - --> examples/for_loop.rs:17:14 + --> for_loop.rs:17:14 | 17 | for x in option { | ^^^^^^ @@ -8,7 +8,7 @@ error: for loop over `option`, which is an `Option`. This is more readably writt = help: consider replacing `for x in option` with `if let Some(x) = option` error: for loop over `result`, which is a `Result`. This is more readably written as an `if let` statement. - --> examples/for_loop.rs:22:14 + --> for_loop.rs:22:14 | 22 | for x in result { | ^^^^^^ @@ -17,7 +17,7 @@ error: for loop over `result`, which is a `Result`. This is more readably writte = help: consider replacing `for x in result` with `if let Ok(x) = result` error: for loop over `option.ok_or("x not found")`, which is a `Result`. This is more readably written as an `if let` statement. - --> examples/for_loop.rs:26:14 + --> for_loop.rs:26:14 | 26 | for x in option.ok_or("x not found") { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -26,7 +26,7 @@ error: for loop over `option.ok_or("x not found")`, which is a `Result`. This is = help: consider replacing `for x in option.ok_or("x not found")` with `if let Ok(x) = option.ok_or("x not found")` error: you are iterating over `Iterator::next()` which is an Option; this will compile but is probably not what you want - --> examples/for_loop.rs:31:5 + --> for_loop.rs:31:5 | 31 | / for x in v.iter().next() { 32 | | println!("{}", x); @@ -36,7 +36,7 @@ error: you are iterating over `Iterator::next()` which is an Option; this will c = note: `-D iter-next-loop` implied by `-D warnings` error: for loop over `v.iter().next().and(Some(0))`, which is an `Option`. This is more readably written as an `if let` statement. - --> examples/for_loop.rs:36:14 + --> for_loop.rs:36:14 | 36 | for x in v.iter().next().and(Some(0)) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -45,7 +45,7 @@ error: for loop over `v.iter().next().and(Some(0))`, which is an `Option`. This = help: consider replacing `for x in v.iter().next().and(Some(0))` with `if let Some(x) = v.iter().next().and(Some(0))` error: for loop over `v.iter().next().ok_or("x not found")`, which is a `Result`. This is more readably written as an `if let` statement. - --> examples/for_loop.rs:40:14 + --> for_loop.rs:40:14 | 40 | for x in v.iter().next().ok_or("x not found") { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -54,7 +54,7 @@ error: for loop over `v.iter().next().ok_or("x not found")`, which is a `Result` = help: consider replacing `for x in v.iter().next().ok_or("x not found")` with `if let Ok(x) = v.iter().next().ok_or("x not found")` error: the loop variable `i` is only used to index `vec`. - --> examples/for_loop.rs:84:5 + --> for_loop.rs:84:5 | 84 | / for i in 0..vec.len() { 85 | | println!("{}", vec[i]); @@ -66,7 +66,7 @@ help: consider using an iterator | for in &vec { error: unused variable: `i` - --> examples/for_loop.rs:88:9 + --> for_loop.rs:88:9 | 88 | for i in 0..vec.len() { | ^ @@ -74,7 +74,7 @@ error: unused variable: `i` = note: `-D unused-variables` implied by `-D warnings` error: the loop variable `i` is only used to index `vec`. - --> examples/for_loop.rs:93:5 + --> for_loop.rs:93:5 | 93 | for i in 0..vec.len() { let _ = vec[i]; } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -84,7 +84,7 @@ help: consider using an iterator | for in &vec { let _ = vec[i]; } error: the loop variable `j` is only used to index `STATIC`. - --> examples/for_loop.rs:96:5 + --> for_loop.rs:96:5 | 96 | / for j in 0..4 { 97 | | println!("{:?}", STATIC[j]); @@ -96,7 +96,7 @@ help: consider using an iterator | for in STATIC.iter().take(4) { error: the loop variable `j` is only used to index `CONST`. - --> examples/for_loop.rs:100:5 + --> for_loop.rs:100:5 | 100 | / for j in 0..4 { 101 | | println!("{:?}", CONST[j]); @@ -108,7 +108,7 @@ help: consider using an iterator | for in CONST.iter().take(4) { error: the loop variable `i` is used to index `vec` - --> examples/for_loop.rs:104:5 + --> for_loop.rs:104:5 | 104 | / for i in 0..vec.len() { 105 | | println!("{} {}", vec[i], i); @@ -120,7 +120,7 @@ help: consider using an iterator | for (i, ) in vec.iter().enumerate() { error: the loop variable `i` is only used to index `vec2`. - --> examples/for_loop.rs:111:5 + --> for_loop.rs:111:5 | 111 | / for i in 0..vec.len() { 112 | | println!("{}", vec2[i]); @@ -132,7 +132,7 @@ help: consider using an iterator | for in vec2.iter().take(vec.len()) { error: the loop variable `i` is only used to index `vec`. - --> examples/for_loop.rs:115:5 + --> for_loop.rs:115:5 | 115 | / for i in 5..vec.len() { 116 | | println!("{}", vec[i]); @@ -144,7 +144,7 @@ help: consider using an iterator | for in vec.iter().skip(5) { error: the loop variable `i` is only used to index `vec`. - --> examples/for_loop.rs:119:5 + --> for_loop.rs:119:5 | 119 | / for i in 0..MAX_LEN { 120 | | println!("{}", vec[i]); @@ -156,7 +156,7 @@ help: consider using an iterator | for in vec.iter().take(MAX_LEN) { error: the loop variable `i` is only used to index `vec`. - --> examples/for_loop.rs:123:5 + --> for_loop.rs:123:5 | 123 | / for i in 0...MAX_LEN { 124 | | println!("{}", vec[i]); @@ -168,7 +168,7 @@ help: consider using an iterator | for in vec.iter().take(MAX_LEN + 1) { error: the loop variable `i` is only used to index `vec`. - --> examples/for_loop.rs:127:5 + --> for_loop.rs:127:5 | 127 | / for i in 5..10 { 128 | | println!("{}", vec[i]); @@ -180,7 +180,7 @@ help: consider using an iterator | for in vec.iter().take(10).skip(5) { error: the loop variable `i` is only used to index `vec`. - --> examples/for_loop.rs:131:5 + --> for_loop.rs:131:5 | 131 | / for i in 5...10 { 132 | | println!("{}", vec[i]); @@ -192,7 +192,7 @@ help: consider using an iterator | for in vec.iter().take(10 + 1).skip(5) { error: the loop variable `i` is used to index `vec` - --> examples/for_loop.rs:135:5 + --> for_loop.rs:135:5 | 135 | / for i in 5..vec.len() { 136 | | println!("{} {}", vec[i], i); @@ -204,7 +204,7 @@ help: consider using an iterator | for (i, ) in vec.iter().enumerate().skip(5) { error: the loop variable `i` is used to index `vec` - --> examples/for_loop.rs:139:5 + --> for_loop.rs:139:5 | 139 | / for i in 5..10 { 140 | | println!("{} {}", vec[i], i); @@ -216,7 +216,7 @@ help: consider using an iterator | for (i, ) in vec.iter().enumerate().take(10).skip(5) { error: this range is empty so this for loop will never run - --> examples/for_loop.rs:143:5 + --> for_loop.rs:143:5 | 143 | / for i in 10..0 { 144 | | println!("{}", i); @@ -228,7 +228,7 @@ help: consider using the following if you are attempting to iterate over this ra | for i in (0..10).rev() { error: this range is empty so this for loop will never run - --> examples/for_loop.rs:147:5 + --> for_loop.rs:147:5 | 147 | / for i in 10...0 { 148 | | println!("{}", i); @@ -240,7 +240,7 @@ help: consider using the following if you are attempting to iterate over this ra | for i in (0...10).rev() { error: this range is empty so this for loop will never run - --> examples/for_loop.rs:151:5 + --> for_loop.rs:151:5 | 151 | / for i in MAX_LEN..0 { 152 | | println!("{}", i); @@ -252,7 +252,7 @@ help: consider using the following if you are attempting to iterate over this ra | for i in (0..MAX_LEN).rev() { error: this range is empty so this for loop will never run - --> examples/for_loop.rs:155:5 + --> for_loop.rs:155:5 | 155 | / for i in 5..5 { 156 | | println!("{}", i); @@ -262,7 +262,7 @@ error: this range is empty so this for loop will never run = note: `-D reverse-range-loop` implied by `-D warnings` error: this range is empty so this for loop will never run - --> examples/for_loop.rs:176:5 + --> for_loop.rs:176:5 | 176 | / for i in 10..5+4 { 177 | | println!("{}", i); @@ -274,7 +274,7 @@ help: consider using the following if you are attempting to iterate over this ra | for i in (5+4..10).rev() { error: this range is empty so this for loop will never run - --> examples/for_loop.rs:180:5 + --> for_loop.rs:180:5 | 180 | / for i in (5+2)..(3-1) { 181 | | println!("{}", i); @@ -286,7 +286,7 @@ help: consider using the following if you are attempting to iterate over this ra | for i in ((3-1)..(5+2)).rev() { error: this range is empty so this for loop will never run - --> examples/for_loop.rs:184:5 + --> for_loop.rs:184:5 | 184 | / for i in (5+2)..(8-1) { 185 | | println!("{}", i); @@ -296,7 +296,7 @@ error: this range is empty so this for loop will never run = note: `-D reverse-range-loop` implied by `-D warnings` error: it is more idiomatic to loop over references to containers instead of using explicit iteration methods - --> examples/for_loop.rs:207:15 + --> for_loop.rs:207:15 | 207 | for _v in vec.iter() { } | ^^^^^^^^^^ help: to write this more concisely, try `&vec` @@ -304,7 +304,7 @@ error: it is more idiomatic to loop over references to containers instead of usi = note: `-D explicit-iter-loop` implied by `-D warnings` error: it is more idiomatic to loop over references to containers instead of using explicit iteration methods - --> examples/for_loop.rs:209:15 + --> for_loop.rs:209:15 | 209 | for _v in vec.iter_mut() { } | ^^^^^^^^^^^^^^ help: to write this more concisely, try `&mut vec` @@ -312,7 +312,7 @@ error: it is more idiomatic to loop over references to containers instead of usi = note: `-D explicit-iter-loop` implied by `-D warnings` error: it is more idiomatic to loop over containers instead of using explicit iteration methods` - --> examples/for_loop.rs:212:15 + --> for_loop.rs:212:15 | 212 | for _v in out_vec.into_iter() { } | ^^^^^^^^^^^^^^^^^^^ help: to write this more concisely, try `out_vec` @@ -320,7 +320,7 @@ error: it is more idiomatic to loop over containers instead of using explicit it = note: `-D explicit-into-iter-loop` implied by `-D warnings` error: it is more idiomatic to loop over references to containers instead of using explicit iteration methods - --> examples/for_loop.rs:215:15 + --> for_loop.rs:215:15 | 215 | for _v in array.into_iter() {} | ^^^^^^^^^^^^^^^^^ help: to write this more concisely, try `&array` @@ -328,7 +328,7 @@ error: it is more idiomatic to loop over references to containers instead of usi = note: `-D explicit-iter-loop` implied by `-D warnings` error: it is more idiomatic to loop over references to containers instead of using explicit iteration methods - --> examples/for_loop.rs:220:15 + --> for_loop.rs:220:15 | 220 | for _v in [1, 2, 3].iter() { } | ^^^^^^^^^^^^^^^^ help: to write this more concisely, try `&[1, 2, 3]` @@ -336,7 +336,7 @@ error: it is more idiomatic to loop over references to containers instead of usi = note: `-D explicit-iter-loop` implied by `-D warnings` error: it is more idiomatic to loop over references to containers instead of using explicit iteration methods - --> examples/for_loop.rs:224:15 + --> for_loop.rs:224:15 | 224 | for _v in [0; 32].iter() {} | ^^^^^^^^^^^^^^ help: to write this more concisely, try `&[0; 32]` @@ -344,7 +344,7 @@ error: it is more idiomatic to loop over references to containers instead of usi = note: `-D explicit-iter-loop` implied by `-D warnings` error: it is more idiomatic to loop over references to containers instead of using explicit iteration methods - --> examples/for_loop.rs:229:15 + --> for_loop.rs:229:15 | 229 | for _v in ll.iter() { } | ^^^^^^^^^ help: to write this more concisely, try `&ll` @@ -352,7 +352,7 @@ error: it is more idiomatic to loop over references to containers instead of usi = note: `-D explicit-iter-loop` implied by `-D warnings` error: it is more idiomatic to loop over references to containers instead of using explicit iteration methods - --> examples/for_loop.rs:232:15 + --> for_loop.rs:232:15 | 232 | for _v in vd.iter() { } | ^^^^^^^^^ help: to write this more concisely, try `&vd` @@ -360,7 +360,7 @@ error: it is more idiomatic to loop over references to containers instead of usi = note: `-D explicit-iter-loop` implied by `-D warnings` error: it is more idiomatic to loop over references to containers instead of using explicit iteration methods - --> examples/for_loop.rs:235:15 + --> for_loop.rs:235:15 | 235 | for _v in bh.iter() { } | ^^^^^^^^^ help: to write this more concisely, try `&bh` @@ -368,7 +368,7 @@ error: it is more idiomatic to loop over references to containers instead of usi = note: `-D explicit-iter-loop` implied by `-D warnings` error: it is more idiomatic to loop over references to containers instead of using explicit iteration methods - --> examples/for_loop.rs:238:15 + --> for_loop.rs:238:15 | 238 | for _v in hm.iter() { } | ^^^^^^^^^ help: to write this more concisely, try `&hm` @@ -376,7 +376,7 @@ error: it is more idiomatic to loop over references to containers instead of usi = note: `-D explicit-iter-loop` implied by `-D warnings` error: it is more idiomatic to loop over references to containers instead of using explicit iteration methods - --> examples/for_loop.rs:241:15 + --> for_loop.rs:241:15 | 241 | for _v in bt.iter() { } | ^^^^^^^^^ help: to write this more concisely, try `&bt` @@ -384,7 +384,7 @@ error: it is more idiomatic to loop over references to containers instead of usi = note: `-D explicit-iter-loop` implied by `-D warnings` error: it is more idiomatic to loop over references to containers instead of using explicit iteration methods - --> examples/for_loop.rs:244:15 + --> for_loop.rs:244:15 | 244 | for _v in hs.iter() { } | ^^^^^^^^^ help: to write this more concisely, try `&hs` @@ -392,7 +392,7 @@ error: it is more idiomatic to loop over references to containers instead of usi = note: `-D explicit-iter-loop` implied by `-D warnings` error: it is more idiomatic to loop over references to containers instead of using explicit iteration methods - --> examples/for_loop.rs:247:15 + --> for_loop.rs:247:15 | 247 | for _v in bs.iter() { } | ^^^^^^^^^ help: to write this more concisely, try `&bs` @@ -400,7 +400,7 @@ error: it is more idiomatic to loop over references to containers instead of usi = note: `-D explicit-iter-loop` implied by `-D warnings` error: you are iterating over `Iterator::next()` which is an Option; this will compile but is probably not what you want - --> examples/for_loop.rs:249:5 + --> for_loop.rs:249:5 | 249 | for _v in vec.iter().next() { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -408,7 +408,7 @@ error: you are iterating over `Iterator::next()` which is an Option; this will c = note: `-D 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 - --> examples/for_loop.rs:256:5 + --> for_loop.rs:256:5 | 256 | vec.iter().map(|x| out.push(x)).collect::>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -416,7 +416,7 @@ error: you are collect()ing an iterator and throwing away the result. Consider u = note: `-D unused-collect` implied by `-D warnings` error: the variable `_index` is used as a loop counter. Consider using `for (_index, item) in &vec.enumerate()` or similar iterators - --> examples/for_loop.rs:261:5 + --> for_loop.rs:261:5 | 261 | for _v in &vec { _index += 1 } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -424,7 +424,7 @@ error: the variable `_index` is used as a loop counter. Consider using `for (_in = note: `-D explicit-counter-loop` implied by `-D warnings` error: the variable `_index` is used as a loop counter. Consider using `for (_index, item) in &vec.enumerate()` or similar iterators - --> examples/for_loop.rs:265:5 + --> for_loop.rs:265:5 | 265 | for _v in &vec { _index += 1 } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -432,7 +432,7 @@ error: the variable `_index` is used as a loop counter. Consider using `for (_in = note: `-D explicit-counter-loop` implied by `-D warnings` error: you seem to want to iterate on a map's values - --> examples/for_loop.rs:325:5 + --> for_loop.rs:325:5 | 325 | / for (_, v) in &m { 326 | | let _v = v; @@ -444,7 +444,7 @@ help: use the corresponding method | for v in m.values() { error: you seem to want to iterate on a map's values - --> examples/for_loop.rs:330:5 + --> for_loop.rs:330:5 | 330 | / for (_, v) in &*m { 331 | | let _v = v; @@ -458,7 +458,7 @@ help: use the corresponding method | for v in (*m).values() { error: you seem to want to iterate on a map's values - --> examples/for_loop.rs:337:5 + --> for_loop.rs:337:5 | 337 | / for (_, v) in &mut m { 338 | | let _v = v; @@ -470,7 +470,7 @@ help: use the corresponding method | for v in m.values_mut() { error: you seem to want to iterate on a map's values - --> examples/for_loop.rs:342:5 + --> for_loop.rs:342:5 | 342 | / for (_, v) in &mut *m { 343 | | let _v = v; @@ -482,7 +482,7 @@ help: use the corresponding method | for v in (*m).values_mut() { error: you seem to want to iterate on a map's keys - --> examples/for_loop.rs:348:5 + --> for_loop.rs:348:5 | 348 | / for (k, _value) in rm { 349 | | let _k = k; diff --git a/clippy_tests/examples/format.stderr b/clippy_tests/examples/format.stderr index 5c0ad89ca25..5e04c7d132d 100644 --- a/clippy_tests/examples/format.stderr +++ b/clippy_tests/examples/format.stderr @@ -1,5 +1,5 @@ error: useless use of `format!` - --> examples/format.rs:6:5 + --> format.rs:6:5 | 6 | format!("foo"); | ^^^^^^^^^^^^^^^ @@ -7,7 +7,7 @@ error: useless use of `format!` = note: `-D useless-format` implied by `-D warnings` error: useless use of `format!` - --> examples/format.rs:8:5 + --> format.rs:8:5 | 8 | format!("{}", "foo"); | ^^^^^^^^^^^^^^^^^^^^^ @@ -15,7 +15,7 @@ error: useless use of `format!` = note: `-D useless-format` implied by `-D warnings` error: useless use of `format!` - --> examples/format.rs:15:5 + --> format.rs:15:5 | 15 | format!("{}", arg); | ^^^^^^^^^^^^^^^^^^^ diff --git a/clippy_tests/examples/formatting.stderr b/clippy_tests/examples/formatting.stderr index 8177c854924..2a5854c8e01 100644 --- a/clippy_tests/examples/formatting.stderr +++ b/clippy_tests/examples/formatting.stderr @@ -1,5 +1,5 @@ error: this looks like an `else if` but the `else` is missing - --> examples/formatting.rs:15:6 + --> formatting.rs:15:6 | 15 | } if foo() { | ^ @@ -8,7 +8,7 @@ error: this looks like an `else if` but the `else` is missing = 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 - --> examples/formatting.rs:22:10 + --> formatting.rs:22:10 | 22 | } if foo() { | ^ @@ -17,7 +17,7 @@ error: this looks like an `else if` but the `else` is missing = 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 - --> examples/formatting.rs:30:10 + --> formatting.rs:30:10 | 30 | } if foo() { | ^ @@ -26,7 +26,7 @@ error: this looks like an `else if` but the `else` is missing = 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 - --> examples/formatting.rs:39:6 + --> formatting.rs:39:6 | 39 | } else | ______^ @@ -37,7 +37,7 @@ error: this is an `else if` but the formatting might hide it = 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 - --> examples/formatting.rs:44:6 + --> formatting.rs:44:6 | 44 | } | ______^ @@ -49,7 +49,7 @@ error: this is an `else if` but the formatting might hide it = 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 `.. = (- ..)` - --> examples/formatting.rs:71:6 + --> formatting.rs:71:6 | 71 | a =- 35; | ^^^^ @@ -58,7 +58,7 @@ error: this looks like you are trying to use `.. -= ..`, but you really are doin = note: to remove this lint, use either `-=` or `= -` error: this looks like you are trying to use `.. *= ..`, but you really are doing `.. = (* ..)` - --> examples/formatting.rs:72:6 + --> formatting.rs:72:6 | 72 | a =* &191; | ^^^^ @@ -67,7 +67,7 @@ error: this looks like you are trying to use `.. *= ..`, but you really are doin = note: to remove this lint, use either `*=` or `= *` error: this looks like you are trying to use `.. != ..`, but you really are doing `.. = (! ..)` - --> examples/formatting.rs:75:6 + --> formatting.rs:75:6 | 75 | b =! false; | ^^^^ @@ -76,7 +76,7 @@ error: this looks like you are trying to use `.. != ..`, but you really are doin = note: to remove this lint, use either `!=` or `= !` error: possibly missing a comma here - --> examples/formatting.rs:84:19 + --> formatting.rs:84:19 | 84 | -1, -2, -3 // <= no comma here | ^ @@ -85,7 +85,7 @@ error: possibly missing a comma here = note: to remove this lint, add a comma or write the expr in a single line error: possibly missing a comma here - --> examples/formatting.rs:88:19 + --> formatting.rs:88:19 | 88 | -1, -2, -3 // <= no comma here | ^ diff --git a/clippy_tests/examples/functions.stderr b/clippy_tests/examples/functions.stderr index c633bd2a797..7935fd4ddb7 100644 --- a/clippy_tests/examples/functions.stderr +++ b/clippy_tests/examples/functions.stderr @@ -1,5 +1,5 @@ error: this function has too many arguments (8/7) - --> examples/functions.rs:11:1 + --> functions.rs:11:1 | 11 | / fn bad(_one: u32, _two: u32, _three: &str, _four: bool, _five: f32, _six: f32, _seven: bool, _eight: ()) { 12 | | } @@ -8,7 +8,7 @@ error: this function has too many arguments (8/7) = note: `-D too-many-arguments` implied by `-D warnings` error: this function has too many arguments (8/7) - --> examples/functions.rs:19:5 + --> functions.rs:19:5 | 19 | fn bad(_one: u32, _two: u32, _three: &str, _four: bool, _five: f32, _six: f32, _seven: bool, _eight: ()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -16,7 +16,7 @@ error: this function has too many arguments (8/7) = note: `-D too-many-arguments` implied by `-D warnings` error: this function has too many arguments (8/7) - --> examples/functions.rs:28:5 + --> functions.rs:28:5 | 28 | fn bad_method(_one: u32, _two: u32, _three: &str, _four: bool, _five: f32, _six: f32, _seven: bool, _eight: ()) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -24,7 +24,7 @@ error: this function has too many arguments (8/7) = note: `-D too-many-arguments` implied by `-D warnings` error: this public function dereferences a raw pointer but is not marked `unsafe` - --> examples/functions.rs:37:34 + --> functions.rs:37:34 | 37 | println!("{}", unsafe { *p }); | ^ @@ -32,7 +32,7 @@ error: this public function dereferences a raw pointer but is not marked `unsafe = note: `-D not-unsafe-ptr-arg-deref` implied by `-D warnings` error: this public function dereferences a raw pointer but is not marked `unsafe` - --> examples/functions.rs:38:35 + --> functions.rs:38:35 | 38 | println!("{:?}", unsafe { p.as_ref() }); | ^ @@ -40,7 +40,7 @@ error: this public function dereferences a raw pointer but is not marked `unsafe = note: `-D not-unsafe-ptr-arg-deref` implied by `-D warnings` error: this public function dereferences a raw pointer but is not marked `unsafe` - --> examples/functions.rs:39:33 + --> functions.rs:39:33 | 39 | unsafe { std::ptr::read(p) }; | ^ @@ -48,7 +48,7 @@ error: this public function dereferences a raw pointer but is not marked `unsafe = note: `-D not-unsafe-ptr-arg-deref` implied by `-D warnings` error: this public function dereferences a raw pointer but is not marked `unsafe` - --> examples/functions.rs:50:30 + --> functions.rs:50:30 | 50 | println!("{}", unsafe { *p }); | ^ @@ -56,7 +56,7 @@ error: this public function dereferences a raw pointer but is not marked `unsafe = note: `-D not-unsafe-ptr-arg-deref` implied by `-D warnings` error: this public function dereferences a raw pointer but is not marked `unsafe` - --> examples/functions.rs:51:31 + --> functions.rs:51:31 | 51 | println!("{:?}", unsafe { p.as_ref() }); | ^ @@ -64,7 +64,7 @@ error: this public function dereferences a raw pointer but is not marked `unsafe = note: `-D not-unsafe-ptr-arg-deref` implied by `-D warnings` error: this public function dereferences a raw pointer but is not marked `unsafe` - --> examples/functions.rs:52:29 + --> functions.rs:52:29 | 52 | unsafe { std::ptr::read(p) }; | ^ @@ -72,7 +72,7 @@ error: this public function dereferences a raw pointer but is not marked `unsafe = note: `-D not-unsafe-ptr-arg-deref` implied by `-D warnings` error: this public function dereferences a raw pointer but is not marked `unsafe` - --> examples/functions.rs:61:34 + --> functions.rs:61:34 | 61 | println!("{}", unsafe { *p }); | ^ @@ -80,7 +80,7 @@ error: this public function dereferences a raw pointer but is not marked `unsafe = note: `-D not-unsafe-ptr-arg-deref` implied by `-D warnings` error: this public function dereferences a raw pointer but is not marked `unsafe` - --> examples/functions.rs:62:35 + --> functions.rs:62:35 | 62 | println!("{:?}", unsafe { p.as_ref() }); | ^ @@ -88,7 +88,7 @@ error: this public function dereferences a raw pointer but is not marked `unsafe = note: `-D not-unsafe-ptr-arg-deref` implied by `-D warnings` error: this public function dereferences a raw pointer but is not marked `unsafe` - --> examples/functions.rs:63:33 + --> functions.rs:63:33 | 63 | unsafe { std::ptr::read(p) }; | ^ diff --git a/clippy_tests/examples/identity_op.stderr b/clippy_tests/examples/identity_op.stderr index 0311ed33b88..34181bbd12b 100644 --- a/clippy_tests/examples/identity_op.stderr +++ b/clippy_tests/examples/identity_op.stderr @@ -1,5 +1,5 @@ error: the operation is ineffective. Consider reducing it to `x` - --> examples/identity_op.rs:13:5 + --> identity_op.rs:13:5 | 13 | x + 0; | ^^^^^ @@ -7,7 +7,7 @@ error: the operation is ineffective. Consider reducing it to `x` = note: `-D identity-op` implied by `-D warnings` error: the operation is ineffective. Consider reducing it to `x` - --> examples/identity_op.rs:14:5 + --> identity_op.rs:14:5 | 14 | x + (1 - 1); | ^^^^^^^^^^^ @@ -15,7 +15,7 @@ error: the operation is ineffective. Consider reducing it to `x` = note: `-D identity-op` implied by `-D warnings` error: the operation is ineffective. Consider reducing it to `x` - --> examples/identity_op.rs:16:5 + --> identity_op.rs:16:5 | 16 | 0 + x; | ^^^^^ @@ -23,7 +23,7 @@ error: the operation is ineffective. Consider reducing it to `x` = note: `-D identity-op` implied by `-D warnings` error: the operation is ineffective. Consider reducing it to `x` - --> examples/identity_op.rs:19:5 + --> identity_op.rs:19:5 | 19 | x | (0); | ^^^^^^^ @@ -31,7 +31,7 @@ error: the operation is ineffective. Consider reducing it to `x` = note: `-D identity-op` implied by `-D warnings` error: the operation is ineffective. Consider reducing it to `x` - --> examples/identity_op.rs:22:5 + --> identity_op.rs:22:5 | 22 | x * 1; | ^^^^^ @@ -39,7 +39,7 @@ error: the operation is ineffective. Consider reducing it to `x` = note: `-D identity-op` implied by `-D warnings` error: the operation is ineffective. Consider reducing it to `x` - --> examples/identity_op.rs:23:5 + --> identity_op.rs:23:5 | 23 | 1 * x; | ^^^^^ @@ -47,7 +47,7 @@ error: the operation is ineffective. Consider reducing it to `x` = note: `-D identity-op` implied by `-D warnings` error: the operation is ineffective. Consider reducing it to `x` - --> examples/identity_op.rs:29:5 + --> identity_op.rs:29:5 | 29 | -1 & x; | ^^^^^^ diff --git a/clippy_tests/examples/if_let_redundant_pattern_matching.stderr b/clippy_tests/examples/if_let_redundant_pattern_matching.stderr index 44e61675b55..56c0e7b9b32 100644 --- a/clippy_tests/examples/if_let_redundant_pattern_matching.stderr +++ b/clippy_tests/examples/if_let_redundant_pattern_matching.stderr @@ -1,5 +1,5 @@ error: redundant pattern matching, consider using `is_ok()` - --> examples/if_let_redundant_pattern_matching.rs:9:12 + --> if_let_redundant_pattern_matching.rs:9:12 | 9 | if let Ok(_) = Ok::(42) {} | -------^^^^^--------------------- help: try this `if Ok::(42).is_ok()` @@ -7,7 +7,7 @@ error: redundant pattern matching, consider using `is_ok()` = note: `-D if-let-redundant-pattern-matching` implied by `-D warnings` error: redundant pattern matching, consider using `is_err()` - --> examples/if_let_redundant_pattern_matching.rs:11:12 + --> if_let_redundant_pattern_matching.rs:11:12 | 11 | if let Err(_) = Err::(42) { | -------^^^^^^---------------------- help: try this `if Err::(42).is_err()` @@ -15,7 +15,7 @@ error: redundant pattern matching, consider using `is_err()` = note: `-D if-let-redundant-pattern-matching` implied by `-D warnings` error: redundant pattern matching, consider using `is_none()` - --> examples/if_let_redundant_pattern_matching.rs:14:12 + --> if_let_redundant_pattern_matching.rs:14:12 | 14 | if let None = None::<()> { | -------^^^^------------- help: try this `if None::<()>.is_none()` @@ -23,7 +23,7 @@ error: redundant pattern matching, consider using `is_none()` = note: `-D if-let-redundant-pattern-matching` implied by `-D warnings` error: redundant pattern matching, consider using `is_some()` - --> examples/if_let_redundant_pattern_matching.rs:17:12 + --> if_let_redundant_pattern_matching.rs:17:12 | 17 | if let Some(_) = Some(42) { | -------^^^^^^^----------- help: try this `if Some(42).is_some()` diff --git a/clippy_tests/examples/if_not_else.stderr b/clippy_tests/examples/if_not_else.stderr index 06aea90eaf1..bce14720433 100644 --- a/clippy_tests/examples/if_not_else.stderr +++ b/clippy_tests/examples/if_not_else.stderr @@ -1,5 +1,5 @@ error: Unnecessary boolean `not` operation - --> examples/if_not_else.rs:9:5 + --> if_not_else.rs:9:5 | 9 | / if !bla() { 10 | | println!("Bugs"); @@ -12,7 +12,7 @@ error: Unnecessary boolean `not` operation = help: remove the `!` and swap the blocks of the if/else error: Unnecessary `!=` operation - --> examples/if_not_else.rs:14:5 + --> if_not_else.rs:14:5 | 14 | / if 4 != 5 { 15 | | println!("Bugs"); diff --git a/clippy_tests/examples/invalid_upcast_comparisons.stderr b/clippy_tests/examples/invalid_upcast_comparisons.stderr index 578395a9795..65319b15c52 100644 --- a/clippy_tests/examples/invalid_upcast_comparisons.stderr +++ b/clippy_tests/examples/invalid_upcast_comparisons.stderr @@ -1,5 +1,5 @@ error: because of the numeric bounds on `u8` prior to casting, this expression is always false - --> examples/invalid_upcast_comparisons.rs:16:5 + --> invalid_upcast_comparisons.rs:16:5 | 16 | (u8 as u32) > 300; | ^^^^^^^^^^^^^^^^^ @@ -7,7 +7,7 @@ error: because of the numeric bounds on `u8` prior to casting, this expression i = note: `-D invalid-upcast-comparisons` implied by `-D warnings` error: because of the numeric bounds on `u8` prior to casting, this expression is always false - --> examples/invalid_upcast_comparisons.rs:17:5 + --> invalid_upcast_comparisons.rs:17:5 | 17 | (u8 as i32) > 300; | ^^^^^^^^^^^^^^^^^ @@ -15,7 +15,7 @@ error: because of the numeric bounds on `u8` prior to casting, this expression i = note: `-D invalid-upcast-comparisons` implied by `-D warnings` error: because of the numeric bounds on `u8` prior to casting, this expression is always false - --> examples/invalid_upcast_comparisons.rs:18:5 + --> invalid_upcast_comparisons.rs:18:5 | 18 | (u8 as u32) == 300; | ^^^^^^^^^^^^^^^^^^ @@ -23,7 +23,7 @@ error: because of the numeric bounds on `u8` prior to casting, this expression i = note: `-D invalid-upcast-comparisons` implied by `-D warnings` error: because of the numeric bounds on `u8` prior to casting, this expression is always false - --> examples/invalid_upcast_comparisons.rs:19:5 + --> invalid_upcast_comparisons.rs:19:5 | 19 | (u8 as i32) == 300; | ^^^^^^^^^^^^^^^^^^ @@ -31,7 +31,7 @@ error: because of the numeric bounds on `u8` prior to casting, this expression i = note: `-D invalid-upcast-comparisons` implied by `-D warnings` error: because of the numeric bounds on `u8` prior to casting, this expression is always false - --> examples/invalid_upcast_comparisons.rs:20:5 + --> invalid_upcast_comparisons.rs:20:5 | 20 | 300 < (u8 as u32); | ^^^^^^^^^^^^^^^^^ @@ -39,7 +39,7 @@ error: because of the numeric bounds on `u8` prior to casting, this expression i = note: `-D invalid-upcast-comparisons` implied by `-D warnings` error: because of the numeric bounds on `u8` prior to casting, this expression is always false - --> examples/invalid_upcast_comparisons.rs:21:5 + --> invalid_upcast_comparisons.rs:21:5 | 21 | 300 < (u8 as i32); | ^^^^^^^^^^^^^^^^^ @@ -47,7 +47,7 @@ error: because of the numeric bounds on `u8` prior to casting, this expression i = note: `-D invalid-upcast-comparisons` implied by `-D warnings` error: because of the numeric bounds on `u8` prior to casting, this expression is always false - --> examples/invalid_upcast_comparisons.rs:22:5 + --> invalid_upcast_comparisons.rs:22:5 | 22 | 300 == (u8 as u32); | ^^^^^^^^^^^^^^^^^^ @@ -55,7 +55,7 @@ error: because of the numeric bounds on `u8` prior to casting, this expression i = note: `-D invalid-upcast-comparisons` implied by `-D warnings` error: because of the numeric bounds on `u8` prior to casting, this expression is always false - --> examples/invalid_upcast_comparisons.rs:23:5 + --> invalid_upcast_comparisons.rs:23:5 | 23 | 300 == (u8 as i32); | ^^^^^^^^^^^^^^^^^^ @@ -63,7 +63,7 @@ error: because of the numeric bounds on `u8` prior to casting, this expression i = note: `-D invalid-upcast-comparisons` implied by `-D warnings` error: because of the numeric bounds on `u8` prior to casting, this expression is always true - --> examples/invalid_upcast_comparisons.rs:25:5 + --> invalid_upcast_comparisons.rs:25:5 | 25 | (u8 as u32) <= 300; | ^^^^^^^^^^^^^^^^^^ @@ -71,7 +71,7 @@ error: because of the numeric bounds on `u8` prior to casting, this expression i = note: `-D invalid-upcast-comparisons` implied by `-D warnings` error: because of the numeric bounds on `u8` prior to casting, this expression is always true - --> examples/invalid_upcast_comparisons.rs:26:5 + --> invalid_upcast_comparisons.rs:26:5 | 26 | (u8 as i32) <= 300; | ^^^^^^^^^^^^^^^^^^ @@ -79,7 +79,7 @@ error: because of the numeric bounds on `u8` prior to casting, this expression i = note: `-D invalid-upcast-comparisons` implied by `-D warnings` error: because of the numeric bounds on `u8` prior to casting, this expression is always true - --> examples/invalid_upcast_comparisons.rs:27:5 + --> invalid_upcast_comparisons.rs:27:5 | 27 | (u8 as u32) != 300; | ^^^^^^^^^^^^^^^^^^ @@ -87,7 +87,7 @@ error: because of the numeric bounds on `u8` prior to casting, this expression i = note: `-D invalid-upcast-comparisons` implied by `-D warnings` error: because of the numeric bounds on `u8` prior to casting, this expression is always true - --> examples/invalid_upcast_comparisons.rs:28:5 + --> invalid_upcast_comparisons.rs:28:5 | 28 | (u8 as i32) != 300; | ^^^^^^^^^^^^^^^^^^ @@ -95,7 +95,7 @@ error: because of the numeric bounds on `u8` prior to casting, this expression i = note: `-D invalid-upcast-comparisons` implied by `-D warnings` error: because of the numeric bounds on `u8` prior to casting, this expression is always true - --> examples/invalid_upcast_comparisons.rs:29:5 + --> invalid_upcast_comparisons.rs:29:5 | 29 | 300 >= (u8 as u32); | ^^^^^^^^^^^^^^^^^^ @@ -103,7 +103,7 @@ error: because of the numeric bounds on `u8` prior to casting, this expression i = note: `-D invalid-upcast-comparisons` implied by `-D warnings` error: because of the numeric bounds on `u8` prior to casting, this expression is always true - --> examples/invalid_upcast_comparisons.rs:30:5 + --> invalid_upcast_comparisons.rs:30:5 | 30 | 300 >= (u8 as i32); | ^^^^^^^^^^^^^^^^^^ @@ -111,7 +111,7 @@ error: because of the numeric bounds on `u8` prior to casting, this expression i = note: `-D invalid-upcast-comparisons` implied by `-D warnings` error: because of the numeric bounds on `u8` prior to casting, this expression is always true - --> examples/invalid_upcast_comparisons.rs:31:5 + --> invalid_upcast_comparisons.rs:31:5 | 31 | 300 != (u8 as u32); | ^^^^^^^^^^^^^^^^^^ @@ -119,7 +119,7 @@ error: because of the numeric bounds on `u8` prior to casting, this expression i = note: `-D invalid-upcast-comparisons` implied by `-D warnings` error: because of the numeric bounds on `u8` prior to casting, this expression is always true - --> examples/invalid_upcast_comparisons.rs:32:5 + --> invalid_upcast_comparisons.rs:32:5 | 32 | 300 != (u8 as i32); | ^^^^^^^^^^^^^^^^^^ @@ -127,7 +127,7 @@ error: because of the numeric bounds on `u8` prior to casting, this expression i = note: `-D invalid-upcast-comparisons` implied by `-D warnings` error: because of the numeric bounds on `u8` prior to casting, this expression is always false - --> examples/invalid_upcast_comparisons.rs:35:5 + --> invalid_upcast_comparisons.rs:35:5 | 35 | (u8 as i32) < 0; | ^^^^^^^^^^^^^^^ @@ -135,7 +135,7 @@ error: because of the numeric bounds on `u8` prior to casting, this expression i = note: `-D invalid-upcast-comparisons` implied by `-D warnings` error: because of the numeric bounds on `u8` prior to casting, this expression is always true - --> examples/invalid_upcast_comparisons.rs:36:5 + --> invalid_upcast_comparisons.rs:36:5 | 36 | -5 != (u8 as i32); | ^^^^^^^^^^^^^^^^^ @@ -143,7 +143,7 @@ error: because of the numeric bounds on `u8` prior to casting, this expression i = note: `-D invalid-upcast-comparisons` implied by `-D warnings` error: because of the numeric bounds on `u8` prior to casting, this expression is always true - --> examples/invalid_upcast_comparisons.rs:38:5 + --> invalid_upcast_comparisons.rs:38:5 | 38 | (u8 as i32) >= 0; | ^^^^^^^^^^^^^^^^ @@ -151,7 +151,7 @@ error: because of the numeric bounds on `u8` prior to casting, this expression i = note: `-D invalid-upcast-comparisons` implied by `-D warnings` error: because of the numeric bounds on `u8` prior to casting, this expression is always false - --> examples/invalid_upcast_comparisons.rs:39:5 + --> invalid_upcast_comparisons.rs:39:5 | 39 | -5 == (u8 as i32); | ^^^^^^^^^^^^^^^^^ @@ -159,7 +159,7 @@ error: because of the numeric bounds on `u8` prior to casting, this expression i = note: `-D invalid-upcast-comparisons` implied by `-D warnings` error: because of the numeric bounds on `u8` prior to casting, this expression is always false - --> examples/invalid_upcast_comparisons.rs:42:5 + --> invalid_upcast_comparisons.rs:42:5 | 42 | 1337 == (u8 as i32); | ^^^^^^^^^^^^^^^^^^^ @@ -167,7 +167,7 @@ error: because of the numeric bounds on `u8` prior to casting, this expression i = note: `-D invalid-upcast-comparisons` implied by `-D warnings` error: because of the numeric bounds on `u8` prior to casting, this expression is always false - --> examples/invalid_upcast_comparisons.rs:43:5 + --> invalid_upcast_comparisons.rs:43:5 | 43 | 1337 == (u8 as u32); | ^^^^^^^^^^^^^^^^^^^ @@ -175,7 +175,7 @@ error: because of the numeric bounds on `u8` prior to casting, this expression i = note: `-D invalid-upcast-comparisons` implied by `-D warnings` error: because of the numeric bounds on `u8` prior to casting, this expression is always true - --> examples/invalid_upcast_comparisons.rs:45:5 + --> invalid_upcast_comparisons.rs:45:5 | 45 | 1337 != (u8 as i32); | ^^^^^^^^^^^^^^^^^^^ @@ -183,7 +183,7 @@ error: because of the numeric bounds on `u8` prior to casting, this expression i = note: `-D invalid-upcast-comparisons` implied by `-D warnings` error: because of the numeric bounds on `u8` prior to casting, this expression is always true - --> examples/invalid_upcast_comparisons.rs:46:5 + --> invalid_upcast_comparisons.rs:46:5 | 46 | 1337 != (u8 as u32); | ^^^^^^^^^^^^^^^^^^^ @@ -191,7 +191,7 @@ error: because of the numeric bounds on `u8` prior to casting, this expression i = note: `-D invalid-upcast-comparisons` implied by `-D warnings` error: because of the numeric bounds on `u8` prior to casting, this expression is always true - --> examples/invalid_upcast_comparisons.rs:61:5 + --> invalid_upcast_comparisons.rs:61:5 | 61 | (u8 as i32) > -1; | ^^^^^^^^^^^^^^^^ @@ -199,7 +199,7 @@ error: because of the numeric bounds on `u8` prior to casting, this expression i = note: `-D invalid-upcast-comparisons` implied by `-D warnings` error: because of the numeric bounds on `u8` prior to casting, this expression is always false - --> examples/invalid_upcast_comparisons.rs:62:5 + --> invalid_upcast_comparisons.rs:62:5 | 62 | (u8 as i32) < -1; | ^^^^^^^^^^^^^^^^ @@ -207,7 +207,7 @@ error: because of the numeric bounds on `u8` prior to casting, this expression i = note: `-D invalid-upcast-comparisons` implied by `-D warnings` error: because of the numeric bounds on `u8` prior to casting, this expression is always false - --> examples/invalid_upcast_comparisons.rs:78:5 + --> invalid_upcast_comparisons.rs:78:5 | 78 | -5 >= (u8 as i32); | ^^^^^^^^^^^^^^^^^ diff --git a/clippy_tests/examples/item_after_statement.stderr b/clippy_tests/examples/item_after_statement.stderr index f1010bc65c6..65bdbe29c11 100644 --- a/clippy_tests/examples/item_after_statement.stderr +++ b/clippy_tests/examples/item_after_statement.stderr @@ -1,5 +1,5 @@ error: adding items after statements is confusing, since items exist from the start of the scope - --> examples/item_after_statement.rs:12:5 + --> item_after_statement.rs:12:5 | 12 | fn foo() { println!("foo"); } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -7,7 +7,7 @@ error: adding items after statements is confusing, since items exist from the st = note: `-D items-after-statements` implied by `-D warnings` error: adding items after statements is confusing, since items exist from the start of the scope - --> examples/item_after_statement.rs:17:5 + --> item_after_statement.rs:17:5 | 17 | fn foo() { println!("foo"); } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/clippy_tests/examples/large_enum_variant.stderr b/clippy_tests/examples/large_enum_variant.stderr index d7df84799ef..6761bb73148 100644 --- a/clippy_tests/examples/large_enum_variant.stderr +++ b/clippy_tests/examples/large_enum_variant.stderr @@ -1,5 +1,5 @@ error: large size difference between variants - --> examples/large_enum_variant.rs:10:5 + --> large_enum_variant.rs:10:5 | 10 | B([i32; 8000]), | ^^^^^^^^^^^^^^ @@ -9,20 +9,20 @@ help: consider boxing the large fields to reduce the total size of the enum | B(Box<[i32; 8000]>), error: large size difference between variants - --> examples/large_enum_variant.rs:21:5 + --> large_enum_variant.rs:21:5 | 21 | C(T, [i32; 8000]), | ^^^^^^^^^^^^^^^^^ | = note: `-D large-enum-variant` implied by `-D warnings` help: consider boxing the large fields to reduce the total size of the enum - --> examples/large_enum_variant.rs:21:5 + --> large_enum_variant.rs:21:5 | 21 | C(T, [i32; 8000]), | ^^^^^^^^^^^^^^^^^ error: large size difference between variants - --> examples/large_enum_variant.rs:34:5 + --> large_enum_variant.rs:34:5 | 34 | ContainingLargeEnum(LargeEnum), | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -32,33 +32,33 @@ help: consider boxing the large fields to reduce the total size of the enum | ContainingLargeEnum(Box), error: large size difference between variants - --> examples/large_enum_variant.rs:37:5 + --> large_enum_variant.rs:37:5 | 37 | ContainingMoreThanOneField(i32, [i32; 8000], [i32; 9500]), | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D large-enum-variant` implied by `-D warnings` help: consider boxing the large fields to reduce the total size of the enum - --> examples/large_enum_variant.rs:37:5 + --> large_enum_variant.rs:37:5 | 37 | ContainingMoreThanOneField(i32, [i32; 8000], [i32; 9500]), | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: large size difference between variants - --> examples/large_enum_variant.rs:44:5 + --> large_enum_variant.rs:44:5 | 44 | StructLikeLarge { x: [i32; 8000], y: i32 }, | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D large-enum-variant` implied by `-D warnings` help: consider boxing the large fields to reduce the total size of the enum - --> examples/large_enum_variant.rs:44:5 + --> large_enum_variant.rs:44:5 | 44 | StructLikeLarge { x: [i32; 8000], y: i32 }, | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: large size difference between variants - --> examples/large_enum_variant.rs:49:5 + --> large_enum_variant.rs:49:5 | 49 | StructLikeLarge2 { x: [i32; 8000] }, | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/clippy_tests/examples/len_zero.stderr b/clippy_tests/examples/len_zero.stderr index f78838fdfe6..16a68734da0 100644 --- a/clippy_tests/examples/len_zero.stderr +++ b/clippy_tests/examples/len_zero.stderr @@ -1,5 +1,5 @@ error: item `PubOne` has a public `len` method but no corresponding `is_empty` method - --> examples/len_zero.rs:9:1 + --> len_zero.rs:9:1 | 9 | / impl PubOne { 10 | | pub fn len(self: &Self) -> isize { @@ -11,7 +11,7 @@ error: item `PubOne` has a public `len` method but no corresponding `is_empty` m = note: `-D len-without-is-empty` implied by `-D warnings` error: trait `PubTraitsToo` has a `len` method but no `is_empty` method - --> examples/len_zero.rs:55:1 + --> len_zero.rs:55:1 | 55 | / pub trait PubTraitsToo { 56 | | fn len(self: &Self) -> isize; @@ -21,7 +21,7 @@ error: trait `PubTraitsToo` has a `len` method but no `is_empty` method = note: `-D len-without-is-empty` implied by `-D warnings` error: item `HasIsEmpty` has a public `len` method but a private `is_empty` method - --> examples/len_zero.rs:89:1 + --> len_zero.rs:89:1 | 89 | / impl HasIsEmpty { 90 | | pub fn len(self: &Self) -> isize { @@ -35,7 +35,7 @@ error: item `HasIsEmpty` has a public `len` method but a private `is_empty` meth = note: `-D len-without-is-empty` implied by `-D warnings` error: item `HasWrongIsEmpty` has a public `len` method but no corresponding `is_empty` method - --> examples/len_zero.rs:118:1 + --> len_zero.rs:118:1 | 118 | / impl HasWrongIsEmpty { 119 | | pub fn len(self: &Self) -> isize { @@ -49,7 +49,7 @@ error: item `HasWrongIsEmpty` has a public `len` method but no corresponding `is = note: `-D len-without-is-empty` implied by `-D warnings` error: length comparison to zero - --> examples/len_zero.rs:130:8 + --> len_zero.rs:130:8 | 130 | if x.len() == 0 { | ^^^^^^^^^^^^ help: using `is_empty` is more concise: `x.is_empty()` @@ -57,7 +57,7 @@ error: length comparison to zero = note: `-D len-zero` implied by `-D warnings` error: length comparison to zero - --> examples/len_zero.rs:134:8 + --> len_zero.rs:134:8 | 134 | if "".len() == 0 { | ^^^^^^^^^^^^^ help: using `is_empty` is more concise: `"".is_empty()` @@ -65,7 +65,7 @@ error: length comparison to zero = note: `-D len-zero` implied by `-D warnings` error: length comparison to zero - --> examples/len_zero.rs:148:8 + --> len_zero.rs:148:8 | 148 | if has_is_empty.len() == 0 { | ^^^^^^^^^^^^^^^^^^^^^^^ help: using `is_empty` is more concise: `has_is_empty.is_empty()` @@ -73,7 +73,7 @@ error: length comparison to zero = note: `-D len-zero` implied by `-D warnings` error: length comparison to zero - --> examples/len_zero.rs:151:8 + --> len_zero.rs:151:8 | 151 | if has_is_empty.len() != 0 { | ^^^^^^^^^^^^^^^^^^^^^^^ help: using `is_empty` is more concise: `!has_is_empty.is_empty()` @@ -81,7 +81,7 @@ error: length comparison to zero = note: `-D len-zero` implied by `-D warnings` error: length comparison to zero - --> examples/len_zero.rs:154:8 + --> len_zero.rs:154:8 | 154 | if has_is_empty.len() > 0 { | ^^^^^^^^^^^^^^^^^^^^^^ help: using `is_empty` is more concise: `!has_is_empty.is_empty()` @@ -89,7 +89,7 @@ error: length comparison to zero = note: `-D len-zero` implied by `-D warnings` error: length comparison to zero - --> examples/len_zero.rs:160:8 + --> len_zero.rs:160:8 | 160 | if with_is_empty.len() == 0 { | ^^^^^^^^^^^^^^^^^^^^^^^^ help: using `is_empty` is more concise: `with_is_empty.is_empty()` @@ -97,7 +97,7 @@ error: length comparison to zero = note: `-D len-zero` implied by `-D warnings` error: length comparison to zero - --> examples/len_zero.rs:172:8 + --> len_zero.rs:172:8 | 172 | if b.len() != 0 { | ^^^^^^^^^^^^ help: using `is_empty` is more concise: `!b.is_empty()` diff --git a/clippy_tests/examples/let_if_seq.stderr b/clippy_tests/examples/let_if_seq.stderr index 3f862a9133f..195d9c72287 100644 --- a/clippy_tests/examples/let_if_seq.stderr +++ b/clippy_tests/examples/let_if_seq.stderr @@ -1,5 +1,5 @@ error: `if _ { .. } else { .. }` is an expression - --> examples/let_if_seq.rs:57:5 + --> let_if_seq.rs:57:5 | 57 | / let mut foo = 0; 58 | | if f() { @@ -11,7 +11,7 @@ error: `if _ { .. } else { .. }` is an expression = note: you might not need `mut` at all error: `if _ { .. } else { .. }` is an expression - --> examples/let_if_seq.rs:62:5 + --> let_if_seq.rs:62:5 | 62 | / let mut bar = 0; 63 | | if f() { @@ -26,7 +26,7 @@ error: `if _ { .. } else { .. }` is an expression = note: you might not need `mut` at all error: `if _ { .. } else { .. }` is an expression - --> examples/let_if_seq.rs:71:5 + --> let_if_seq.rs:71:5 | 71 | / let quz; 72 | | if f() { @@ -39,7 +39,7 @@ error: `if _ { .. } else { .. }` is an expression = note: `-D useless-let-if-seq` implied by `-D warnings` error: `if _ { .. } else { .. }` is an expression - --> examples/let_if_seq.rs:100:5 + --> let_if_seq.rs:100:5 | 100 | / let mut baz = 0; 101 | | if f() { diff --git a/clippy_tests/examples/let_return.stderr b/clippy_tests/examples/let_return.stderr index e966066ccdc..e78294d260c 100644 --- a/clippy_tests/examples/let_return.stderr +++ b/clippy_tests/examples/let_return.stderr @@ -1,25 +1,25 @@ error: returning the result of a let binding from a block. Consider returning the expression directly. - --> examples/let_return.rs:10:5 + --> let_return.rs:10:5 | 10 | x | ^ | = note: `-D let-and-return` implied by `-D warnings` note: this expression can be directly returned - --> examples/let_return.rs:9:13 + --> let_return.rs:9:13 | 9 | let x = 5; | ^ error: returning the result of a let binding from a block. Consider returning the expression directly. - --> examples/let_return.rs:16:9 + --> let_return.rs:16:9 | 16 | x | ^ | = note: `-D let-and-return` implied by `-D warnings` note: this expression can be directly returned - --> examples/let_return.rs:15:17 + --> let_return.rs:15:17 | 15 | let x = 5; | ^ diff --git a/clippy_tests/examples/let_unit.stderr b/clippy_tests/examples/let_unit.stderr index c70ab7a58b5..00ac0bfd026 100644 --- a/clippy_tests/examples/let_unit.stderr +++ b/clippy_tests/examples/let_unit.stderr @@ -1,5 +1,5 @@ error: this let-binding has unit value. Consider omitting `let _x =` - --> examples/let_unit.rs:14:5 + --> let_unit.rs:14:5 | 14 | let _x = println!("x"); | ^^^^^^^^^^^^^^^^^^^^^^^ @@ -7,7 +7,7 @@ error: this let-binding has unit value. Consider omitting `let _x =` = note: `-D let-unit-value` implied by `-D warnings` error: this let-binding has unit value. Consider omitting `let _a =` - --> examples/let_unit.rs:18:9 + --> let_unit.rs:18:9 | 18 | let _a = (); | ^^^^^^^^^^^^ diff --git a/clippy_tests/examples/lifetimes.stderr b/clippy_tests/examples/lifetimes.stderr index 9875f4c29fb..b1c1262afb9 100644 --- a/clippy_tests/examples/lifetimes.stderr +++ b/clippy_tests/examples/lifetimes.stderr @@ -1,5 +1,5 @@ error: explicit lifetimes given in parameter types where they could be elided - --> examples/lifetimes.rs:7:1 + --> lifetimes.rs:7:1 | 7 | fn distinct_lifetimes<'a, 'b>(_x: &'a u8, _y: &'b u8, _z: u8) { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -7,7 +7,7 @@ error: explicit lifetimes given in parameter types where they could be elided = note: `-D needless-lifetimes` implied by `-D warnings` error: explicit lifetimes given in parameter types where they could be elided - --> examples/lifetimes.rs:9:1 + --> lifetimes.rs:9:1 | 9 | fn distinct_and_static<'a, 'b>(_x: &'a u8, _y: &'b u8, _z: &'static u8) { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -15,7 +15,7 @@ error: explicit lifetimes given in parameter types where they could be elided = note: `-D needless-lifetimes` implied by `-D warnings` error: explicit lifetimes given in parameter types where they could be elided - --> examples/lifetimes.rs:17:1 + --> lifetimes.rs:17:1 | 17 | fn in_and_out<'a>(x: &'a u8, _y: u8) -> &'a u8 { x } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -23,7 +23,7 @@ error: explicit lifetimes given in parameter types where they could be elided = note: `-D needless-lifetimes` implied by `-D warnings` error: explicit lifetimes given in parameter types where they could be elided - --> examples/lifetimes.rs:29:1 + --> lifetimes.rs:29:1 | 29 | fn deep_reference_3<'a>(x: &'a u8, _y: u8) -> Result<&'a u8, ()> { Ok(x) } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -31,7 +31,7 @@ error: explicit lifetimes given in parameter types where they could be elided = note: `-D needless-lifetimes` implied by `-D warnings` error: explicit lifetimes given in parameter types where they could be elided - --> examples/lifetimes.rs:32:1 + --> lifetimes.rs:32:1 | 32 | fn where_clause_without_lt<'a, T>(x: &'a u8, _y: u8) -> Result<&'a u8, ()> where T: Copy { Ok(x) } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -39,7 +39,7 @@ error: explicit lifetimes given in parameter types where they could be elided = note: `-D needless-lifetimes` implied by `-D warnings` error: explicit lifetimes given in parameter types where they could be elided - --> examples/lifetimes.rs:38:1 + --> lifetimes.rs:38:1 | 38 | fn lifetime_param_2<'a, 'b>(_x: Ref<'a>, _y: &'b u8) { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -47,7 +47,7 @@ error: explicit lifetimes given in parameter types where they could be elided = note: `-D needless-lifetimes` implied by `-D warnings` error: explicit lifetimes given in parameter types where they could be elided - --> examples/lifetimes.rs:52:1 + --> lifetimes.rs:52:1 | 52 | / fn fn_bound_2<'a, F, I>(_m: Lt<'a, I>, _f: F) -> Lt<'a, I> 53 | | where for<'x> F: Fn(Lt<'x, I>) -> Lt<'x, I> @@ -57,7 +57,7 @@ error: explicit lifetimes given in parameter types where they could be elided = note: `-D needless-lifetimes` implied by `-D warnings` error: explicit lifetimes given in parameter types where they could be elided - --> examples/lifetimes.rs:61:5 + --> lifetimes.rs:61:5 | 61 | fn self_and_out<'s>(&'s self) -> &'s u8 { &self.x } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -65,7 +65,7 @@ error: explicit lifetimes given in parameter types where they could be elided = note: `-D needless-lifetimes` implied by `-D warnings` error: explicit lifetimes given in parameter types where they could be elided - --> examples/lifetimes.rs:65:5 + --> lifetimes.rs:65:5 | 65 | fn distinct_self_and_in<'s, 't>(&'s self, _x: &'t u8) { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -73,7 +73,7 @@ error: explicit lifetimes given in parameter types where they could be elided = note: `-D needless-lifetimes` implied by `-D warnings` error: explicit lifetimes given in parameter types where they could be elided - --> examples/lifetimes.rs:81:1 + --> lifetimes.rs:81:1 | 81 | fn struct_with_lt<'a>(_foo: Foo<'a>) -> &'a str { unimplemented!() } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -81,7 +81,7 @@ error: explicit lifetimes given in parameter types where they could be elided = note: `-D needless-lifetimes` implied by `-D warnings` error: explicit lifetimes given in parameter types where they could be elided - --> examples/lifetimes.rs:101:1 + --> lifetimes.rs:101:1 | 101 | fn trait_obj_elided2<'a>(_arg: &'a Drop) -> &'a str { unimplemented!() } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -89,7 +89,7 @@ error: explicit lifetimes given in parameter types where they could be elided = note: `-D needless-lifetimes` implied by `-D warnings` error: explicit lifetimes given in parameter types where they could be elided - --> examples/lifetimes.rs:105:1 + --> lifetimes.rs:105:1 | 105 | fn alias_with_lt<'a>(_foo: FooAlias<'a>) -> &'a str { unimplemented!() } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -97,7 +97,7 @@ error: explicit lifetimes given in parameter types where they could be elided = note: `-D needless-lifetimes` implied by `-D warnings` error: explicit lifetimes given in parameter types where they could be elided - --> examples/lifetimes.rs:116:1 + --> lifetimes.rs:116:1 | 116 | fn named_input_elided_output<'a>(_arg: &'a str) -> &str { unimplemented!() } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -105,7 +105,7 @@ error: explicit lifetimes given in parameter types where they could be elided = note: `-D needless-lifetimes` implied by `-D warnings` error: explicit lifetimes given in parameter types where they could be elided - --> examples/lifetimes.rs:120:1 + --> lifetimes.rs:120:1 | 120 | fn trait_bound_ok<'a, T: WithLifetime<'static>>(_: &'a u8, _: T) { unimplemented!() } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/clippy_tests/examples/lint_pass.stderr b/clippy_tests/examples/lint_pass.stderr index ab3df34a8aa..fc3c132f6b4 100644 --- a/clippy_tests/examples/lint_pass.stderr +++ b/clippy_tests/examples/lint_pass.stderr @@ -1,5 +1,5 @@ error: the lint `MISSING_LINT` is not added to any `LintPass` - --> examples/lint_pass.rs:12:1 + --> lint_pass.rs:12:1 | 12 | declare_lint! { MISSING_LINT, Warn, "missing lint" } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/clippy_tests/examples/literals.stderr b/clippy_tests/examples/literals.stderr index 77c6b562113..1c3d376f2ba 100644 --- a/clippy_tests/examples/literals.stderr +++ b/clippy_tests/examples/literals.stderr @@ -1,5 +1,5 @@ error: inconsistent casing in hexadecimal literal - --> examples/literals.rs:14:17 + --> literals.rs:14:17 | 14 | let fail1 = 0xabCD; | ^^^^^^ @@ -7,7 +7,7 @@ error: inconsistent casing in hexadecimal literal = note: `-D mixed-case-hex-literals` implied by `-D warnings` error: inconsistent casing in hexadecimal literal - --> examples/literals.rs:15:17 + --> literals.rs:15:17 | 15 | let fail2 = 0xabCD_u32; | ^^^^^^^^^^ @@ -15,7 +15,7 @@ error: inconsistent casing in hexadecimal literal = note: `-D mixed-case-hex-literals` implied by `-D warnings` error: inconsistent casing in hexadecimal literal - --> examples/literals.rs:16:17 + --> literals.rs:16:17 | 16 | let fail2 = 0xabCD_isize; | ^^^^^^^^^^^^ @@ -23,7 +23,7 @@ error: inconsistent casing in hexadecimal literal = note: `-D mixed-case-hex-literals` implied by `-D warnings` error: integer type suffix should be separated by an underscore - --> examples/literals.rs:21:17 + --> literals.rs:21:17 | 21 | let fail3 = 1234i32; | ^^^^^^^ @@ -31,7 +31,7 @@ error: integer type suffix should be separated by an underscore = note: `-D unseparated-literal-suffix` implied by `-D warnings` error: integer type suffix should be separated by an underscore - --> examples/literals.rs:22:17 + --> literals.rs:22:17 | 22 | let fail4 = 1234u32; | ^^^^^^^ @@ -39,7 +39,7 @@ error: integer type suffix should be separated by an underscore = note: `-D unseparated-literal-suffix` implied by `-D warnings` error: integer type suffix should be separated by an underscore - --> examples/literals.rs:23:17 + --> literals.rs:23:17 | 23 | let fail5 = 1234isize; | ^^^^^^^^^ @@ -47,7 +47,7 @@ error: integer type suffix should be separated by an underscore = note: `-D unseparated-literal-suffix` implied by `-D warnings` error: integer type suffix should be separated by an underscore - --> examples/literals.rs:24:17 + --> literals.rs:24:17 | 24 | let fail6 = 1234usize; | ^^^^^^^^^ @@ -55,7 +55,7 @@ error: integer type suffix should be separated by an underscore = note: `-D unseparated-literal-suffix` implied by `-D warnings` error: float type suffix should be separated by an underscore - --> examples/literals.rs:25:17 + --> literals.rs:25:17 | 25 | let fail7 = 1.5f32; | ^^^^^^ @@ -63,7 +63,7 @@ error: float type suffix should be separated by an underscore = note: `-D unseparated-literal-suffix` implied by `-D warnings` error: this is a decimal constant - --> examples/literals.rs:29:17 + --> literals.rs:29:17 | 29 | let fail8 = 0123; | ^^^^ diff --git a/clippy_tests/examples/map_clone.stderr b/clippy_tests/examples/map_clone.stderr index 378c7fc5269..08af0a89c59 100644 --- a/clippy_tests/examples/map_clone.stderr +++ b/clippy_tests/examples/map_clone.stderr @@ -1,5 +1,5 @@ error: you seem to be using .map() to clone the contents of an iterator, consider using `.cloned()` - --> examples/map_clone.rs:12:5 + --> map_clone.rs:12:5 | 12 | x.iter().map(|y| y.clone()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -9,7 +9,7 @@ error: you seem to be using .map() to clone the contents of an iterator, conside x.iter().cloned() error: you seem to be using .map() to clone the contents of an iterator, consider using `.cloned()` - --> examples/map_clone.rs:14:5 + --> map_clone.rs:14:5 | 14 | x.iter().map(|&y| y); | ^^^^^^^^^^^^^^^^^^^^ @@ -19,7 +19,7 @@ error: you seem to be using .map() to clone the contents of an iterator, conside x.iter().cloned() error: you seem to be using .map() to clone the contents of an iterator, consider using `.cloned()` - --> examples/map_clone.rs:16:5 + --> map_clone.rs:16:5 | 16 | x.iter().map(|y| *y); | ^^^^^^^^^^^^^^^^^^^^ @@ -29,7 +29,7 @@ error: you seem to be using .map() to clone the contents of an iterator, conside x.iter().cloned() error: you seem to be using .map() to clone the contents of an iterator, consider using `.cloned()` - --> examples/map_clone.rs:18:5 + --> map_clone.rs:18:5 | 18 | x.iter().map(|y| { y.clone() }); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -39,7 +39,7 @@ error: you seem to be using .map() to clone the contents of an iterator, conside x.iter().cloned() error: you seem to be using .map() to clone the contents of an iterator, consider using `.cloned()` - --> examples/map_clone.rs:20:5 + --> map_clone.rs:20:5 | 20 | x.iter().map(|&y| { y }); | ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -49,7 +49,7 @@ error: you seem to be using .map() to clone the contents of an iterator, conside x.iter().cloned() error: you seem to be using .map() to clone the contents of an iterator, consider using `.cloned()` - --> examples/map_clone.rs:22:5 + --> map_clone.rs:22:5 | 22 | x.iter().map(|y| { *y }); | ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -59,7 +59,7 @@ error: you seem to be using .map() to clone the contents of an iterator, conside x.iter().cloned() error: you seem to be using .map() to clone the contents of an iterator, consider using `.cloned()` - --> examples/map_clone.rs:24:5 + --> map_clone.rs:24:5 | 24 | x.iter().map(Clone::clone); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -69,7 +69,7 @@ error: you seem to be using .map() to clone the contents of an iterator, conside x.iter().cloned() error: you seem to be using .map() to clone the contents of an Option, consider using `.cloned()` - --> examples/map_clone.rs:30:5 + --> map_clone.rs:30:5 | 30 | x.as_ref().map(|y| y.clone()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -79,7 +79,7 @@ error: you seem to be using .map() to clone the contents of an Option, consider x.as_ref().cloned() error: you seem to be using .map() to clone the contents of an Option, consider using `.cloned()` - --> examples/map_clone.rs:32:5 + --> map_clone.rs:32:5 | 32 | x.as_ref().map(|&y| y); | ^^^^^^^^^^^^^^^^^^^^^^ @@ -89,7 +89,7 @@ error: you seem to be using .map() to clone the contents of an Option, consider x.as_ref().cloned() error: you seem to be using .map() to clone the contents of an Option, consider using `.cloned()` - --> examples/map_clone.rs:34:5 + --> map_clone.rs:34:5 | 34 | x.as_ref().map(|y| *y); | ^^^^^^^^^^^^^^^^^^^^^^ @@ -99,7 +99,7 @@ error: you seem to be using .map() to clone the contents of an Option, consider x.as_ref().cloned() error: you seem to be using .map() to clone the contents of an Option, consider using `.cloned()` - --> examples/map_clone.rs:90:35 + --> map_clone.rs:90:35 | 90 | let _: Option = x.as_ref().map(|y| *y); | ^^^^^^^^^^^^^^^^^^^^^^ diff --git a/clippy_tests/examples/matches.stderr b/clippy_tests/examples/matches.stderr index e94b1872b9e..930e87138de 100644 --- a/clippy_tests/examples/matches.stderr +++ b/clippy_tests/examples/matches.stderr @@ -1,5 +1,5 @@ error: you seem to be trying to use match for destructuring a single pattern. Consider using `if let` - --> examples/matches.rs:26:5 + --> matches.rs:26:5 | 26 | / match ExprNode::Butterflies { 27 | | ExprNode::ExprAddrOf => Some(&NODE), @@ -10,7 +10,7 @@ error: you seem to be trying to use match for destructuring a single pattern. Co = note: `-D single-match-else` implied by `-D warnings` error: you seem to be trying to use match for destructuring a single pattern. Consider using `if let` - --> examples/matches.rs:35:5 + --> matches.rs:35:5 | 35 | / match x { 36 | | Some(y) => { println!("{:?}", y); } @@ -21,7 +21,7 @@ error: you seem to be trying to use match for destructuring a single pattern. Co = note: `-D single-match` implied by `-D warnings` error: you seem to be trying to use match for destructuring a single pattern. Consider using `if let` - --> examples/matches.rs:41:5 + --> matches.rs:41:5 | 41 | / match z { 42 | | (2...3, 7...9) => dummy(), @@ -32,7 +32,7 @@ error: you seem to be trying to use match for destructuring a single pattern. Co = note: `-D single-match` implied by `-D warnings` error: you seem to be trying to use match for destructuring a single pattern. Consider using `if let` - --> examples/matches.rs:63:5 + --> matches.rs:63:5 | 63 | / match x { 64 | | Some(y) => dummy(), @@ -43,7 +43,7 @@ error: you seem to be trying to use match for destructuring a single pattern. Co = note: `-D single-match` implied by `-D warnings` error: you seem to be trying to use match for destructuring a single pattern. Consider using `if let` - --> examples/matches.rs:68:5 + --> matches.rs:68:5 | 68 | / match y { 69 | | Ok(y) => dummy(), @@ -54,7 +54,7 @@ error: you seem to be trying to use match for destructuring a single pattern. Co = note: `-D single-match` implied by `-D warnings` error: you seem to be trying to use match for destructuring a single pattern. Consider using `if let` - --> examples/matches.rs:75:5 + --> matches.rs:75:5 | 75 | / match c { 76 | | Cow::Borrowed(..) => dummy(), @@ -65,7 +65,7 @@ error: you seem to be trying to use match for destructuring a single pattern. Co = note: `-D single-match` implied by `-D warnings` error: you seem to be trying to match on a boolean expression - --> examples/matches.rs:96:5 + --> matches.rs:96:5 | 96 | / match test { 97 | | true => 0, @@ -76,7 +76,7 @@ error: you seem to be trying to match on a boolean expression = note: `-D match-bool` implied by `-D warnings` error: you seem to be trying to match on a boolean expression - --> examples/matches.rs:102:5 + --> matches.rs:102:5 | 102 | / match option == 1 { 103 | | true => 1, @@ -87,7 +87,7 @@ error: you seem to be trying to match on a boolean expression = note: `-D match-bool` implied by `-D warnings` error: you seem to be trying to match on a boolean expression - --> examples/matches.rs:107:5 + --> matches.rs:107:5 | 107 | / match test { 108 | | true => (), @@ -98,7 +98,7 @@ error: you seem to be trying to match on a boolean expression = note: `-D match-bool` implied by `-D warnings` error: you seem to be trying to match on a boolean expression - --> examples/matches.rs:112:5 + --> matches.rs:112:5 | 112 | / match test { 113 | | false => { println!("Noooo!"); } @@ -109,7 +109,7 @@ error: you seem to be trying to match on a boolean expression = note: `-D match-bool` implied by `-D warnings` error: you seem to be trying to match on a boolean expression - --> examples/matches.rs:117:5 + --> matches.rs:117:5 | 117 | / match test && test { 118 | | false => { println!("Noooo!"); } @@ -120,7 +120,7 @@ error: you seem to be trying to match on a boolean expression = note: `-D match-bool` implied by `-D warnings` error: equal expressions as operands to `&&` - --> examples/matches.rs:117:11 + --> matches.rs:117:11 | 117 | match test && test { | ^^^^^^^^^^^^ @@ -128,7 +128,7 @@ error: equal expressions as operands to `&&` = note: `-D eq-op` implied by `-D warnings` error: you seem to be trying to match on a boolean expression - --> examples/matches.rs:122:5 + --> matches.rs:122:5 | 122 | / match test { 123 | | false => { println!("Noooo!"); } @@ -139,7 +139,7 @@ error: you seem to be trying to match on a boolean expression = note: `-D match-bool` implied by `-D warnings` error: you don't need to add `&` to all patterns - --> examples/matches.rs:138:9 + --> matches.rs:138:9 | 138 | / match v { 139 | | &Some(v) => println!("{:?}", v), @@ -152,7 +152,7 @@ help: instead of prefixing all patterns with `&`, you can dereference the expres | match *v { .. } error: you don't need to add `&` to all patterns - --> examples/matches.rs:148:5 + --> matches.rs:148:5 | 148 | / match tup { 149 | | &(v, 1) => println!("{}", v), @@ -165,7 +165,7 @@ help: instead of prefixing all patterns with `&`, you can dereference the expres | match *tup { .. } error: you don't need to add `&` to both the expression and the patterns - --> examples/matches.rs:154:5 + --> matches.rs:154:5 | 154 | / match &w { 155 | | &Some(v) => println!("{:?}", v), @@ -176,7 +176,7 @@ error: you don't need to add `&` to both the expression and the patterns = note: `-D match-ref-pats` implied by `-D warnings` error: you don't need to add `&` to all patterns - --> examples/matches.rs:165:5 + --> matches.rs:165:5 | 165 | / if let &None = a { 166 | | println!("none"); @@ -188,7 +188,7 @@ help: instead of prefixing all patterns with `&`, you can dereference the expres | if let .. = *a { .. } error: you don't need to add `&` to both the expression and the patterns - --> examples/matches.rs:170:5 + --> matches.rs:170:5 | 170 | / if let &None = &b { 171 | | println!("none"); @@ -198,72 +198,72 @@ error: you don't need to add `&` to both the expression and the patterns = note: `-D match-ref-pats` implied by `-D warnings` error: some ranges overlap - --> examples/matches.rs:179:9 + --> matches.rs:179:9 | 179 | 0 ... 10 => println!("0 ... 10"), | ^^^^^^^^ | = note: `-D match-overlapping-arm` implied by `-D warnings` note: overlaps with this - --> examples/matches.rs:180:9 + --> matches.rs:180:9 | 180 | 0 ... 11 => println!("0 ... 11"), | ^^^^^^^^ error: some ranges overlap - --> examples/matches.rs:185:9 + --> matches.rs:185:9 | 185 | 0 ... 5 => println!("0 ... 5"), | ^^^^^^^ | = note: `-D match-overlapping-arm` implied by `-D warnings` note: overlaps with this - --> examples/matches.rs:187:9 + --> matches.rs:187:9 | 187 | FOO ... 11 => println!("0 ... 11"), | ^^^^^^^^^^ error: some ranges overlap - --> examples/matches.rs:193:9 + --> matches.rs:193:9 | 193 | 0 ... 5 => println!("0 ... 5"), | ^^^^^^^ | = note: `-D match-overlapping-arm` implied by `-D warnings` note: overlaps with this - --> examples/matches.rs:192:9 + --> matches.rs:192:9 | 192 | 2 => println!("2"), | ^ error: some ranges overlap - --> examples/matches.rs:199:9 + --> matches.rs:199:9 | 199 | 0 ... 2 => println!("0 ... 2"), | ^^^^^^^ | = note: `-D match-overlapping-arm` implied by `-D warnings` note: overlaps with this - --> examples/matches.rs:198:9 + --> matches.rs:198:9 | 198 | 2 => println!("2"), | ^ error: some ranges overlap - --> examples/matches.rs:222:9 + --> matches.rs:222:9 | 222 | 0 .. 11 => println!("0 .. 11"), | ^^^^^^^ | = note: `-D match-overlapping-arm` implied by `-D warnings` note: overlaps with this - --> examples/matches.rs:223:9 + --> matches.rs:223:9 | 223 | 0 ... 11 => println!("0 ... 11"), | ^^^^^^^^ error: Err(_) will match all errors, maybe not a good idea - --> examples/matches.rs:240:9 + --> matches.rs:240:9 | 240 | Err(_) => panic!("err") | ^^^^^^ @@ -272,7 +272,7 @@ error: Err(_) will match all errors, maybe not a good idea = note: to remove this warning, match each error seperately or use unreachable macro error: Err(_) will match all errors, maybe not a good idea - --> examples/matches.rs:246:9 + --> matches.rs:246:9 | 246 | Err(_) => {panic!()} | ^^^^^^ @@ -281,7 +281,7 @@ error: Err(_) will match all errors, maybe not a good idea = note: to remove this warning, match each error seperately or use unreachable macro error: Err(_) will match all errors, maybe not a good idea - --> examples/matches.rs:252:9 + --> matches.rs:252:9 | 252 | Err(_) => {panic!();} | ^^^^^^ diff --git a/clippy_tests/examples/mem_forget.stderr b/clippy_tests/examples/mem_forget.stderr index 9bbe6d85b06..97c791aa121 100644 --- a/clippy_tests/examples/mem_forget.stderr +++ b/clippy_tests/examples/mem_forget.stderr @@ -1,5 +1,5 @@ error: usage of mem::forget on Drop type - --> examples/mem_forget.rs:18:5 + --> mem_forget.rs:18:5 | 18 | memstuff::forget(six); | ^^^^^^^^^^^^^^^^^^^^^ @@ -7,7 +7,7 @@ error: usage of mem::forget on Drop type = note: `-D mem-forget` implied by `-D warnings` error: usage of mem::forget on Drop type - --> examples/mem_forget.rs:21:5 + --> mem_forget.rs:21:5 | 21 | std::mem::forget(seven); | ^^^^^^^^^^^^^^^^^^^^^^^ @@ -15,7 +15,7 @@ error: usage of mem::forget on Drop type = note: `-D mem-forget` implied by `-D warnings` error: usage of mem::forget on Drop type - --> examples/mem_forget.rs:24:5 + --> mem_forget.rs:24:5 | 24 | forgetSomething(eight); | ^^^^^^^^^^^^^^^^^^^^^^ diff --git a/clippy_tests/examples/methods.stderr b/clippy_tests/examples/methods.stderr index d68f4e2e931..ce4cd3ea859 100644 --- a/clippy_tests/examples/methods.stderr +++ b/clippy_tests/examples/methods.stderr @@ -1,5 +1,5 @@ error: defining a method called `add` on this type; consider implementing the `std::ops::Add` trait or choosing a less ambiguous name - --> examples/methods.rs:18:5 + --> methods.rs:18:5 | 18 | fn add(self, other: T) -> T { self } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -7,7 +7,7 @@ error: defining a method called `add` on this type; consider implementing the `s = note: `-D should-implement-trait` implied by `-D warnings` error: defining a method called `drop` on this type; consider implementing the `std::ops::Drop` trait or choosing a less ambiguous name - --> examples/methods.rs:19:5 + --> methods.rs:19:5 | 19 | fn drop(&mut self) { } | ^^^^^^^^^^^^^^^^^^^^^^ @@ -15,7 +15,7 @@ error: defining a method called `drop` on this type; consider implementing the ` = note: `-D should-implement-trait` implied by `-D warnings` error: methods called `into_*` usually take self by value; consider choosing a less ambiguous name - --> examples/methods.rs:26:17 + --> methods.rs:26:17 | 26 | fn into_u16(&self) -> u16 { 0 } | ^^^^^ @@ -23,7 +23,7 @@ error: methods called `into_*` usually take self by value; consider choosing a l = note: `-D wrong-self-convention` implied by `-D warnings` error: methods called `to_*` usually take self by reference; consider choosing a less ambiguous name - --> examples/methods.rs:28:21 + --> methods.rs:28:21 | 28 | fn to_something(self) -> u32 { 0 } | ^^^^ @@ -31,7 +31,7 @@ error: methods called `to_*` usually take self by reference; consider choosing a = note: `-D wrong-self-convention` implied by `-D warnings` error: methods called `new` usually take no self; consider choosing a less ambiguous name - --> examples/methods.rs:30:12 + --> methods.rs:30:12 | 30 | fn new(self) {} | ^^^^ @@ -39,7 +39,7 @@ error: methods called `new` usually take no self; consider choosing a less ambig = note: `-D wrong-self-convention` implied by `-D warnings` error: methods called `new` usually return `Self` - --> examples/methods.rs:30:5 + --> methods.rs:30:5 | 30 | fn new(self) {} | ^^^^^^^^^^^^^^^ @@ -47,7 +47,7 @@ error: methods called `new` usually return `Self` = note: `-D new-ret-no-self` implied by `-D warnings` error: called `map(f).unwrap_or(a)` on an Option value. This can be done more directly by calling `map_or(a, f)` instead - --> examples/methods.rs:97:13 + --> methods.rs:97:13 | 97 | let _ = opt.map(|x| x + 1) | _____________^ @@ -59,7 +59,7 @@ error: called `map(f).unwrap_or(a)` on an Option value. This can be done more di = note: replace `map(|x| x + 1).unwrap_or(0)` with `map_or(0, |x| x + 1)` error: called `map(f).unwrap_or(a)` on an Option value. This can be done more directly by calling `map_or(a, f)` instead - --> examples/methods.rs:101:13 + --> methods.rs:101:13 | 101 | let _ = opt.map(|x| { | _____________^ @@ -71,7 +71,7 @@ error: called `map(f).unwrap_or(a)` on an Option value. This can be done more di = note: `-D option-map-unwrap-or` implied by `-D warnings` error: called `map(f).unwrap_or(a)` on an Option value. This can be done more directly by calling `map_or(a, f)` instead - --> examples/methods.rs:105:13 + --> methods.rs:105:13 | 105 | let _ = opt.map(|x| x + 1) | _____________^ @@ -83,7 +83,7 @@ error: called `map(f).unwrap_or(a)` on an Option value. This can be done more di = note: `-D option-map-unwrap-or` implied by `-D warnings` error: called `map(f).unwrap_or_else(g)` on an Option value. This can be done more directly by calling `map_or_else(g, f)` instead - --> examples/methods.rs:114:13 + --> methods.rs:114:13 | 114 | let _ = opt.map(|x| x + 1) | _____________^ @@ -95,7 +95,7 @@ error: called `map(f).unwrap_or_else(g)` on an Option value. This can be done mo = note: replace `map(|x| x + 1).unwrap_or_else(|| 0)` with `map_or_else(|| 0, |x| x + 1)` error: called `map(f).unwrap_or_else(g)` on an Option value. This can be done more directly by calling `map_or_else(g, f)` instead - --> examples/methods.rs:118:13 + --> methods.rs:118:13 | 118 | let _ = opt.map(|x| { | _____________^ @@ -107,7 +107,7 @@ error: called `map(f).unwrap_or_else(g)` on an Option value. This can be done mo = note: `-D option-map-unwrap-or-else` implied by `-D warnings` error: called `map(f).unwrap_or_else(g)` on an Option value. This can be done more directly by calling `map_or_else(g, f)` instead - --> examples/methods.rs:122:13 + --> methods.rs:122:13 | 122 | let _ = opt.map(|x| x + 1) | _____________^ @@ -119,7 +119,7 @@ error: called `map(f).unwrap_or_else(g)` on an Option value. This can be done mo = note: `-D option-map-unwrap-or-else` implied by `-D warnings` error: called `filter(p).next()` on an `Iterator`. This is more succinctly expressed by calling `.find(p)` instead. - --> examples/methods.rs:194:13 + --> methods.rs:194:13 | 194 | let _ = v.iter().filter(|&x| *x < 0).next(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -128,7 +128,7 @@ error: called `filter(p).next()` on an `Iterator`. This is more succinctly expre = note: replace `filter(|&x| *x < 0).next()` with `find(|&x| *x < 0)` error: called `filter(p).next()` on an `Iterator`. This is more succinctly expressed by calling `.find(p)` instead. - --> examples/methods.rs:197:13 + --> methods.rs:197:13 | 197 | let _ = v.iter().filter(|&x| { | _____________^ @@ -140,7 +140,7 @@ error: called `filter(p).next()` on an `Iterator`. This is more succinctly expre = note: `-D filter-next` implied by `-D warnings` error: called `is_some()` after searching an `Iterator` with find. This is more succinctly expressed by calling `any()`. - --> examples/methods.rs:212:13 + --> methods.rs:212:13 | 212 | let _ = v.iter().find(|&x| *x < 0).is_some(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -149,7 +149,7 @@ error: called `is_some()` after searching an `Iterator` with find. This is more = note: replace `find(|&x| *x < 0).is_some()` with `any(|&x| *x < 0)` error: called `is_some()` after searching an `Iterator` with find. This is more succinctly expressed by calling `any()`. - --> examples/methods.rs:215:13 + --> methods.rs:215:13 | 215 | let _ = v.iter().find(|&x| { | _____________^ @@ -161,7 +161,7 @@ error: called `is_some()` after searching an `Iterator` with find. This is more = note: `-D search-is-some` implied by `-D warnings` error: called `is_some()` after searching an `Iterator` with position. This is more succinctly expressed by calling `any()`. - --> examples/methods.rs:221:13 + --> methods.rs:221:13 | 221 | let _ = v.iter().position(|&x| x < 0).is_some(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -170,7 +170,7 @@ error: called `is_some()` after searching an `Iterator` with position. This is m = note: replace `position(|&x| x < 0).is_some()` with `any(|&x| x < 0)` error: called `is_some()` after searching an `Iterator` with position. This is more succinctly expressed by calling `any()`. - --> examples/methods.rs:224:13 + --> methods.rs:224:13 | 224 | let _ = v.iter().position(|&x| { | _____________^ @@ -182,7 +182,7 @@ error: called `is_some()` after searching an `Iterator` with position. This is m = note: `-D search-is-some` implied by `-D warnings` error: called `is_some()` after searching an `Iterator` with rposition. This is more succinctly expressed by calling `any()`. - --> examples/methods.rs:230:13 + --> methods.rs:230:13 | 230 | let _ = v.iter().rposition(|&x| x < 0).is_some(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -191,7 +191,7 @@ error: called `is_some()` after searching an `Iterator` with rposition. This is = note: replace `rposition(|&x| x < 0).is_some()` with `any(|&x| x < 0)` error: called `is_some()` after searching an `Iterator` with rposition. This is more succinctly expressed by calling `any()`. - --> examples/methods.rs:233:13 + --> methods.rs:233:13 | 233 | let _ = v.iter().rposition(|&x| { | _____________^ @@ -203,7 +203,7 @@ error: called `is_some()` after searching an `Iterator` with rposition. This is = note: `-D search-is-some` implied by `-D warnings` error: use of `unwrap_or` followed by a function call - --> examples/methods.rs:268:5 + --> methods.rs:268:5 | 268 | with_constructor.unwrap_or(make()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this `with_constructor.unwrap_or_else(make)` @@ -211,7 +211,7 @@ error: use of `unwrap_or` followed by a function call = note: `-D or-fun-call` implied by `-D warnings` error: use of `unwrap_or` followed by a call to `new` - --> examples/methods.rs:271:5 + --> methods.rs:271:5 | 271 | with_new.unwrap_or(Vec::new()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this `with_new.unwrap_or_default()` @@ -219,7 +219,7 @@ error: use of `unwrap_or` followed by a call to `new` = note: `-D or-fun-call` implied by `-D warnings` error: use of `unwrap_or` followed by a function call - --> examples/methods.rs:274:5 + --> methods.rs:274:5 | 274 | with_const_args.unwrap_or(Vec::with_capacity(12)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this `with_const_args.unwrap_or_else(|| Vec::with_capacity(12))` @@ -227,7 +227,7 @@ error: use of `unwrap_or` followed by a function call = note: `-D or-fun-call` implied by `-D warnings` error: use of `unwrap_or` followed by a function call - --> examples/methods.rs:277:5 + --> methods.rs:277:5 | 277 | with_err.unwrap_or(make()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this `with_err.unwrap_or_else(|_| make())` @@ -235,7 +235,7 @@ error: use of `unwrap_or` followed by a function call = note: `-D or-fun-call` implied by `-D warnings` error: use of `unwrap_or` followed by a function call - --> examples/methods.rs:280:5 + --> methods.rs:280:5 | 280 | with_err_args.unwrap_or(Vec::with_capacity(12)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this `with_err_args.unwrap_or_else(|_| Vec::with_capacity(12))` @@ -243,7 +243,7 @@ error: use of `unwrap_or` followed by a function call = note: `-D or-fun-call` implied by `-D warnings` error: use of `unwrap_or` followed by a call to `default` - --> examples/methods.rs:283:5 + --> methods.rs:283:5 | 283 | with_default_trait.unwrap_or(Default::default()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this `with_default_trait.unwrap_or_default()` @@ -251,7 +251,7 @@ error: use of `unwrap_or` followed by a call to `default` = note: `-D or-fun-call` implied by `-D warnings` error: use of `unwrap_or` followed by a call to `default` - --> examples/methods.rs:286:5 + --> methods.rs:286:5 | 286 | with_default_type.unwrap_or(u64::default()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this `with_default_type.unwrap_or_default()` @@ -259,7 +259,7 @@ error: use of `unwrap_or` followed by a call to `default` = note: `-D or-fun-call` implied by `-D warnings` error: use of `unwrap_or` followed by a function call - --> examples/methods.rs:289:5 + --> methods.rs:289:5 | 289 | with_vec.unwrap_or(vec![]); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this `with_vec.unwrap_or_else(|| < [ _ ] > :: into_vec ( box [ $ ( $ x ) , * ] ))` @@ -267,7 +267,7 @@ error: use of `unwrap_or` followed by a function call = note: `-D or-fun-call` implied by `-D warnings` error: use of `unwrap_or` followed by a function call - --> examples/methods.rs:294:5 + --> methods.rs:294:5 | 294 | without_default.unwrap_or(Foo::new()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this `without_default.unwrap_or_else(Foo::new)` @@ -275,7 +275,7 @@ error: use of `unwrap_or` followed by a function call = note: `-D or-fun-call` implied by `-D warnings` error: use of `or_insert` followed by a function call - --> examples/methods.rs:297:5 + --> methods.rs:297:5 | 297 | map.entry(42).or_insert(String::new()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this `map.entry(42).or_insert_with(String::new)` @@ -283,7 +283,7 @@ error: use of `or_insert` followed by a function call = note: `-D or-fun-call` implied by `-D warnings` error: use of `or_insert` followed by a function call - --> examples/methods.rs:300:5 + --> methods.rs:300:5 | 300 | btree.entry(42).or_insert(String::new()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this `btree.entry(42).or_insert_with(String::new)` @@ -291,7 +291,7 @@ error: use of `or_insert` followed by a function call = note: `-D or-fun-call` implied by `-D warnings` error: use of `unwrap_or` followed by a function call - --> examples/methods.rs:303:13 + --> methods.rs:303:13 | 303 | let _ = stringy.unwrap_or("".to_owned()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this `stringy.unwrap_or_else(|| "".to_owned())` @@ -299,7 +299,7 @@ error: use of `unwrap_or` followed by a function call = note: `-D or-fun-call` implied by `-D warnings` error: called `.iter().nth()` on a Vec. Calling `.get()` is both faster and more readable - --> examples/methods.rs:314:23 + --> methods.rs:314:23 | 314 | let bad_vec = some_vec.iter().nth(3); | ^^^^^^^^^^^^^^^^^^^^^^ @@ -307,7 +307,7 @@ error: called `.iter().nth()` on a Vec. Calling `.get()` is both faster and more = note: `-D iter-nth` implied by `-D warnings` error: called `.iter().nth()` on a slice. Calling `.get()` is both faster and more readable - --> examples/methods.rs:315:26 + --> methods.rs:315:26 | 315 | let bad_slice = &some_vec[..].iter().nth(3); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -315,7 +315,7 @@ error: called `.iter().nth()` on a slice. Calling `.get()` is both faster and mo = note: `-D iter-nth` implied by `-D warnings` error: called `.iter().nth()` on a slice. Calling `.get()` is both faster and more readable - --> examples/methods.rs:316:31 + --> methods.rs:316:31 | 316 | let bad_boxed_slice = boxed_slice.iter().nth(3); | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -323,7 +323,7 @@ error: called `.iter().nth()` on a slice. Calling `.get()` is both faster and mo = note: `-D iter-nth` implied by `-D warnings` error: called `.iter().nth()` on a VecDeque. Calling `.get()` is both faster and more readable - --> examples/methods.rs:317:29 + --> methods.rs:317:29 | 317 | let bad_vec_deque = some_vec_deque.iter().nth(3); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -331,7 +331,7 @@ error: called `.iter().nth()` on a VecDeque. Calling `.get()` is both faster and = note: `-D iter-nth` implied by `-D warnings` error: called `.iter_mut().nth()` on a Vec. Calling `.get_mut()` is both faster and more readable - --> examples/methods.rs:322:23 + --> methods.rs:322:23 | 322 | let bad_vec = some_vec.iter_mut().nth(3); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -339,7 +339,7 @@ error: called `.iter_mut().nth()` on a Vec. Calling `.get_mut()` is both faster = note: `-D iter-nth` implied by `-D warnings` error: called `.iter_mut().nth()` on a slice. Calling `.get_mut()` is both faster and more readable - --> examples/methods.rs:325:26 + --> methods.rs:325:26 | 325 | let bad_slice = &some_vec[..].iter_mut().nth(3); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -347,7 +347,7 @@ error: called `.iter_mut().nth()` on a slice. Calling `.get_mut()` is both faste = note: `-D iter-nth` implied by `-D warnings` error: called `.iter_mut().nth()` on a VecDeque. Calling `.get_mut()` is both faster and more readable - --> examples/methods.rs:328:29 + --> methods.rs:328:29 | 328 | let bad_vec_deque = some_vec_deque.iter_mut().nth(3); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -355,7 +355,7 @@ error: called `.iter_mut().nth()` on a VecDeque. Calling `.get_mut()` is both fa = note: `-D iter-nth` implied by `-D warnings` error: called `skip(x).next()` on an iterator. This is more succinctly expressed by calling `nth(x)` - --> examples/methods.rs:340:13 + --> methods.rs:340:13 | 340 | let _ = some_vec.iter().skip(42).next(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -363,7 +363,7 @@ error: called `skip(x).next()` on an iterator. This is more succinctly expressed = note: `-D iter-skip-next` implied by `-D warnings` error: called `skip(x).next()` on an iterator. This is more succinctly expressed by calling `nth(x)` - --> examples/methods.rs:341:13 + --> methods.rs:341:13 | 341 | let _ = some_vec.iter().cycle().skip(42).next(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -371,7 +371,7 @@ error: called `skip(x).next()` on an iterator. This is more succinctly expressed = note: `-D iter-skip-next` implied by `-D warnings` error: called `skip(x).next()` on an iterator. This is more succinctly expressed by calling `nth(x)` - --> examples/methods.rs:342:13 + --> methods.rs:342:13 | 342 | let _ = (1..10).skip(10).next(); | ^^^^^^^^^^^^^^^^^^^^^^^ @@ -379,7 +379,7 @@ error: called `skip(x).next()` on an iterator. This is more succinctly expressed = note: `-D iter-skip-next` implied by `-D warnings` error: called `skip(x).next()` on an iterator. This is more succinctly expressed by calling `nth(x)` - --> examples/methods.rs:343:14 + --> methods.rs:343:14 | 343 | let _ = &some_vec[..].iter().skip(3).next(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -387,7 +387,7 @@ error: called `skip(x).next()` on an iterator. This is more succinctly expressed = note: `-D iter-skip-next` implied by `-D warnings` error: called `.get().unwrap()` on a slice. Using `[]` is more clear and more concise - --> examples/methods.rs:369:17 + --> methods.rs:369:17 | 369 | let _ = boxed_slice.get(1).unwrap(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this `&boxed_slice[1]` @@ -395,7 +395,7 @@ error: called `.get().unwrap()` on a slice. Using `[]` is more clear and more co = note: `-D get-unwrap` implied by `-D warnings` error: called `.get().unwrap()` on a slice. Using `[]` is more clear and more concise - --> examples/methods.rs:370:17 + --> methods.rs:370:17 | 370 | let _ = some_slice.get(0).unwrap(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this `&some_slice[0]` @@ -403,7 +403,7 @@ error: called `.get().unwrap()` on a slice. Using `[]` is more clear and more co = note: `-D get-unwrap` implied by `-D warnings` error: called `.get().unwrap()` on a Vec. Using `[]` is more clear and more concise - --> examples/methods.rs:371:17 + --> methods.rs:371:17 | 371 | let _ = some_vec.get(0).unwrap(); | ^^^^^^^^^^^^^^^^^^^^^^^^ help: try this `&some_vec[0]` @@ -411,7 +411,7 @@ error: called `.get().unwrap()` on a Vec. Using `[]` is more clear and more conc = note: `-D get-unwrap` implied by `-D warnings` error: called `.get().unwrap()` on a VecDeque. Using `[]` is more clear and more concise - --> examples/methods.rs:372:17 + --> methods.rs:372:17 | 372 | let _ = some_vecdeque.get(0).unwrap(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this `&some_vecdeque[0]` @@ -419,7 +419,7 @@ error: called `.get().unwrap()` on a VecDeque. Using `[]` is more clear and more = note: `-D get-unwrap` implied by `-D warnings` error: called `.get().unwrap()` on a HashMap. Using `[]` is more clear and more concise - --> examples/methods.rs:373:17 + --> methods.rs:373:17 | 373 | let _ = some_hashmap.get(&1).unwrap(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this `&some_hashmap[&1]` @@ -427,7 +427,7 @@ error: called `.get().unwrap()` on a HashMap. Using `[]` is more clear and more = note: `-D get-unwrap` implied by `-D warnings` error: called `.get().unwrap()` on a BTreeMap. Using `[]` is more clear and more concise - --> examples/methods.rs:374:17 + --> methods.rs:374:17 | 374 | let _ = some_btreemap.get(&1).unwrap(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this `&some_btreemap[&1]` @@ -435,7 +435,7 @@ error: called `.get().unwrap()` on a BTreeMap. Using `[]` is more clear and more = note: `-D get-unwrap` implied by `-D warnings` error: called `.get_mut().unwrap()` on a slice. Using `[]` is more clear and more concise - --> examples/methods.rs:379:10 + --> methods.rs:379:10 | 379 | *boxed_slice.get_mut(0).unwrap() = 1; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this `&mut boxed_slice[0]` @@ -443,7 +443,7 @@ error: called `.get_mut().unwrap()` on a slice. Using `[]` is more clear and mor = note: `-D get-unwrap` implied by `-D warnings` error: called `.get_mut().unwrap()` on a slice. Using `[]` is more clear and more concise - --> examples/methods.rs:380:10 + --> methods.rs:380:10 | 380 | *some_slice.get_mut(0).unwrap() = 1; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this `&mut some_slice[0]` @@ -451,7 +451,7 @@ error: called `.get_mut().unwrap()` on a slice. Using `[]` is more clear and mor = note: `-D get-unwrap` implied by `-D warnings` error: called `.get_mut().unwrap()` on a Vec. Using `[]` is more clear and more concise - --> examples/methods.rs:381:10 + --> methods.rs:381:10 | 381 | *some_vec.get_mut(0).unwrap() = 1; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this `&mut some_vec[0]` @@ -459,7 +459,7 @@ error: called `.get_mut().unwrap()` on a Vec. Using `[]` is more clear and more = note: `-D get-unwrap` implied by `-D warnings` error: called `.get_mut().unwrap()` on a VecDeque. Using `[]` is more clear and more concise - --> examples/methods.rs:382:10 + --> methods.rs:382:10 | 382 | *some_vecdeque.get_mut(0).unwrap() = 1; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this `&mut some_vecdeque[0]` @@ -467,7 +467,7 @@ error: called `.get_mut().unwrap()` on a VecDeque. Using `[]` is more clear and = note: `-D get-unwrap` implied by `-D warnings` error: used unwrap() on an Option value. If you don't want to handle the None case gracefully, consider using expect() to provide a better panic message - --> examples/methods.rs:396:13 + --> methods.rs:396:13 | 396 | let _ = opt.unwrap(); | ^^^^^^^^^^^^ @@ -475,7 +475,7 @@ error: used unwrap() on an Option value. If you don't want to handle the None ca = note: `-D option-unwrap-used` implied by `-D warnings` error: used unwrap() on a Result value. If you don't want to handle the Err case gracefully, consider using expect() to provide a better panic message - --> examples/methods.rs:399:13 + --> methods.rs:399:13 | 399 | let _ = res.unwrap(); | ^^^^^^^^^^^^ @@ -483,7 +483,7 @@ error: used unwrap() on a Result value. If you don't want to handle the Err case = note: `-D result-unwrap-used` implied by `-D warnings` error: called `ok().expect()` on a Result value. You can call `expect` directly on the `Result` - --> examples/methods.rs:401:5 + --> methods.rs:401:5 | 401 | res.ok().expect("disaster!"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -491,7 +491,7 @@ error: called `ok().expect()` on a Result value. You can call `expect` directly = note: `-D ok-expect` implied by `-D warnings` error: called `ok().expect()` on a Result value. You can call `expect` directly on the `Result` - --> examples/methods.rs:407:5 + --> methods.rs:407:5 | 407 | res3.ok().expect("whoof"); | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -499,7 +499,7 @@ error: called `ok().expect()` on a Result value. You can call `expect` directly = note: `-D ok-expect` implied by `-D warnings` error: called `ok().expect()` on a Result value. You can call `expect` directly on the `Result` - --> examples/methods.rs:409:5 + --> methods.rs:409:5 | 409 | res4.ok().expect("argh"); | ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -507,7 +507,7 @@ error: called `ok().expect()` on a Result value. You can call `expect` directly = note: `-D ok-expect` implied by `-D warnings` error: called `ok().expect()` on a Result value. You can call `expect` directly on the `Result` - --> examples/methods.rs:411:5 + --> methods.rs:411:5 | 411 | res5.ok().expect("oops"); | ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -515,7 +515,7 @@ error: called `ok().expect()` on a Result value. You can call `expect` directly = note: `-D ok-expect` implied by `-D warnings` error: called `ok().expect()` on a Result value. You can call `expect` directly on the `Result` - --> examples/methods.rs:413:5 + --> methods.rs:413:5 | 413 | res6.ok().expect("meh"); | ^^^^^^^^^^^^^^^^^^^^^^^ @@ -523,7 +523,7 @@ error: called `ok().expect()` on a Result value. You can call `expect` directly = note: `-D ok-expect` implied by `-D warnings` error: you should use the `starts_with` method - --> examples/methods.rs:425:5 + --> methods.rs:425:5 | 425 | "".chars().next() == Some(' '); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: like this `"".starts_with(' ')` @@ -531,7 +531,7 @@ error: you should use the `starts_with` method = note: `-D chars-next-cmp` implied by `-D warnings` error: you should use the `starts_with` method - --> examples/methods.rs:426:5 + --> methods.rs:426:5 | 426 | Some(' ') != "".chars().next(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: like this `!"".starts_with(' ')` @@ -539,7 +539,7 @@ error: you should use the `starts_with` method = note: `-D chars-next-cmp` implied by `-D warnings` error: calling `.extend(_.chars())` - --> examples/methods.rs:435:5 + --> methods.rs:435:5 | 435 | s.extend(abc.chars()); | ^^^^^^^^^^^^^^^^^^^^^ help: try this `s.push_str(abc)` @@ -547,7 +547,7 @@ error: calling `.extend(_.chars())` = note: `-D string-extend-chars` implied by `-D warnings` error: calling `.extend(_.chars())` - --> examples/methods.rs:438:5 + --> methods.rs:438:5 | 438 | s.extend("abc".chars()); | ^^^^^^^^^^^^^^^^^^^^^^^ help: try this `s.push_str("abc")` @@ -555,7 +555,7 @@ error: calling `.extend(_.chars())` = note: `-D string-extend-chars` implied by `-D warnings` error: calling `.extend(_.chars())` - --> examples/methods.rs:441:5 + --> methods.rs:441:5 | 441 | s.extend(def.chars()); | ^^^^^^^^^^^^^^^^^^^^^ help: try this `s.push_str(&def)` @@ -563,7 +563,7 @@ error: calling `.extend(_.chars())` = note: `-D string-extend-chars` implied by `-D warnings` error: using `clone` on a `Copy` type - --> examples/methods.rs:452:5 + --> methods.rs:452:5 | 452 | 42.clone(); | ^^^^^^^^^^ help: try removing the `clone` call `42` @@ -571,7 +571,7 @@ error: using `clone` on a `Copy` type = note: `-D clone-on-copy` implied by `-D warnings` error: using `clone` on a `Copy` type - --> examples/methods.rs:456:5 + --> methods.rs:456:5 | 456 | (&42).clone(); | ^^^^^^^^^^^^^ help: try dereferencing it `*(&42)` @@ -579,7 +579,7 @@ error: using `clone` on a `Copy` type = note: `-D clone-on-copy` implied by `-D warnings` error: using `clone` on a `Copy` type - --> examples/methods.rs:460:5 + --> methods.rs:460:5 | 460 | t.clone(); | ^^^^^^^^^ help: try removing the `clone` call `t` @@ -587,7 +587,7 @@ error: using `clone` on a `Copy` type = note: `-D clone-on-copy` implied by `-D warnings` error: using `clone` on a `Copy` type - --> examples/methods.rs:462:5 + --> methods.rs:462:5 | 462 | Some(t).clone(); | ^^^^^^^^^^^^^^^ help: try removing the `clone` call `Some(t)` @@ -595,7 +595,7 @@ error: using `clone` on a `Copy` type = note: `-D clone-on-copy` implied by `-D warnings` error: using `clone` on a double-reference; this will copy the reference instead of cloning the inner type - --> examples/methods.rs:468:22 + --> methods.rs:468:22 | 468 | let z: &Vec<_> = y.clone(); | ^^^^^^^^^ help: try dereferencing it `(*y).clone()` @@ -603,7 +603,7 @@ error: using `clone` on a double-reference; this will copy the reference instead = note: `-D clone-double-ref` implied by `-D warnings` error: single-character string constant used as pattern - --> examples/methods.rs:475:13 + --> methods.rs:475:13 | 475 | x.split("x"); | --------^^^- help: try using a char instead: `x.split('x')` @@ -611,7 +611,7 @@ error: single-character string constant used as pattern = note: `-D single-char-pattern` implied by `-D warnings` error: single-character string constant used as pattern - --> examples/methods.rs:492:16 + --> methods.rs:492:16 | 492 | x.contains("x"); | -----------^^^- help: try using a char instead: `x.contains('x')` @@ -619,7 +619,7 @@ error: single-character string constant used as pattern = note: `-D single-char-pattern` implied by `-D warnings` error: single-character string constant used as pattern - --> examples/methods.rs:493:19 + --> methods.rs:493:19 | 493 | x.starts_with("x"); | --------------^^^- help: try using a char instead: `x.starts_with('x')` @@ -627,7 +627,7 @@ error: single-character string constant used as pattern = note: `-D single-char-pattern` implied by `-D warnings` error: single-character string constant used as pattern - --> examples/methods.rs:494:17 + --> methods.rs:494:17 | 494 | x.ends_with("x"); | ------------^^^- help: try using a char instead: `x.ends_with('x')` @@ -635,7 +635,7 @@ error: single-character string constant used as pattern = note: `-D single-char-pattern` implied by `-D warnings` error: single-character string constant used as pattern - --> examples/methods.rs:495:12 + --> methods.rs:495:12 | 495 | x.find("x"); | -------^^^- help: try using a char instead: `x.find('x')` @@ -643,7 +643,7 @@ error: single-character string constant used as pattern = note: `-D single-char-pattern` implied by `-D warnings` error: single-character string constant used as pattern - --> examples/methods.rs:496:13 + --> methods.rs:496:13 | 496 | x.rfind("x"); | --------^^^- help: try using a char instead: `x.rfind('x')` @@ -651,7 +651,7 @@ error: single-character string constant used as pattern = note: `-D single-char-pattern` implied by `-D warnings` error: single-character string constant used as pattern - --> examples/methods.rs:497:14 + --> methods.rs:497:14 | 497 | x.rsplit("x"); | ---------^^^- help: try using a char instead: `x.rsplit('x')` @@ -659,7 +659,7 @@ error: single-character string constant used as pattern = note: `-D single-char-pattern` implied by `-D warnings` error: single-character string constant used as pattern - --> examples/methods.rs:498:24 + --> methods.rs:498:24 | 498 | x.split_terminator("x"); | -------------------^^^- help: try using a char instead: `x.split_terminator('x')` @@ -667,7 +667,7 @@ error: single-character string constant used as pattern = note: `-D single-char-pattern` implied by `-D warnings` error: single-character string constant used as pattern - --> examples/methods.rs:499:25 + --> methods.rs:499:25 | 499 | x.rsplit_terminator("x"); | --------------------^^^- help: try using a char instead: `x.rsplit_terminator('x')` @@ -675,7 +675,7 @@ error: single-character string constant used as pattern = note: `-D single-char-pattern` implied by `-D warnings` error: single-character string constant used as pattern - --> examples/methods.rs:500:17 + --> methods.rs:500:17 | 500 | x.splitn(0, "x"); | ------------^^^- help: try using a char instead: `x.splitn(0, 'x')` @@ -683,7 +683,7 @@ error: single-character string constant used as pattern = note: `-D single-char-pattern` implied by `-D warnings` error: single-character string constant used as pattern - --> examples/methods.rs:501:18 + --> methods.rs:501:18 | 501 | x.rsplitn(0, "x"); | -------------^^^- help: try using a char instead: `x.rsplitn(0, 'x')` @@ -691,7 +691,7 @@ error: single-character string constant used as pattern = note: `-D single-char-pattern` implied by `-D warnings` error: single-character string constant used as pattern - --> examples/methods.rs:502:15 + --> methods.rs:502:15 | 502 | x.matches("x"); | ----------^^^- help: try using a char instead: `x.matches('x')` @@ -699,7 +699,7 @@ error: single-character string constant used as pattern = note: `-D single-char-pattern` implied by `-D warnings` error: single-character string constant used as pattern - --> examples/methods.rs:503:16 + --> methods.rs:503:16 | 503 | x.rmatches("x"); | -----------^^^- help: try using a char instead: `x.rmatches('x')` @@ -707,7 +707,7 @@ error: single-character string constant used as pattern = note: `-D single-char-pattern` implied by `-D warnings` error: single-character string constant used as pattern - --> examples/methods.rs:504:21 + --> methods.rs:504:21 | 504 | x.match_indices("x"); | ----------------^^^- help: try using a char instead: `x.match_indices('x')` @@ -715,7 +715,7 @@ error: single-character string constant used as pattern = note: `-D single-char-pattern` implied by `-D warnings` error: single-character string constant used as pattern - --> examples/methods.rs:505:22 + --> methods.rs:505:22 | 505 | x.rmatch_indices("x"); | -----------------^^^- help: try using a char instead: `x.rmatch_indices('x')` @@ -723,7 +723,7 @@ error: single-character string constant used as pattern = note: `-D single-char-pattern` implied by `-D warnings` error: single-character string constant used as pattern - --> examples/methods.rs:506:25 + --> methods.rs:506:25 | 506 | x.trim_left_matches("x"); | --------------------^^^- help: try using a char instead: `x.trim_left_matches('x')` @@ -731,7 +731,7 @@ error: single-character string constant used as pattern = note: `-D single-char-pattern` implied by `-D warnings` error: single-character string constant used as pattern - --> examples/methods.rs:507:26 + --> methods.rs:507:26 | 507 | x.trim_right_matches("x"); | ---------------------^^^- help: try using a char instead: `x.trim_right_matches('x')` @@ -739,7 +739,7 @@ error: single-character string constant used as pattern = note: `-D single-char-pattern` implied by `-D warnings` error: you are getting the inner pointer of a temporary `CString` - --> examples/methods.rs:517:5 + --> methods.rs:517:5 | 517 | CString::new("foo").unwrap().as_ptr(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -747,13 +747,13 @@ error: you are getting the inner pointer of a temporary `CString` = note: `-D temporary-cstring-as-ptr` implied by `-D warnings` = note: that pointer will be invalid outside this expression help: assign the `CString` to a variable to extend its lifetime - --> examples/methods.rs:517:5 + --> methods.rs:517:5 | 517 | CString::new("foo").unwrap().as_ptr(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: called `cloned().collect()` on a slice to create a `Vec`. Calling `to_vec()` is both faster and more readable - --> examples/methods.rs:522:27 + --> methods.rs:522:27 | 522 | let v2 : Vec = v.iter().cloned().collect(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/clippy_tests/examples/min_max.stderr b/clippy_tests/examples/min_max.stderr index 9df1aa7fa83..3fe4d848a71 100644 --- a/clippy_tests/examples/min_max.stderr +++ b/clippy_tests/examples/min_max.stderr @@ -1,5 +1,5 @@ error: this min/max combination leads to constant result - --> examples/min_max.rs:15:5 + --> min_max.rs:15:5 | 15 | min(1, max(3, x)); | ^^^^^^^^^^^^^^^^^ @@ -7,7 +7,7 @@ error: this min/max combination leads to constant result = note: `-D min-max` implied by `-D warnings` error: this min/max combination leads to constant result - --> examples/min_max.rs:16:5 + --> min_max.rs:16:5 | 16 | min(max(3, x), 1); | ^^^^^^^^^^^^^^^^^ @@ -15,7 +15,7 @@ error: this min/max combination leads to constant result = note: `-D min-max` implied by `-D warnings` error: this min/max combination leads to constant result - --> examples/min_max.rs:17:5 + --> min_max.rs:17:5 | 17 | max(min(x, 1), 3); | ^^^^^^^^^^^^^^^^^ @@ -23,7 +23,7 @@ error: this min/max combination leads to constant result = note: `-D min-max` implied by `-D warnings` error: this min/max combination leads to constant result - --> examples/min_max.rs:18:5 + --> min_max.rs:18:5 | 18 | max(3, min(x, 1)); | ^^^^^^^^^^^^^^^^^ @@ -31,7 +31,7 @@ error: this min/max combination leads to constant result = note: `-D min-max` implied by `-D warnings` error: this min/max combination leads to constant result - --> examples/min_max.rs:20:5 + --> min_max.rs:20:5 | 20 | my_max(3, my_min(x, 1)); | ^^^^^^^^^^^^^^^^^^^^^^^ @@ -39,7 +39,7 @@ error: this min/max combination leads to constant result = note: `-D min-max` implied by `-D warnings` error: this min/max combination leads to constant result - --> examples/min_max.rs:29:5 + --> min_max.rs:29:5 | 29 | min("Apple", max("Zoo", s)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -47,7 +47,7 @@ error: this min/max combination leads to constant result = note: `-D min-max` implied by `-D warnings` error: this min/max combination leads to constant result - --> examples/min_max.rs:30:5 + --> min_max.rs:30:5 | 30 | max(min(s, "Apple"), "Zoo"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/clippy_tests/examples/missing-doc.stderr b/clippy_tests/examples/missing-doc.stderr index 8e032b0c3cb..44269838573 100644 --- a/clippy_tests/examples/missing-doc.stderr +++ b/clippy_tests/examples/missing-doc.stderr @@ -1,5 +1,5 @@ error: missing documentation for a type alias - --> examples/missing-doc.rs:26:1 + --> missing-doc.rs:26:1 | 26 | type Typedef = String; | ^^^^^^^^^^^^^^^^^^^^^^ @@ -7,7 +7,7 @@ error: missing documentation for a type alias = note: `-D missing-docs-in-private-items` implied by `-D warnings` error: missing documentation for a type alias - --> examples/missing-doc.rs:27:1 + --> missing-doc.rs:27:1 | 27 | pub type PubTypedef = String; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -15,7 +15,7 @@ error: missing documentation for a type alias = note: `-D missing-docs-in-private-items` implied by `-D warnings` error: missing documentation for a struct - --> examples/missing-doc.rs:29:1 + --> missing-doc.rs:29:1 | 29 | / struct Foo { 30 | | a: isize, @@ -26,7 +26,7 @@ error: missing documentation for a struct = note: `-D missing-docs-in-private-items` implied by `-D warnings` error: missing documentation for a struct field - --> examples/missing-doc.rs:30:5 + --> missing-doc.rs:30:5 | 30 | a: isize, | ^^^^^^^^ @@ -34,7 +34,7 @@ error: missing documentation for a struct field = note: `-D missing-docs-in-private-items` implied by `-D warnings` error: missing documentation for a struct field - --> examples/missing-doc.rs:31:5 + --> missing-doc.rs:31:5 | 31 | b: isize, | ^^^^^^^^ @@ -42,7 +42,7 @@ error: missing documentation for a struct field = note: `-D missing-docs-in-private-items` implied by `-D warnings` error: missing documentation for a struct - --> examples/missing-doc.rs:34:1 + --> missing-doc.rs:34:1 | 34 | / pub struct PubFoo { 35 | | pub a: isize, @@ -53,7 +53,7 @@ error: missing documentation for a struct = note: `-D missing-docs-in-private-items` implied by `-D warnings` error: missing documentation for a struct field - --> examples/missing-doc.rs:35:5 + --> missing-doc.rs:35:5 | 35 | pub a: isize, | ^^^^^^^^^^^^ @@ -61,7 +61,7 @@ error: missing documentation for a struct field = note: `-D missing-docs-in-private-items` implied by `-D warnings` error: missing documentation for a struct field - --> examples/missing-doc.rs:36:5 + --> missing-doc.rs:36:5 | 36 | b: isize, | ^^^^^^^^ @@ -69,7 +69,7 @@ error: missing documentation for a struct field = note: `-D missing-docs-in-private-items` implied by `-D warnings` error: missing documentation for a module - --> examples/missing-doc.rs:45:1 + --> missing-doc.rs:45:1 | 45 | mod module_no_dox {} | ^^^^^^^^^^^^^^^^^^^^ @@ -77,7 +77,7 @@ error: missing documentation for a module = note: `-D missing-docs-in-private-items` implied by `-D warnings` error: missing documentation for a module - --> examples/missing-doc.rs:46:1 + --> missing-doc.rs:46:1 | 46 | pub mod pub_module_no_dox {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -85,7 +85,7 @@ error: missing documentation for a module = note: `-D missing-docs-in-private-items` implied by `-D warnings` error: missing documentation for a function - --> examples/missing-doc.rs:50:1 + --> missing-doc.rs:50:1 | 50 | pub fn foo2() {} | ^^^^^^^^^^^^^^^^ @@ -93,7 +93,7 @@ error: missing documentation for a function = note: `-D missing-docs-in-private-items` implied by `-D warnings` error: missing documentation for a function - --> examples/missing-doc.rs:51:1 + --> missing-doc.rs:51:1 | 51 | fn foo3() {} | ^^^^^^^^^^^^ @@ -101,7 +101,7 @@ error: missing documentation for a function = note: `-D missing-docs-in-private-items` implied by `-D warnings` error: missing documentation for a trait - --> examples/missing-doc.rs:68:1 + --> missing-doc.rs:68:1 | 68 | / pub trait C { 69 | | fn foo(&self); @@ -112,7 +112,7 @@ error: missing documentation for a trait = note: `-D missing-docs-in-private-items` implied by `-D warnings` error: missing documentation for a trait method - --> examples/missing-doc.rs:69:5 + --> missing-doc.rs:69:5 | 69 | fn foo(&self); | ^^^^^^^^^^^^^^ @@ -120,7 +120,7 @@ error: missing documentation for a trait method = note: `-D missing-docs-in-private-items` implied by `-D warnings` error: missing documentation for a trait method - --> examples/missing-doc.rs:70:5 + --> missing-doc.rs:70:5 | 70 | fn foo_with_impl(&self) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -128,7 +128,7 @@ error: missing documentation for a trait method = note: `-D missing-docs-in-private-items` implied by `-D warnings` error: missing documentation for an associated type - --> examples/missing-doc.rs:80:5 + --> missing-doc.rs:80:5 | 80 | type AssociatedType; | ^^^^^^^^^^^^^^^^^^^^ @@ -136,7 +136,7 @@ error: missing documentation for an associated type = note: `-D missing-docs-in-private-items` implied by `-D warnings` error: missing documentation for an associated type - --> examples/missing-doc.rs:81:5 + --> missing-doc.rs:81:5 | 81 | type AssociatedTypeDef = Self; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -144,7 +144,7 @@ error: missing documentation for an associated type = note: `-D missing-docs-in-private-items` implied by `-D warnings` error: missing documentation for a method - --> examples/missing-doc.rs:92:5 + --> missing-doc.rs:92:5 | 92 | pub fn foo() {} | ^^^^^^^^^^^^^^^ @@ -152,7 +152,7 @@ error: missing documentation for a method = note: `-D missing-docs-in-private-items` implied by `-D warnings` error: missing documentation for a method - --> examples/missing-doc.rs:93:5 + --> missing-doc.rs:93:5 | 93 | fn bar() {} | ^^^^^^^^^^^ @@ -160,7 +160,7 @@ error: missing documentation for a method = note: `-D missing-docs-in-private-items` implied by `-D warnings` error: missing documentation for a method - --> examples/missing-doc.rs:97:5 + --> missing-doc.rs:97:5 | 97 | pub fn foo() {} | ^^^^^^^^^^^^^^^ @@ -168,7 +168,7 @@ error: missing documentation for a method = note: `-D missing-docs-in-private-items` implied by `-D warnings` error: missing documentation for a method - --> examples/missing-doc.rs:100:5 + --> missing-doc.rs:100:5 | 100 | fn foo2() {} | ^^^^^^^^^^^^ @@ -176,7 +176,7 @@ error: missing documentation for a method = note: `-D missing-docs-in-private-items` implied by `-D warnings` error: missing documentation for an enum - --> examples/missing-doc.rs:126:1 + --> missing-doc.rs:126:1 | 126 | / enum Baz { 127 | | BazA { @@ -190,7 +190,7 @@ error: missing documentation for an enum = note: `-D missing-docs-in-private-items` implied by `-D warnings` error: missing documentation for a variant - --> examples/missing-doc.rs:127:5 + --> missing-doc.rs:127:5 | 127 | / BazA { 128 | | a: isize, @@ -201,7 +201,7 @@ error: missing documentation for a variant = note: `-D missing-docs-in-private-items` implied by `-D warnings` error: missing documentation for a struct field - --> examples/missing-doc.rs:128:9 + --> missing-doc.rs:128:9 | 128 | a: isize, | ^^^^^^^^ @@ -209,7 +209,7 @@ error: missing documentation for a struct field = note: `-D missing-docs-in-private-items` implied by `-D warnings` error: missing documentation for a struct field - --> examples/missing-doc.rs:129:9 + --> missing-doc.rs:129:9 | 129 | b: isize | ^^^^^^^^ @@ -217,7 +217,7 @@ error: missing documentation for a struct field = note: `-D missing-docs-in-private-items` implied by `-D warnings` error: missing documentation for a variant - --> examples/missing-doc.rs:131:5 + --> missing-doc.rs:131:5 | 131 | BarB | ^^^^ @@ -225,7 +225,7 @@ error: missing documentation for a variant = note: `-D missing-docs-in-private-items` implied by `-D warnings` error: missing documentation for an enum - --> examples/missing-doc.rs:134:1 + --> missing-doc.rs:134:1 | 134 | / pub enum PubBaz { 135 | | PubBazA { @@ -237,7 +237,7 @@ error: missing documentation for an enum = note: `-D missing-docs-in-private-items` implied by `-D warnings` error: missing documentation for a variant - --> examples/missing-doc.rs:135:5 + --> missing-doc.rs:135:5 | 135 | / PubBazA { 136 | | a: isize, @@ -247,7 +247,7 @@ error: missing documentation for a variant = note: `-D missing-docs-in-private-items` implied by `-D warnings` error: missing documentation for a struct field - --> examples/missing-doc.rs:136:9 + --> missing-doc.rs:136:9 | 136 | a: isize, | ^^^^^^^^ @@ -255,7 +255,7 @@ error: missing documentation for a struct field = note: `-D missing-docs-in-private-items` implied by `-D warnings` error: missing documentation for a constant - --> examples/missing-doc.rs:160:1 + --> missing-doc.rs:160:1 | 160 | const FOO: u32 = 0; | ^^^^^^^^^^^^^^^^^^^ @@ -263,7 +263,7 @@ error: missing documentation for a constant = note: `-D missing-docs-in-private-items` implied by `-D warnings` error: missing documentation for a constant - --> examples/missing-doc.rs:167:1 + --> missing-doc.rs:167:1 | 167 | pub const FOO4: u32 = 0; | ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -271,7 +271,7 @@ error: missing documentation for a constant = note: `-D missing-docs-in-private-items` implied by `-D warnings` error: missing documentation for a static - --> examples/missing-doc.rs:170:1 + --> missing-doc.rs:170:1 | 170 | static BAR: u32 = 0; | ^^^^^^^^^^^^^^^^^^^^ @@ -279,7 +279,7 @@ error: missing documentation for a static = note: `-D missing-docs-in-private-items` implied by `-D warnings` error: missing documentation for a static - --> examples/missing-doc.rs:177:1 + --> missing-doc.rs:177:1 | 177 | pub static BAR4: u32 = 0; | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -287,7 +287,7 @@ error: missing documentation for a static = note: `-D missing-docs-in-private-items` implied by `-D warnings` error: missing documentation for a module - --> examples/missing-doc.rs:180:1 + --> missing-doc.rs:180:1 | 180 | / mod internal_impl { 181 | | /// dox @@ -301,7 +301,7 @@ error: missing documentation for a module = note: `-D missing-docs-in-private-items` implied by `-D warnings` error: missing documentation for a function - --> examples/missing-doc.rs:183:5 + --> missing-doc.rs:183:5 | 183 | pub fn undocumented1() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -309,7 +309,7 @@ error: missing documentation for a function = note: `-D missing-docs-in-private-items` implied by `-D warnings` error: missing documentation for a function - --> examples/missing-doc.rs:184:5 + --> missing-doc.rs:184:5 | 184 | pub fn undocumented2() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -317,7 +317,7 @@ error: missing documentation for a function = note: `-D missing-docs-in-private-items` implied by `-D warnings` error: missing documentation for a function - --> examples/missing-doc.rs:185:5 + --> missing-doc.rs:185:5 | 185 | fn undocumented3() {} | ^^^^^^^^^^^^^^^^^^^^^ @@ -325,7 +325,7 @@ error: missing documentation for a function = note: `-D missing-docs-in-private-items` implied by `-D warnings` error: missing documentation for a function - --> examples/missing-doc.rs:190:9 + --> missing-doc.rs:190:9 | 190 | pub fn also_undocumented1() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -333,7 +333,7 @@ error: missing documentation for a function = note: `-D missing-docs-in-private-items` implied by `-D warnings` error: missing documentation for a function - --> examples/missing-doc.rs:191:9 + --> missing-doc.rs:191:9 | 191 | fn also_undocumented2() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -341,7 +341,7 @@ error: missing documentation for a function = note: `-D missing-docs-in-private-items` implied by `-D warnings` error: missing documentation for a function - --> examples/missing-doc.rs:202:1 + --> missing-doc.rs:202:1 | 202 | fn main() {} | ^^^^^^^^^^^^ diff --git a/clippy_tests/examples/module_inception.stderr b/clippy_tests/examples/module_inception.stderr index 00e406814ce..dc76c3f819c 100644 --- a/clippy_tests/examples/module_inception.stderr +++ b/clippy_tests/examples/module_inception.stderr @@ -1,5 +1,5 @@ error: module has the same name as its containing module - --> examples/module_inception.rs:7:9 + --> module_inception.rs:7:9 | 7 | / mod bar { 8 | | mod foo {} @@ -9,7 +9,7 @@ error: module has the same name as its containing module = note: `-D module-inception` implied by `-D warnings` error: module has the same name as its containing module - --> examples/module_inception.rs:12:5 + --> module_inception.rs:12:5 | 12 | / mod foo { 13 | | mod bar {} diff --git a/clippy_tests/examples/modulo_one.stderr b/clippy_tests/examples/modulo_one.stderr index 0596b99d38f..f3ff5ba6e54 100644 --- a/clippy_tests/examples/modulo_one.stderr +++ b/clippy_tests/examples/modulo_one.stderr @@ -1,5 +1,5 @@ error: any number modulo 1 will be 0 - --> examples/modulo_one.rs:7:5 + --> modulo_one.rs:7:5 | 7 | 10 % 1; | ^^^^^^ diff --git a/clippy_tests/examples/mut_from_ref.stderr b/clippy_tests/examples/mut_from_ref.stderr index 8da32219a8f..aa05eb2450e 100644 --- a/clippy_tests/examples/mut_from_ref.stderr +++ b/clippy_tests/examples/mut_from_ref.stderr @@ -1,64 +1,64 @@ error: mutable borrow from immutable input(s) - --> examples/mut_from_ref.rs:9:39 + --> mut_from_ref.rs:9:39 | 9 | fn this_wont_hurt_a_bit(&self) -> &mut Foo { | ^^^^^^^^ | = note: `-D mut-from-ref` implied by `-D warnings` note: immutable borrow here - --> examples/mut_from_ref.rs:9:29 + --> mut_from_ref.rs:9:29 | 9 | fn this_wont_hurt_a_bit(&self) -> &mut Foo { | ^^^^^ error: mutable borrow from immutable input(s) - --> examples/mut_from_ref.rs:15:25 + --> mut_from_ref.rs:15:25 | 15 | fn ouch(x: &Foo) -> &mut Foo; | ^^^^^^^^ | = note: `-D mut-from-ref` implied by `-D warnings` note: immutable borrow here - --> examples/mut_from_ref.rs:15:16 + --> mut_from_ref.rs:15:16 | 15 | fn ouch(x: &Foo) -> &mut Foo; | ^^^^ error: mutable borrow from immutable input(s) - --> examples/mut_from_ref.rs:24:21 + --> mut_from_ref.rs:24:21 | 24 | fn fail(x: &u32) -> &mut u16 { | ^^^^^^^^ | = note: `-D mut-from-ref` implied by `-D warnings` note: immutable borrow here - --> examples/mut_from_ref.rs:24:12 + --> mut_from_ref.rs:24:12 | 24 | fn fail(x: &u32) -> &mut u16 { | ^^^^ error: mutable borrow from immutable input(s) - --> examples/mut_from_ref.rs:28:50 + --> mut_from_ref.rs:28:50 | 28 | fn fail_lifetime<'a>(x: &'a u32, y: &mut u32) -> &'a mut u32 { | ^^^^^^^^^^^ | = note: `-D mut-from-ref` implied by `-D warnings` note: immutable borrow here - --> examples/mut_from_ref.rs:28:25 + --> mut_from_ref.rs:28:25 | 28 | fn fail_lifetime<'a>(x: &'a u32, y: &mut u32) -> &'a mut u32 { | ^^^^^^^ error: mutable borrow from immutable input(s) - --> examples/mut_from_ref.rs:32:67 + --> mut_from_ref.rs:32:67 | 32 | fn fail_double<'a, 'b>(x: &'a u32, y: &'a u32, z: &'b mut u32) -> &'a mut u32 { | ^^^^^^^^^^^ | = note: `-D mut-from-ref` implied by `-D warnings` note: immutable borrow here - --> examples/mut_from_ref.rs:32:27 + --> mut_from_ref.rs:32:27 | 32 | fn fail_double<'a, 'b>(x: &'a u32, y: &'a u32, z: &'b mut u32) -> &'a mut u32 { | ^^^^^^^ ^^^^^^^ diff --git a/clippy_tests/examples/mut_mut.stderr b/clippy_tests/examples/mut_mut.stderr index 7d4021a73fc..974f2e1b2f4 100644 --- a/clippy_tests/examples/mut_mut.stderr +++ b/clippy_tests/examples/mut_mut.stderr @@ -1,5 +1,5 @@ error: generally you want to avoid `&mut &mut _` if possible - --> examples/mut_mut.rs:10:12 + --> mut_mut.rs:10:12 | 10 | fn fun(x : &mut &mut u32) -> bool { | ^^^^^^^^^^^^^ @@ -7,7 +7,7 @@ error: generally you want to avoid `&mut &mut _` if possible = note: `-D mut-mut` implied by `-D warnings` error: generally you want to avoid `&mut &mut _` if possible - --> examples/mut_mut.rs:24:17 + --> mut_mut.rs:24:17 | 24 | let mut x = &mut &mut 1u32; | ^^^^^^^^^^^^^^ @@ -15,7 +15,7 @@ error: generally you want to avoid `&mut &mut _` if possible = note: `-D mut-mut` implied by `-D warnings` error: generally you want to avoid `&mut &mut _` if possible - --> examples/mut_mut.rs:19:20 + --> mut_mut.rs:19:20 | 19 | ($p:expr) => { &mut $p } | ^^^^^^^ @@ -26,7 +26,7 @@ error: generally you want to avoid `&mut &mut _` if possible = note: `-D mut-mut` implied by `-D warnings` error: this expression mutably borrows a mutable reference. Consider reborrowing - --> examples/mut_mut.rs:26:21 + --> mut_mut.rs:26:21 | 26 | let mut y = &mut x; | ^^^^^^ @@ -34,7 +34,7 @@ error: this expression mutably borrows a mutable reference. Consider reborrowing = note: `-D mut-mut` implied by `-D warnings` error: generally you want to avoid `&mut &mut _` if possible - --> examples/mut_mut.rs:30:17 + --> mut_mut.rs:30:17 | 30 | let y : &mut &mut u32 = &mut &mut 2; | ^^^^^^^^^^^^^ @@ -42,7 +42,7 @@ error: generally you want to avoid `&mut &mut _` if possible = note: `-D mut-mut` implied by `-D warnings` error: generally you want to avoid `&mut &mut _` if possible - --> examples/mut_mut.rs:30:33 + --> mut_mut.rs:30:33 | 30 | let y : &mut &mut u32 = &mut &mut 2; | ^^^^^^^^^^^ @@ -50,7 +50,7 @@ error: generally you want to avoid `&mut &mut _` if possible = note: `-D mut-mut` implied by `-D warnings` error: generally you want to avoid `&mut &mut _` if possible - --> examples/mut_mut.rs:30:17 + --> mut_mut.rs:30:17 | 30 | let y : &mut &mut u32 = &mut &mut 2; | ^^^^^^^^^^^^^ @@ -58,7 +58,7 @@ error: generally you want to avoid `&mut &mut _` if possible = note: `-D mut-mut` implied by `-D warnings` error: generally you want to avoid `&mut &mut _` if possible - --> examples/mut_mut.rs:35:17 + --> mut_mut.rs:35:17 | 35 | let y : &mut &mut &mut u32 = &mut &mut &mut 2; | ^^^^^^^^^^^^^^^^^^ @@ -66,7 +66,7 @@ error: generally you want to avoid `&mut &mut _` if possible = note: `-D mut-mut` implied by `-D warnings` error: generally you want to avoid `&mut &mut _` if possible - --> examples/mut_mut.rs:35:22 + --> mut_mut.rs:35:22 | 35 | let y : &mut &mut &mut u32 = &mut &mut &mut 2; | ^^^^^^^^^^^^^ @@ -74,7 +74,7 @@ error: generally you want to avoid `&mut &mut _` if possible = note: `-D mut-mut` implied by `-D warnings` error: generally you want to avoid `&mut &mut _` if possible - --> examples/mut_mut.rs:35:38 + --> mut_mut.rs:35:38 | 35 | let y : &mut &mut &mut u32 = &mut &mut &mut 2; | ^^^^^^^^^^^^^^^^ @@ -82,7 +82,7 @@ error: generally you want to avoid `&mut &mut _` if possible = note: `-D mut-mut` implied by `-D warnings` error: generally you want to avoid `&mut &mut _` if possible - --> examples/mut_mut.rs:35:17 + --> mut_mut.rs:35:17 | 35 | let y : &mut &mut &mut u32 = &mut &mut &mut 2; | ^^^^^^^^^^^^^^^^^^ @@ -90,7 +90,7 @@ error: generally you want to avoid `&mut &mut _` if possible = note: `-D mut-mut` implied by `-D warnings` error: generally you want to avoid `&mut &mut _` if possible - --> examples/mut_mut.rs:35:22 + --> mut_mut.rs:35:22 | 35 | let y : &mut &mut &mut u32 = &mut &mut &mut 2; | ^^^^^^^^^^^^^ @@ -98,7 +98,7 @@ error: generally you want to avoid `&mut &mut _` if possible = note: `-D mut-mut` implied by `-D warnings` error: generally you want to avoid `&mut &mut _` if possible - --> examples/mut_mut.rs:35:22 + --> mut_mut.rs:35:22 | 35 | let y : &mut &mut &mut u32 = &mut &mut &mut 2; | ^^^^^^^^^^^^^ diff --git a/clippy_tests/examples/mut_reference.stderr b/clippy_tests/examples/mut_reference.stderr index 6f616d53c21..9ff0859c92d 100644 --- a/clippy_tests/examples/mut_reference.stderr +++ b/clippy_tests/examples/mut_reference.stderr @@ -1,5 +1,5 @@ error: The function/method "takes_an_immutable_reference" doesn't need a mutable reference - --> examples/mut_reference.rs:22:34 + --> mut_reference.rs:22:34 | 22 | takes_an_immutable_reference(&mut 42); | ^^^^^^^ @@ -7,7 +7,7 @@ error: The function/method "takes_an_immutable_reference" doesn't need a mutable = note: `-D unnecessary-mut-passed` implied by `-D warnings` error: The function/method "as_ptr" doesn't need a mutable reference - --> examples/mut_reference.rs:24:12 + --> mut_reference.rs:24:12 | 24 | as_ptr(&mut 42); | ^^^^^^^ @@ -15,7 +15,7 @@ error: The function/method "as_ptr" doesn't need a mutable reference = note: `-D unnecessary-mut-passed` implied by `-D warnings` error: The function/method "takes_an_immutable_reference" doesn't need a mutable reference - --> examples/mut_reference.rs:28:44 + --> mut_reference.rs:28:44 | 28 | my_struct.takes_an_immutable_reference(&mut 42); | ^^^^^^^ diff --git a/clippy_tests/examples/mutex_atomic.stderr b/clippy_tests/examples/mutex_atomic.stderr index 6f770704370..6daa95c942b 100644 --- a/clippy_tests/examples/mutex_atomic.stderr +++ b/clippy_tests/examples/mutex_atomic.stderr @@ -1,5 +1,5 @@ error: Consider using an AtomicBool instead of a Mutex here. If you just want the locking behaviour and not the internal type, consider using Mutex<()>. - --> examples/mutex_atomic.rs:9:5 + --> mutex_atomic.rs:9:5 | 9 | Mutex::new(true); | ^^^^^^^^^^^^^^^^ @@ -7,7 +7,7 @@ error: Consider using an AtomicBool instead of a Mutex here. If you just want th = note: `-D mutex-atomic` implied by `-D warnings` error: Consider using an AtomicUsize instead of a Mutex here. If you just want the locking behaviour and not the internal type, consider using Mutex<()>. - --> examples/mutex_atomic.rs:10:5 + --> mutex_atomic.rs:10:5 | 10 | Mutex::new(5usize); | ^^^^^^^^^^^^^^^^^^ @@ -15,7 +15,7 @@ error: Consider using an AtomicUsize instead of a Mutex here. If you just want t = note: `-D mutex-atomic` implied by `-D warnings` error: Consider using an AtomicIsize instead of a Mutex here. If you just want the locking behaviour and not the internal type, consider using Mutex<()>. - --> examples/mutex_atomic.rs:11:5 + --> mutex_atomic.rs:11:5 | 11 | Mutex::new(9isize); | ^^^^^^^^^^^^^^^^^^ @@ -23,7 +23,7 @@ error: Consider using an AtomicIsize instead of a Mutex here. If you just want t = note: `-D mutex-atomic` implied by `-D warnings` error: Consider using an AtomicPtr instead of a Mutex here. If you just want the locking behaviour and not the internal type, consider using Mutex<()>. - --> examples/mutex_atomic.rs:13:5 + --> mutex_atomic.rs:13:5 | 13 | Mutex::new(&x as *const u32); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -31,7 +31,7 @@ error: Consider using an AtomicPtr instead of a Mutex here. If you just want the = note: `-D mutex-atomic` implied by `-D warnings` error: Consider using an AtomicPtr instead of a Mutex here. If you just want the locking behaviour and not the internal type, consider using Mutex<()>. - --> examples/mutex_atomic.rs:14:5 + --> mutex_atomic.rs:14:5 | 14 | Mutex::new(&mut x as *mut u32); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -39,7 +39,7 @@ error: Consider using an AtomicPtr instead of a Mutex here. If you just want the = note: `-D mutex-atomic` implied by `-D warnings` error: Consider using an AtomicUsize instead of a Mutex here. If you just want the locking behaviour and not the internal type, consider using Mutex<()>. - --> examples/mutex_atomic.rs:15:5 + --> mutex_atomic.rs:15:5 | 15 | Mutex::new(0u32); | ^^^^^^^^^^^^^^^^ @@ -47,7 +47,7 @@ error: Consider using an AtomicUsize instead of a Mutex here. If you just want t = note: `-D mutex-integer` implied by `-D warnings` error: Consider using an AtomicIsize instead of a Mutex here. If you just want the locking behaviour and not the internal type, consider using Mutex<()>. - --> examples/mutex_atomic.rs:16:5 + --> mutex_atomic.rs:16:5 | 16 | Mutex::new(0i32); | ^^^^^^^^^^^^^^^^ diff --git a/clippy_tests/examples/needless_bool.stderr b/clippy_tests/examples/needless_bool.stderr index c29e04ff504..b0cce397ef9 100644 --- a/clippy_tests/examples/needless_bool.stderr +++ b/clippy_tests/examples/needless_bool.stderr @@ -1,5 +1,5 @@ error: this if-then-else expression will always return true - --> examples/needless_bool.rs:9:5 + --> needless_bool.rs:9:5 | 9 | if x { true } else { true }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -7,7 +7,7 @@ error: this if-then-else expression will always return true = note: `-D needless-bool` implied by `-D warnings` error: this if-then-else expression will always return false - --> examples/needless_bool.rs:10:5 + --> needless_bool.rs:10:5 | 10 | if x { false } else { false }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -15,7 +15,7 @@ error: this if-then-else expression will always return false = note: `-D needless-bool` implied by `-D warnings` error: this if-then-else expression returns a bool literal - --> examples/needless_bool.rs:11:5 + --> needless_bool.rs:11:5 | 11 | if x { true } else { false }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: you can reduce it to `x` @@ -23,7 +23,7 @@ error: this if-then-else expression returns a bool literal = note: `-D needless-bool` implied by `-D warnings` error: this if-then-else expression returns a bool literal - --> examples/needless_bool.rs:12:5 + --> needless_bool.rs:12:5 | 12 | if x { false } else { true }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: you can reduce it to `!x` @@ -31,7 +31,7 @@ error: this if-then-else expression returns a bool literal = note: `-D needless-bool` implied by `-D warnings` error: this if-then-else expression returns a bool literal - --> examples/needless_bool.rs:13:5 + --> needless_bool.rs:13:5 | 13 | if x && y { false } else { true }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: you can reduce it to `!(x && y)` @@ -39,7 +39,7 @@ error: this if-then-else expression returns a bool literal = note: `-D needless-bool` implied by `-D warnings` error: this if-then-else expression will always return true - --> examples/needless_bool.rs:25:5 + --> needless_bool.rs:25:5 | 25 | if x { return true } else { return true }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -47,7 +47,7 @@ error: this if-then-else expression will always return true = note: `-D needless-bool` implied by `-D warnings` error: this if-then-else expression will always return false - --> examples/needless_bool.rs:30:5 + --> needless_bool.rs:30:5 | 30 | if x { return false } else { return false }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -55,7 +55,7 @@ error: this if-then-else expression will always return false = note: `-D needless-bool` implied by `-D warnings` error: this if-then-else expression returns a bool literal - --> examples/needless_bool.rs:35:5 + --> needless_bool.rs:35:5 | 35 | if x { return true } else { return false }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: you can reduce it to `return x` @@ -63,7 +63,7 @@ error: this if-then-else expression returns a bool literal = note: `-D needless-bool` implied by `-D warnings` error: this if-then-else expression returns a bool literal - --> examples/needless_bool.rs:40:5 + --> needless_bool.rs:40:5 | 40 | if x && y { return true } else { return false }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: you can reduce it to `return x && y` @@ -71,7 +71,7 @@ error: this if-then-else expression returns a bool literal = note: `-D needless-bool` implied by `-D warnings` error: this if-then-else expression returns a bool literal - --> examples/needless_bool.rs:45:5 + --> needless_bool.rs:45:5 | 45 | if x { return false } else { return true }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: you can reduce it to `return !x` @@ -79,7 +79,7 @@ error: this if-then-else expression returns a bool literal = note: `-D needless-bool` implied by `-D warnings` error: this if-then-else expression returns a bool literal - --> examples/needless_bool.rs:50:5 + --> needless_bool.rs:50:5 | 50 | if x && y { return false } else { return true }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: you can reduce it to `return !(x && y)` diff --git a/clippy_tests/examples/needless_borrow.stderr b/clippy_tests/examples/needless_borrow.stderr index 3fead935a19..7192a62eaf1 100644 --- a/clippy_tests/examples/needless_borrow.stderr +++ b/clippy_tests/examples/needless_borrow.stderr @@ -1,5 +1,5 @@ error: this expression borrows a reference that is immediately dereferenced by the compiler - --> examples/needless_borrow.rs:13:15 + --> needless_borrow.rs:13:15 | 13 | let c = x(&&a); | ^^^ @@ -7,7 +7,7 @@ error: this expression borrows a reference that is immediately dereferenced by t = note: `-D needless-borrow` implied by `-D warnings` error: this pattern creates a reference to a reference - --> examples/needless_borrow.rs:20:17 + --> needless_borrow.rs:20:17 | 20 | if let Some(ref cake) = Some(&5) {} | ^^^^^^^^ @@ -15,7 +15,7 @@ error: this pattern creates a reference to a reference = note: `-D needless-borrow` implied by `-D warnings` error: this expression borrows a reference that is immediately dereferenced by the compiler - --> examples/needless_borrow.rs:27:15 + --> needless_borrow.rs:27:15 | 27 | 46 => &&a, | ^^^ @@ -23,7 +23,7 @@ error: this expression borrows a reference that is immediately dereferenced by t = note: `-D needless-borrow` implied by `-D warnings` error: this pattern creates a reference to a reference - --> examples/needless_borrow.rs:50:31 + --> needless_borrow.rs:50:31 | 50 | let _ = v.iter().filter(|&ref a| a.is_empty()); | ^^^^^ diff --git a/clippy_tests/examples/needless_continue.stderr b/clippy_tests/examples/needless_continue.stderr index b1e6c6b0196..dce3dbb4424 100644 --- a/clippy_tests/examples/needless_continue.stderr +++ b/clippy_tests/examples/needless_continue.stderr @@ -1,6 +1,6 @@ error: This else block is redundant. - --> examples/needless_continue.rs:26:16 + --> needless_continue.rs:26:16 | 26 | } else { | ________________^ @@ -37,7 +37,7 @@ error: This else block is redundant. error: There is no need for an explicit `else` block for this `if` expression - --> examples/needless_continue.rs:41:9 + --> needless_continue.rs:41:9 | 41 | / if (zero!(i % 2) || nonzero!(i % 5)) && i % 3 != 0 { 42 | | continue; diff --git a/clippy_tests/examples/needless_pass_by_value.stderr b/clippy_tests/examples/needless_pass_by_value.stderr index 702d6fa22ea..b3c8d8f2d28 100644 --- a/clippy_tests/examples/needless_pass_by_value.stderr +++ b/clippy_tests/examples/needless_pass_by_value.stderr @@ -1,5 +1,5 @@ error: this argument is passed by value, but not consumed in the function body - --> examples/needless_pass_by_value.rs:9:23 + --> needless_pass_by_value.rs:9:23 | 9 | fn foo(v: Vec, w: Vec, mut x: Vec, y: Vec) -> Vec { | ^^^^^^ help: consider changing the type to `&[T]` @@ -7,7 +7,7 @@ error: this argument is passed by value, but not consumed in the function body = note: `-D needless-pass-by-value` implied by `-D warnings` error: this argument is passed by value, but not consumed in the function body - --> examples/needless_pass_by_value.rs:23:11 + --> needless_pass_by_value.rs:23:11 | 23 | fn bar(x: String, y: Wrapper) { | ^^^^^^ help: consider changing the type to `&str` @@ -15,7 +15,7 @@ error: this argument is passed by value, but not consumed in the function body = note: `-D needless-pass-by-value` implied by `-D warnings` error: this argument is passed by value, but not consumed in the function body - --> examples/needless_pass_by_value.rs:23:22 + --> needless_pass_by_value.rs:23:22 | 23 | fn bar(x: String, y: Wrapper) { | ^^^^^^^ help: consider taking a reference instead `&Wrapper` @@ -23,7 +23,7 @@ error: this argument is passed by value, but not consumed in the function body = note: `-D needless-pass-by-value` implied by `-D warnings` error: this argument is passed by value, but not consumed in the function body - --> examples/needless_pass_by_value.rs:29:63 + --> needless_pass_by_value.rs:29:63 | 29 | fn test_borrow_trait, U>(t: T, u: U) { | ^ help: consider taking a reference instead `&U` @@ -31,7 +31,7 @@ error: this argument is passed by value, but not consumed in the function body = note: `-D needless-pass-by-value` implied by `-D warnings` error: this argument is passed by value, but not consumed in the function body - --> examples/needless_pass_by_value.rs:40:18 + --> needless_pass_by_value.rs:40:18 | 40 | fn test_match(x: Option>, y: Option>) { | ^^^^^^^^^^^^^^^^^^^^^^ @@ -42,7 +42,7 @@ help: consider taking a reference instead | match *x { error: this argument is passed by value, but not consumed in the function body - --> examples/needless_pass_by_value.rs:53:24 + --> needless_pass_by_value.rs:53:24 | 53 | fn test_destructure(x: Wrapper, y: Wrapper, z: Wrapper) { | ^^^^^^^ help: consider taking a reference instead `&Wrapper` @@ -50,7 +50,7 @@ error: this argument is passed by value, but not consumed in the function body = note: `-D needless-pass-by-value` implied by `-D warnings` error: this argument is passed by value, but not consumed in the function body - --> examples/needless_pass_by_value.rs:53:36 + --> needless_pass_by_value.rs:53:36 | 53 | fn test_destructure(x: Wrapper, y: Wrapper, z: Wrapper) { | ^^^^^^^ diff --git a/clippy_tests/examples/needless_return.stderr b/clippy_tests/examples/needless_return.stderr index c45961fa46d..1e1c199bac3 100644 --- a/clippy_tests/examples/needless_return.stderr +++ b/clippy_tests/examples/needless_return.stderr @@ -1,5 +1,5 @@ error: unneeded return statement - --> examples/needless_return.rs:11:5 + --> needless_return.rs:11:5 | 11 | return true; | ^^^^^^^^^^^^ help: remove `return` as shown: `true` @@ -7,7 +7,7 @@ error: unneeded return statement = note: `-D needless-return` implied by `-D warnings` error: unneeded return statement - --> examples/needless_return.rs:15:5 + --> needless_return.rs:15:5 | 15 | return true | ^^^^^^^^^^^ help: remove `return` as shown: `true` @@ -15,7 +15,7 @@ error: unneeded return statement = note: `-D needless-return` implied by `-D warnings` error: unneeded return statement - --> examples/needless_return.rs:20:9 + --> needless_return.rs:20:9 | 20 | return true; | ^^^^^^^^^^^^ help: remove `return` as shown: `true` @@ -23,7 +23,7 @@ error: unneeded return statement = note: `-D needless-return` implied by `-D warnings` error: unneeded return statement - --> examples/needless_return.rs:22:9 + --> needless_return.rs:22:9 | 22 | return false; | ^^^^^^^^^^^^^ help: remove `return` as shown: `false` @@ -31,7 +31,7 @@ error: unneeded return statement = note: `-D needless-return` implied by `-D warnings` error: unneeded return statement - --> examples/needless_return.rs:28:17 + --> needless_return.rs:28:17 | 28 | true => return false, | ^^^^^^^^^^^^ help: remove `return` as shown: `false` @@ -39,7 +39,7 @@ error: unneeded return statement = note: `-D needless-return` implied by `-D warnings` error: unneeded return statement - --> examples/needless_return.rs:30:13 + --> needless_return.rs:30:13 | 30 | return true; | ^^^^^^^^^^^^ help: remove `return` as shown: `true` @@ -47,7 +47,7 @@ error: unneeded return statement = note: `-D needless-return` implied by `-D warnings` error: unneeded return statement - --> examples/needless_return.rs:37:9 + --> needless_return.rs:37:9 | 37 | return true; | ^^^^^^^^^^^^ help: remove `return` as shown: `true` @@ -55,7 +55,7 @@ error: unneeded return statement = note: `-D needless-return` implied by `-D warnings` error: unneeded return statement - --> examples/needless_return.rs:39:16 + --> needless_return.rs:39:16 | 39 | let _ = || return true; | ^^^^^^^^^^^ help: remove `return` as shown: `true` diff --git a/clippy_tests/examples/needless_update.stderr b/clippy_tests/examples/needless_update.stderr index ffca315bf64..b2bf2c16d3b 100644 --- a/clippy_tests/examples/needless_update.stderr +++ b/clippy_tests/examples/needless_update.stderr @@ -1,5 +1,5 @@ error: struct update has no effect, all the fields in the struct have already been specified - --> examples/needless_update.rs:16:23 + --> needless_update.rs:16:23 | 16 | S { a: 1, b: 1, ..base }; | ^^^^ diff --git a/clippy_tests/examples/neg_multiply.stderr b/clippy_tests/examples/neg_multiply.stderr index 945613a47d3..fa39514eaf5 100644 --- a/clippy_tests/examples/neg_multiply.stderr +++ b/clippy_tests/examples/neg_multiply.stderr @@ -1,5 +1,5 @@ error: Negation by multiplying with -1 - --> examples/neg_multiply.rs:30:5 + --> neg_multiply.rs:30:5 | 30 | x * -1; | ^^^^^^ @@ -7,7 +7,7 @@ error: Negation by multiplying with -1 = note: `-D neg-multiply` implied by `-D warnings` error: Negation by multiplying with -1 - --> examples/neg_multiply.rs:32:5 + --> neg_multiply.rs:32:5 | 32 | -1 * x; | ^^^^^^ diff --git a/clippy_tests/examples/never_loop.stderr b/clippy_tests/examples/never_loop.stderr index dcfdf559bcb..14da5012327 100644 --- a/clippy_tests/examples/never_loop.stderr +++ b/clippy_tests/examples/never_loop.stderr @@ -1,5 +1,5 @@ error: this loop never actually loops - --> examples/never_loop.rs:8:5 + --> never_loop.rs:8:5 | 8 | / loop { 9 | | println!("This is only ever printed once"); @@ -10,7 +10,7 @@ error: this loop never actually loops = note: `-D never-loop` implied by `-D warnings` error: this loop never actually loops - --> examples/never_loop.rs:21:5 + --> never_loop.rs:21:5 | 21 | / loop { 22 | | loop { @@ -24,7 +24,7 @@ error: this loop never actually loops = note: `-D never-loop` implied by `-D warnings` error: this loop never actually loops - --> examples/never_loop.rs:22:9 + --> never_loop.rs:22:9 | 22 | / loop { 23 | | // another one diff --git a/clippy_tests/examples/new_without_default.stderr b/clippy_tests/examples/new_without_default.stderr index 295abbec77b..a18d7bc0c09 100644 --- a/clippy_tests/examples/new_without_default.stderr +++ b/clippy_tests/examples/new_without_default.stderr @@ -1,5 +1,5 @@ error: you should consider deriving a `Default` implementation for `Foo` - --> examples/new_without_default.rs:10:5 + --> new_without_default.rs:10:5 | 10 | pub fn new() -> Foo { Foo } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -9,7 +9,7 @@ help: try this | #[derive(Default)] error: you should consider deriving a `Default` implementation for `Bar` - --> examples/new_without_default.rs:16:5 + --> new_without_default.rs:16:5 | 16 | pub fn new() -> Self { Bar } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -19,7 +19,7 @@ help: try this | #[derive(Default)] error: you should consider adding a `Default` implementation for `LtKo<'c>` - --> examples/new_without_default.rs:64:5 + --> new_without_default.rs:64:5 | 64 | pub fn new() -> LtKo<'c> { unimplemented!() } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/clippy_tests/examples/no_effect.stderr b/clippy_tests/examples/no_effect.stderr index b37552e841f..0bd4e913d03 100644 --- a/clippy_tests/examples/no_effect.stderr +++ b/clippy_tests/examples/no_effect.stderr @@ -1,5 +1,5 @@ error: statement with no effect - --> examples/no_effect.rs:34:5 + --> no_effect.rs:34:5 | 34 | 0; | ^^ @@ -7,7 +7,7 @@ error: statement with no effect = note: `-D no-effect` implied by `-D warnings` error: statement with no effect - --> examples/no_effect.rs:35:5 + --> no_effect.rs:35:5 | 35 | s2; | ^^^ @@ -15,7 +15,7 @@ error: statement with no effect = note: `-D no-effect` implied by `-D warnings` error: statement with no effect - --> examples/no_effect.rs:36:5 + --> no_effect.rs:36:5 | 36 | Unit; | ^^^^^ @@ -23,7 +23,7 @@ error: statement with no effect = note: `-D no-effect` implied by `-D warnings` error: statement with no effect - --> examples/no_effect.rs:37:5 + --> no_effect.rs:37:5 | 37 | Tuple(0); | ^^^^^^^^^ @@ -31,7 +31,7 @@ error: statement with no effect = note: `-D no-effect` implied by `-D warnings` error: statement with no effect - --> examples/no_effect.rs:38:5 + --> no_effect.rs:38:5 | 38 | Struct { field: 0 }; | ^^^^^^^^^^^^^^^^^^^^ @@ -39,7 +39,7 @@ error: statement with no effect = note: `-D no-effect` implied by `-D warnings` error: statement with no effect - --> examples/no_effect.rs:39:5 + --> no_effect.rs:39:5 | 39 | Struct { ..s }; | ^^^^^^^^^^^^^^^ @@ -47,7 +47,7 @@ error: statement with no effect = note: `-D no-effect` implied by `-D warnings` error: statement with no effect - --> examples/no_effect.rs:40:5 + --> no_effect.rs:40:5 | 40 | Union { a: 0 }; | ^^^^^^^^^^^^^^^ @@ -55,7 +55,7 @@ error: statement with no effect = note: `-D no-effect` implied by `-D warnings` error: statement with no effect - --> examples/no_effect.rs:41:5 + --> no_effect.rs:41:5 | 41 | Enum::Tuple(0); | ^^^^^^^^^^^^^^^ @@ -63,7 +63,7 @@ error: statement with no effect = note: `-D no-effect` implied by `-D warnings` error: statement with no effect - --> examples/no_effect.rs:42:5 + --> no_effect.rs:42:5 | 42 | Enum::Struct { field: 0 }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -71,7 +71,7 @@ error: statement with no effect = note: `-D no-effect` implied by `-D warnings` error: statement with no effect - --> examples/no_effect.rs:43:5 + --> no_effect.rs:43:5 | 43 | 5 + 6; | ^^^^^^ @@ -79,7 +79,7 @@ error: statement with no effect = note: `-D no-effect` implied by `-D warnings` error: statement with no effect - --> examples/no_effect.rs:44:5 + --> no_effect.rs:44:5 | 44 | *&42; | ^^^^^ @@ -87,7 +87,7 @@ error: statement with no effect = note: `-D no-effect` implied by `-D warnings` error: statement with no effect - --> examples/no_effect.rs:45:5 + --> no_effect.rs:45:5 | 45 | &6; | ^^^ @@ -95,7 +95,7 @@ error: statement with no effect = note: `-D no-effect` implied by `-D warnings` error: statement with no effect - --> examples/no_effect.rs:46:5 + --> no_effect.rs:46:5 | 46 | (5, 6, 7); | ^^^^^^^^^^ @@ -103,7 +103,7 @@ error: statement with no effect = note: `-D no-effect` implied by `-D warnings` error: statement with no effect - --> examples/no_effect.rs:47:5 + --> no_effect.rs:47:5 | 47 | box 42; | ^^^^^^^ @@ -111,7 +111,7 @@ error: statement with no effect = note: `-D no-effect` implied by `-D warnings` error: statement with no effect - --> examples/no_effect.rs:48:5 + --> no_effect.rs:48:5 | 48 | ..; | ^^^ @@ -119,7 +119,7 @@ error: statement with no effect = note: `-D no-effect` implied by `-D warnings` error: statement with no effect - --> examples/no_effect.rs:49:5 + --> no_effect.rs:49:5 | 49 | 5..; | ^^^^ @@ -127,7 +127,7 @@ error: statement with no effect = note: `-D no-effect` implied by `-D warnings` error: statement with no effect - --> examples/no_effect.rs:50:5 + --> no_effect.rs:50:5 | 50 | ..5; | ^^^^ @@ -135,7 +135,7 @@ error: statement with no effect = note: `-D no-effect` implied by `-D warnings` error: statement with no effect - --> examples/no_effect.rs:51:5 + --> no_effect.rs:51:5 | 51 | 5..6; | ^^^^^ @@ -143,7 +143,7 @@ error: statement with no effect = note: `-D no-effect` implied by `-D warnings` error: statement with no effect - --> examples/no_effect.rs:52:5 + --> no_effect.rs:52:5 | 52 | 5...6; | ^^^^^^ @@ -151,7 +151,7 @@ error: statement with no effect = note: `-D no-effect` implied by `-D warnings` error: statement with no effect - --> examples/no_effect.rs:53:5 + --> no_effect.rs:53:5 | 53 | [42, 55]; | ^^^^^^^^^ @@ -159,7 +159,7 @@ error: statement with no effect = note: `-D no-effect` implied by `-D warnings` error: statement with no effect - --> examples/no_effect.rs:54:5 + --> no_effect.rs:54:5 | 54 | [42, 55][1]; | ^^^^^^^^^^^^ @@ -167,7 +167,7 @@ error: statement with no effect = note: `-D no-effect` implied by `-D warnings` error: statement with no effect - --> examples/no_effect.rs:55:5 + --> no_effect.rs:55:5 | 55 | (42, 55).1; | ^^^^^^^^^^^ @@ -175,7 +175,7 @@ error: statement with no effect = note: `-D no-effect` implied by `-D warnings` error: statement with no effect - --> examples/no_effect.rs:56:5 + --> no_effect.rs:56:5 | 56 | [42; 55]; | ^^^^^^^^^ @@ -183,7 +183,7 @@ error: statement with no effect = note: `-D no-effect` implied by `-D warnings` error: statement with no effect - --> examples/no_effect.rs:57:5 + --> no_effect.rs:57:5 | 57 | [42; 55][13]; | ^^^^^^^^^^^^^ @@ -191,7 +191,7 @@ error: statement with no effect = note: `-D no-effect` implied by `-D warnings` error: statement with no effect - --> examples/no_effect.rs:59:5 + --> no_effect.rs:59:5 | 59 | || x += 5; | ^^^^^^^^^^ @@ -199,7 +199,7 @@ error: statement with no effect = note: `-D no-effect` implied by `-D warnings` error: statement can be reduced - --> examples/no_effect.rs:65:5 + --> no_effect.rs:65:5 | 65 | Tuple(get_number()); | ^^^^^^^^^^^^^^^^^^^^ help: replace it with `get_number();` @@ -207,7 +207,7 @@ error: statement can be reduced = note: `-D unnecessary-operation` implied by `-D warnings` error: statement can be reduced - --> examples/no_effect.rs:66:5 + --> no_effect.rs:66:5 | 66 | Struct { field: get_number() }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with `get_number();` @@ -215,7 +215,7 @@ error: statement can be reduced = note: `-D unnecessary-operation` implied by `-D warnings` error: statement can be reduced - --> examples/no_effect.rs:67:5 + --> no_effect.rs:67:5 | 67 | Struct { ..get_struct() }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with `get_struct();` @@ -223,7 +223,7 @@ error: statement can be reduced = note: `-D unnecessary-operation` implied by `-D warnings` error: statement can be reduced - --> examples/no_effect.rs:68:5 + --> no_effect.rs:68:5 | 68 | Enum::Tuple(get_number()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with `get_number();` @@ -231,7 +231,7 @@ error: statement can be reduced = note: `-D unnecessary-operation` implied by `-D warnings` error: statement can be reduced - --> examples/no_effect.rs:69:5 + --> no_effect.rs:69:5 | 69 | Enum::Struct { field: get_number() }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with `get_number();` @@ -239,7 +239,7 @@ error: statement can be reduced = note: `-D unnecessary-operation` implied by `-D warnings` error: statement can be reduced - --> examples/no_effect.rs:70:5 + --> no_effect.rs:70:5 | 70 | 5 + get_number(); | ^^^^^^^^^^^^^^^^^ help: replace it with `5;get_number();` @@ -247,7 +247,7 @@ error: statement can be reduced = note: `-D unnecessary-operation` implied by `-D warnings` error: statement can be reduced - --> examples/no_effect.rs:71:5 + --> no_effect.rs:71:5 | 71 | *&get_number(); | ^^^^^^^^^^^^^^^ help: replace it with `get_number();` @@ -255,7 +255,7 @@ error: statement can be reduced = note: `-D unnecessary-operation` implied by `-D warnings` error: statement can be reduced - --> examples/no_effect.rs:72:5 + --> no_effect.rs:72:5 | 72 | &get_number(); | ^^^^^^^^^^^^^^ help: replace it with `get_number();` @@ -263,7 +263,7 @@ error: statement can be reduced = note: `-D unnecessary-operation` implied by `-D warnings` error: statement can be reduced - --> examples/no_effect.rs:73:5 + --> no_effect.rs:73:5 | 73 | (5, 6, get_number()); | ^^^^^^^^^^^^^^^^^^^^^ help: replace it with `5;6;get_number();` @@ -271,7 +271,7 @@ error: statement can be reduced = note: `-D unnecessary-operation` implied by `-D warnings` error: statement can be reduced - --> examples/no_effect.rs:74:5 + --> no_effect.rs:74:5 | 74 | box get_number(); | ^^^^^^^^^^^^^^^^^ help: replace it with `get_number();` @@ -279,7 +279,7 @@ error: statement can be reduced = note: `-D unnecessary-operation` implied by `-D warnings` error: statement can be reduced - --> examples/no_effect.rs:75:5 + --> no_effect.rs:75:5 | 75 | get_number()..; | ^^^^^^^^^^^^^^^ help: replace it with `get_number();` @@ -287,7 +287,7 @@ error: statement can be reduced = note: `-D unnecessary-operation` implied by `-D warnings` error: statement can be reduced - --> examples/no_effect.rs:76:5 + --> no_effect.rs:76:5 | 76 | ..get_number(); | ^^^^^^^^^^^^^^^ help: replace it with `get_number();` @@ -295,7 +295,7 @@ error: statement can be reduced = note: `-D unnecessary-operation` implied by `-D warnings` error: statement can be reduced - --> examples/no_effect.rs:77:5 + --> no_effect.rs:77:5 | 77 | 5..get_number(); | ^^^^^^^^^^^^^^^^ help: replace it with `5;get_number();` @@ -303,7 +303,7 @@ error: statement can be reduced = note: `-D unnecessary-operation` implied by `-D warnings` error: statement can be reduced - --> examples/no_effect.rs:78:5 + --> no_effect.rs:78:5 | 78 | [42, get_number()]; | ^^^^^^^^^^^^^^^^^^^ help: replace it with `42;get_number();` @@ -311,7 +311,7 @@ error: statement can be reduced = note: `-D unnecessary-operation` implied by `-D warnings` error: statement can be reduced - --> examples/no_effect.rs:79:5 + --> no_effect.rs:79:5 | 79 | [42, 55][get_number() as usize]; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with `[42, 55];get_number() as usize;` @@ -319,7 +319,7 @@ error: statement can be reduced = note: `-D unnecessary-operation` implied by `-D warnings` error: statement can be reduced - --> examples/no_effect.rs:80:5 + --> no_effect.rs:80:5 | 80 | (42, get_number()).1; | ^^^^^^^^^^^^^^^^^^^^^ help: replace it with `42;get_number();` @@ -327,7 +327,7 @@ error: statement can be reduced = note: `-D unnecessary-operation` implied by `-D warnings` error: statement can be reduced - --> examples/no_effect.rs:81:5 + --> no_effect.rs:81:5 | 81 | [get_number(); 55]; | ^^^^^^^^^^^^^^^^^^^ help: replace it with `get_number();` @@ -335,7 +335,7 @@ error: statement can be reduced = note: `-D unnecessary-operation` implied by `-D warnings` error: statement can be reduced - --> examples/no_effect.rs:82:5 + --> no_effect.rs:82:5 | 82 | [42; 55][get_number() as usize]; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with `[42; 55];get_number() as usize;` @@ -343,7 +343,7 @@ error: statement can be reduced = note: `-D unnecessary-operation` implied by `-D warnings` error: statement can be reduced - --> examples/no_effect.rs:83:5 + --> no_effect.rs:83:5 | 83 | {get_number()}; | ^^^^^^^^^^^^^^^ help: replace it with `get_number();` diff --git a/clippy_tests/examples/non_expressive_names.stderr b/clippy_tests/examples/non_expressive_names.stderr index ca8a42fda0d..8e070222761 100644 --- a/clippy_tests/examples/non_expressive_names.stderr +++ b/clippy_tests/examples/non_expressive_names.stderr @@ -1,116 +1,116 @@ error: binding's name is too similar to existing binding - --> examples/non_expressive_names.rs:18:9 + --> non_expressive_names.rs:18:9 | 18 | let bpple: i32; | ^^^^^ | = note: `-D similar-names` implied by `-D warnings` note: existing binding defined here - --> examples/non_expressive_names.rs:16:9 + --> non_expressive_names.rs:16:9 | 16 | let apple: i32; | ^^^^^ help: separate the discriminating character by an underscore like: `b_pple` - --> examples/non_expressive_names.rs:18:9 + --> non_expressive_names.rs:18:9 | 18 | let bpple: i32; | ^^^^^ error: binding's name is too similar to existing binding - --> examples/non_expressive_names.rs:20:9 + --> non_expressive_names.rs:20:9 | 20 | let cpple: i32; | ^^^^^ | = note: `-D similar-names` implied by `-D warnings` note: existing binding defined here - --> examples/non_expressive_names.rs:16:9 + --> non_expressive_names.rs:16:9 | 16 | let apple: i32; | ^^^^^ help: separate the discriminating character by an underscore like: `c_pple` - --> examples/non_expressive_names.rs:20:9 + --> non_expressive_names.rs:20:9 | 20 | let cpple: i32; | ^^^^^ error: binding's name is too similar to existing binding - --> examples/non_expressive_names.rs:45:9 + --> non_expressive_names.rs:45:9 | 45 | let bluby: i32; | ^^^^^ | = note: `-D similar-names` implied by `-D warnings` note: existing binding defined here - --> examples/non_expressive_names.rs:44:9 + --> non_expressive_names.rs:44:9 | 44 | let blubx: i32; | ^^^^^ help: separate the discriminating character by an underscore like: `blub_y` - --> examples/non_expressive_names.rs:45:9 + --> non_expressive_names.rs:45:9 | 45 | let bluby: i32; | ^^^^^ error: binding's name is too similar to existing binding - --> examples/non_expressive_names.rs:50:9 + --> non_expressive_names.rs:50:9 | 50 | let coke: i32; | ^^^^ | = note: `-D similar-names` implied by `-D warnings` note: existing binding defined here - --> examples/non_expressive_names.rs:48:9 + --> non_expressive_names.rs:48:9 | 48 | let cake: i32; | ^^^^ error: binding's name is too similar to existing binding - --> examples/non_expressive_names.rs:68:9 + --> non_expressive_names.rs:68:9 | 68 | let xyzeabc: i32; | ^^^^^^^ | = note: `-D similar-names` implied by `-D warnings` note: existing binding defined here - --> examples/non_expressive_names.rs:66:9 + --> non_expressive_names.rs:66:9 | 66 | let xyz1abc: i32; | ^^^^^^^ error: binding's name is too similar to existing binding - --> examples/non_expressive_names.rs:72:9 + --> non_expressive_names.rs:72:9 | 72 | let parsee: i32; | ^^^^^^ | = note: `-D similar-names` implied by `-D warnings` note: existing binding defined here - --> examples/non_expressive_names.rs:70:9 + --> non_expressive_names.rs:70:9 | 70 | let parser: i32; | ^^^^^^ help: separate the discriminating character by an underscore like: `parse_e` - --> examples/non_expressive_names.rs:72:9 + --> non_expressive_names.rs:72:9 | 72 | let parsee: i32; | ^^^^^^ error: binding's name is too similar to existing binding - --> examples/non_expressive_names.rs:86:16 + --> non_expressive_names.rs:86:16 | 86 | bpple: sprang } = unimplemented!(); | ^^^^^^ | = note: `-D similar-names` implied by `-D warnings` note: existing binding defined here - --> examples/non_expressive_names.rs:85:22 + --> non_expressive_names.rs:85:22 | 85 | let Foo { apple: spring, | ^^^^^^ error: 5th binding whose name is just one char - --> examples/non_expressive_names.rs:120:17 + --> non_expressive_names.rs:120:17 | 120 | let e: i32; | ^ @@ -118,7 +118,7 @@ error: 5th binding whose name is just one char = note: `-D many-single-char-names` implied by `-D warnings` error: 5th binding whose name is just one char - --> examples/non_expressive_names.rs:123:17 + --> non_expressive_names.rs:123:17 | 123 | let e: i32; | ^ @@ -126,7 +126,7 @@ error: 5th binding whose name is just one char = note: `-D many-single-char-names` implied by `-D warnings` error: 6th binding whose name is just one char - --> examples/non_expressive_names.rs:124:17 + --> non_expressive_names.rs:124:17 | 124 | let f: i32; | ^ @@ -134,7 +134,7 @@ error: 6th binding whose name is just one char = note: `-D many-single-char-names` implied by `-D warnings` error: 5th binding whose name is just one char - --> examples/non_expressive_names.rs:129:13 + --> non_expressive_names.rs:129:13 | 129 | e => panic!(), | ^ diff --git a/clippy_tests/examples/ok_if_let.stderr b/clippy_tests/examples/ok_if_let.stderr index 9afc9f451ca..96a5726ceca 100644 --- a/clippy_tests/examples/ok_if_let.stderr +++ b/clippy_tests/examples/ok_if_let.stderr @@ -1,5 +1,5 @@ error: Matching on `Some` with `ok()` is redundant - --> examples/ok_if_let.rs:7:5 + --> ok_if_let.rs:7:5 | 7 | / if let Some(y) = x.parse().ok() { 8 | | y diff --git a/clippy_tests/examples/op_ref.stderr b/clippy_tests/examples/op_ref.stderr index f9b31c7c82a..f8b7f0c16a2 100644 --- a/clippy_tests/examples/op_ref.stderr +++ b/clippy_tests/examples/op_ref.stderr @@ -1,5 +1,5 @@ error: needlessly taken reference of both operands - --> examples/op_ref.rs:13:15 + --> op_ref.rs:13:15 | 13 | let foo = &5 - &6; | ^^^^^^^ diff --git a/clippy_tests/examples/open_options.stderr b/clippy_tests/examples/open_options.stderr index ae097db75f0..c526ea640a6 100644 --- a/clippy_tests/examples/open_options.stderr +++ b/clippy_tests/examples/open_options.stderr @@ -1,5 +1,5 @@ error: file opened with "truncate" and "read" - --> examples/open_options.rs:8:5 + --> open_options.rs:8:5 | 8 | OpenOptions::new().read(true).truncate(true).open("foo.txt"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -7,7 +7,7 @@ error: file opened with "truncate" and "read" = note: `-D nonsensical-open-options` implied by `-D warnings` error: file opened with "append" and "truncate" - --> examples/open_options.rs:9:5 + --> open_options.rs:9:5 | 9 | OpenOptions::new().append(true).truncate(true).open("foo.txt"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -15,7 +15,7 @@ error: file opened with "append" and "truncate" = note: `-D nonsensical-open-options` implied by `-D warnings` error: the method "read" is called more than once - --> examples/open_options.rs:11:5 + --> open_options.rs:11:5 | 11 | OpenOptions::new().read(true).read(false).open("foo.txt"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -23,7 +23,7 @@ error: the method "read" is called more than once = note: `-D nonsensical-open-options` implied by `-D warnings` error: the method "create" is called more than once - --> examples/open_options.rs:12:5 + --> open_options.rs:12:5 | 12 | OpenOptions::new().create(true).create(false).open("foo.txt"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -31,7 +31,7 @@ error: the method "create" is called more than once = note: `-D nonsensical-open-options` implied by `-D warnings` error: the method "write" is called more than once - --> examples/open_options.rs:13:5 + --> open_options.rs:13:5 | 13 | OpenOptions::new().write(true).write(false).open("foo.txt"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -39,7 +39,7 @@ error: the method "write" is called more than once = note: `-D nonsensical-open-options` implied by `-D warnings` error: the method "append" is called more than once - --> examples/open_options.rs:14:5 + --> open_options.rs:14:5 | 14 | OpenOptions::new().append(true).append(false).open("foo.txt"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -47,7 +47,7 @@ error: the method "append" is called more than once = note: `-D nonsensical-open-options` implied by `-D warnings` error: the method "truncate" is called more than once - --> examples/open_options.rs:15:5 + --> open_options.rs:15:5 | 15 | OpenOptions::new().truncate(true).truncate(false).open("foo.txt"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/clippy_tests/examples/overflow_check_conditional.stderr b/clippy_tests/examples/overflow_check_conditional.stderr index 26ef8f401b9..f3e4b991da8 100644 --- a/clippy_tests/examples/overflow_check_conditional.stderr +++ b/clippy_tests/examples/overflow_check_conditional.stderr @@ -1,5 +1,5 @@ error: You are trying to use classic C overflow conditions that will fail in Rust. - --> examples/overflow_check_conditional.rs:11:5 + --> overflow_check_conditional.rs:11:5 | 11 | if a + b < a { | ^^^^^^^^^ @@ -7,7 +7,7 @@ error: You are trying to use classic C overflow conditions that will fail in Rus = note: `-D overflow-check-conditional` implied by `-D warnings` error: You are trying to use classic C overflow conditions that will fail in Rust. - --> examples/overflow_check_conditional.rs:14:5 + --> overflow_check_conditional.rs:14:5 | 14 | if a > a + b { | ^^^^^^^^^ @@ -15,7 +15,7 @@ error: You are trying to use classic C overflow conditions that will fail in Rus = note: `-D overflow-check-conditional` implied by `-D warnings` error: You are trying to use classic C overflow conditions that will fail in Rust. - --> examples/overflow_check_conditional.rs:17:5 + --> overflow_check_conditional.rs:17:5 | 17 | if a + b < b { | ^^^^^^^^^ @@ -23,7 +23,7 @@ error: You are trying to use classic C overflow conditions that will fail in Rus = note: `-D overflow-check-conditional` implied by `-D warnings` error: You are trying to use classic C overflow conditions that will fail in Rust. - --> examples/overflow_check_conditional.rs:20:5 + --> overflow_check_conditional.rs:20:5 | 20 | if b > a + b { | ^^^^^^^^^ @@ -31,7 +31,7 @@ error: You are trying to use classic C overflow conditions that will fail in Rus = note: `-D overflow-check-conditional` implied by `-D warnings` error: You are trying to use classic C underflow conditions that will fail in Rust. - --> examples/overflow_check_conditional.rs:23:5 + --> overflow_check_conditional.rs:23:5 | 23 | if a - b > b { | ^^^^^^^^^ @@ -39,7 +39,7 @@ error: You are trying to use classic C underflow conditions that will fail in Ru = note: `-D overflow-check-conditional` implied by `-D warnings` error: You are trying to use classic C underflow conditions that will fail in Rust. - --> examples/overflow_check_conditional.rs:26:5 + --> overflow_check_conditional.rs:26:5 | 26 | if b < a - b { | ^^^^^^^^^ @@ -47,7 +47,7 @@ error: You are trying to use classic C underflow conditions that will fail in Ru = note: `-D overflow-check-conditional` implied by `-D warnings` error: You are trying to use classic C underflow conditions that will fail in Rust. - --> examples/overflow_check_conditional.rs:29:5 + --> overflow_check_conditional.rs:29:5 | 29 | if a - b > a { | ^^^^^^^^^ @@ -55,7 +55,7 @@ error: You are trying to use classic C underflow conditions that will fail in Ru = note: `-D overflow-check-conditional` implied by `-D warnings` error: You are trying to use classic C underflow conditions that will fail in Rust. - --> examples/overflow_check_conditional.rs:32:5 + --> overflow_check_conditional.rs:32:5 | 32 | if a < a - b { | ^^^^^^^^^ diff --git a/clippy_tests/examples/panic.stderr b/clippy_tests/examples/panic.stderr index 9973360cd9a..bc415668997 100644 --- a/clippy_tests/examples/panic.stderr +++ b/clippy_tests/examples/panic.stderr @@ -1,5 +1,5 @@ error: you probably are missing some parameter in your format string - --> examples/panic.rs:8:16 + --> panic.rs:8:16 | 8 | panic!("{}"); | ^^^^ @@ -7,7 +7,7 @@ error: you probably are missing some parameter in your format string = note: `-D panic-params` implied by `-D warnings` error: you probably are missing some parameter in your format string - --> examples/panic.rs:10:16 + --> panic.rs:10:16 | 10 | panic!("{:?}"); | ^^^^^^ @@ -15,7 +15,7 @@ error: you probably are missing some parameter in your format string = note: `-D panic-params` implied by `-D warnings` error: you probably are missing some parameter in your format string - --> examples/panic.rs:12:23 + --> panic.rs:12:23 | 12 | assert!(true, "here be missing values: {}"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -23,7 +23,7 @@ error: you probably are missing some parameter in your format string = note: `-D panic-params` implied by `-D warnings` error: you probably are missing some parameter in your format string - --> examples/panic.rs:22:5 + --> panic.rs:22:5 | 22 | assert!("foo bar".contains(&format!("foo {}", "bar"))); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/clippy_tests/examples/partialeq_ne_impl.stderr b/clippy_tests/examples/partialeq_ne_impl.stderr index 4a3dc4ef0ca..cb8e2d792d3 100644 --- a/clippy_tests/examples/partialeq_ne_impl.stderr +++ b/clippy_tests/examples/partialeq_ne_impl.stderr @@ -1,5 +1,5 @@ error: re-implementing `PartialEq::ne` is unnecessary - --> examples/partialeq_ne_impl.rs:10:5 + --> partialeq_ne_impl.rs:10:5 | 10 | fn ne(&self, _: &Foo) -> bool { false } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/clippy_tests/examples/patterns.stderr b/clippy_tests/examples/patterns.stderr index 05d41324451..441a138dcaa 100644 --- a/clippy_tests/examples/patterns.stderr +++ b/clippy_tests/examples/patterns.stderr @@ -1,5 +1,5 @@ error: the `y @ _` pattern can be written as just `y` - --> examples/patterns.rs:10:9 + --> patterns.rs:10:9 | 10 | y @ _ => (), | ^^^^^ diff --git a/clippy_tests/examples/precedence.stderr b/clippy_tests/examples/precedence.stderr index b164a91f3eb..8994366ebdc 100644 --- a/clippy_tests/examples/precedence.stderr +++ b/clippy_tests/examples/precedence.stderr @@ -1,5 +1,5 @@ error: operator precedence can trip the unwary - --> examples/precedence.rs:8:5 + --> precedence.rs:8:5 | 8 | 1 << 2 + 3; | ^^^^^^^^^^ help: consider parenthesizing your expression `1 << (2 + 3)` @@ -7,7 +7,7 @@ error: operator precedence can trip the unwary = note: `-D precedence` implied by `-D warnings` error: operator precedence can trip the unwary - --> examples/precedence.rs:9:5 + --> precedence.rs:9:5 | 9 | 1 + 2 << 3; | ^^^^^^^^^^ help: consider parenthesizing your expression `(1 + 2) << 3` @@ -15,7 +15,7 @@ error: operator precedence can trip the unwary = note: `-D precedence` implied by `-D warnings` error: operator precedence can trip the unwary - --> examples/precedence.rs:10:5 + --> precedence.rs:10:5 | 10 | 4 >> 1 + 1; | ^^^^^^^^^^ help: consider parenthesizing your expression `4 >> (1 + 1)` @@ -23,7 +23,7 @@ error: operator precedence can trip the unwary = note: `-D precedence` implied by `-D warnings` error: operator precedence can trip the unwary - --> examples/precedence.rs:11:5 + --> precedence.rs:11:5 | 11 | 1 + 3 >> 2; | ^^^^^^^^^^ help: consider parenthesizing your expression `(1 + 3) >> 2` @@ -31,7 +31,7 @@ error: operator precedence can trip the unwary = note: `-D precedence` implied by `-D warnings` error: operator precedence can trip the unwary - --> examples/precedence.rs:12:5 + --> precedence.rs:12:5 | 12 | 1 ^ 1 - 1; | ^^^^^^^^^ help: consider parenthesizing your expression `1 ^ (1 - 1)` @@ -39,7 +39,7 @@ error: operator precedence can trip the unwary = note: `-D precedence` implied by `-D warnings` error: operator precedence can trip the unwary - --> examples/precedence.rs:13:5 + --> precedence.rs:13:5 | 13 | 3 | 2 - 1; | ^^^^^^^^^ help: consider parenthesizing your expression `3 | (2 - 1)` @@ -47,7 +47,7 @@ error: operator precedence can trip the unwary = note: `-D precedence` implied by `-D warnings` error: operator precedence can trip the unwary - --> examples/precedence.rs:14:5 + --> precedence.rs:14:5 | 14 | 3 & 5 - 2; | ^^^^^^^^^ help: consider parenthesizing your expression `3 & (5 - 2)` @@ -55,7 +55,7 @@ error: operator precedence can trip the unwary = note: `-D precedence` implied by `-D warnings` error: unary minus has lower precedence than method call - --> examples/precedence.rs:15:5 + --> precedence.rs:15:5 | 15 | -1i32.abs(); | ^^^^^^^^^^^ help: consider adding parentheses to clarify your intent `-(1i32.abs())` @@ -63,7 +63,7 @@ error: unary minus has lower precedence than method call = note: `-D precedence` implied by `-D warnings` error: unary minus has lower precedence than method call - --> examples/precedence.rs:16:5 + --> precedence.rs:16:5 | 16 | -1f32.abs(); | ^^^^^^^^^^^ help: consider adding parentheses to clarify your intent `-(1f32.abs())` diff --git a/clippy_tests/examples/print.stderr b/clippy_tests/examples/print.stderr index b46ee8a9c75..f1bca2e8445 100644 --- a/clippy_tests/examples/print.stderr +++ b/clippy_tests/examples/print.stderr @@ -1,5 +1,5 @@ error: use of `Debug`-based formatting - --> examples/print.rs:12:27 + --> print.rs:12:27 | 12 | write!(f, "{:?}", 43.1415) | ^^^^^^^ @@ -7,7 +7,7 @@ error: use of `Debug`-based formatting = note: `-D use-debug` implied by `-D warnings` error: use of `println!` - --> examples/print.rs:24:5 + --> print.rs:24:5 | 24 | println!("Hello"); | ^^^^^^^^^^^^^^^^^^ @@ -15,7 +15,7 @@ error: use of `println!` = note: `-D print-stdout` implied by `-D warnings` error: use of `print!` - --> examples/print.rs:25:5 + --> print.rs:25:5 | 25 | print!("Hello"); | ^^^^^^^^^^^^^^^^ @@ -23,7 +23,7 @@ error: use of `print!` = note: `-D print-stdout` implied by `-D warnings` error: use of `print!` - --> examples/print.rs:27:5 + --> print.rs:27:5 | 27 | print!("Hello {}", "World"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -31,7 +31,7 @@ error: use of `print!` = note: `-D print-stdout` implied by `-D warnings` error: use of `print!` - --> examples/print.rs:29:5 + --> print.rs:29:5 | 29 | print!("Hello {:?}", "World"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -39,7 +39,7 @@ error: use of `print!` = note: `-D print-stdout` implied by `-D warnings` error: use of `Debug`-based formatting - --> examples/print.rs:29:26 + --> print.rs:29:26 | 29 | print!("Hello {:?}", "World"); | ^^^^^^^ @@ -47,7 +47,7 @@ error: use of `Debug`-based formatting = note: `-D use-debug` implied by `-D warnings` error: use of `print!` - --> examples/print.rs:31:5 + --> print.rs:31:5 | 31 | print!("Hello {:#?}", "#orld"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -55,7 +55,7 @@ error: use of `print!` = note: `-D print-stdout` implied by `-D warnings` error: use of `Debug`-based formatting - --> examples/print.rs:31:27 + --> print.rs:31:27 | 31 | print!("Hello {:#?}", "#orld"); | ^^^^^^^ diff --git a/clippy_tests/examples/print_with_newline.stderr b/clippy_tests/examples/print_with_newline.stderr index 87932a1b27c..010f29f840d 100644 --- a/clippy_tests/examples/print_with_newline.stderr +++ b/clippy_tests/examples/print_with_newline.stderr @@ -1,5 +1,5 @@ error: using `print!()` with a format string that ends in a newline, consider using `println!()` instead - --> examples/print_with_newline.rs:6:5 + --> print_with_newline.rs:6:5 | 6 | print!("Hello\n"); | ^^^^^^^^^^^^^^^^^^ @@ -7,7 +7,7 @@ error: using `print!()` with a format string that ends in a newline, consider us = note: `-D print-with-newline` implied by `-D warnings` error: using `print!()` with a format string that ends in a newline, consider using `println!()` instead - --> examples/print_with_newline.rs:7:5 + --> print_with_newline.rs:7:5 | 7 | print!("Hello {}\n", "world"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -15,7 +15,7 @@ error: using `print!()` with a format string that ends in a newline, consider us = note: `-D print-with-newline` implied by `-D warnings` error: using `print!()` with a format string that ends in a newline, consider using `println!()` instead - --> examples/print_with_newline.rs:8:5 + --> print_with_newline.rs:8:5 | 8 | print!("Hello {} {}\n\n", "world", "#2"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -23,7 +23,7 @@ error: using `print!()` with a format string that ends in a newline, consider us = note: `-D print-with-newline` implied by `-D warnings` error: using `print!()` with a format string that ends in a newline, consider using `println!()` instead - --> examples/print_with_newline.rs:9:5 + --> print_with_newline.rs:9:5 | 9 | print!("{}\n", 1265); | ^^^^^^^^^^^^^^^^^^^^^ diff --git a/clippy_tests/examples/ptr_arg.stderr b/clippy_tests/examples/ptr_arg.stderr index 83a785b604b..eb15e628812 100644 --- a/clippy_tests/examples/ptr_arg.stderr +++ b/clippy_tests/examples/ptr_arg.stderr @@ -1,5 +1,5 @@ error: writing `&Vec<_>` instead of `&[_]` involves one more reference and cannot be used with non-Vec-based slices. Consider changing the type to `&[...]` - --> examples/ptr_arg.rs:6:14 + --> ptr_arg.rs:6:14 | 6 | fn do_vec(x: &Vec) { | ^^^^^^^^^ @@ -7,7 +7,7 @@ error: writing `&Vec<_>` instead of `&[_]` involves one more reference and canno = note: `-D ptr-arg` implied by `-D warnings` error: writing `&String` instead of `&str` involves a new object where a slice will do. Consider changing the type to `&str` - --> examples/ptr_arg.rs:14:14 + --> ptr_arg.rs:14:14 | 14 | fn do_str(x: &String) { | ^^^^^^^ @@ -15,7 +15,7 @@ error: writing `&String` instead of `&str` involves a new object where a slice w = note: `-D ptr-arg` implied by `-D warnings` error: writing `&Vec<_>` instead of `&[_]` involves one more reference and cannot be used with non-Vec-based slices. Consider changing the type to `&[...]` - --> examples/ptr_arg.rs:27:18 + --> ptr_arg.rs:27:18 | 27 | fn do_vec(x: &Vec); | ^^^^^^^^^ diff --git a/clippy_tests/examples/range.stderr b/clippy_tests/examples/range.stderr index fe8c5cfa9e8..39db16af3cb 100644 --- a/clippy_tests/examples/range.stderr +++ b/clippy_tests/examples/range.stderr @@ -1,5 +1,5 @@ error: Range::step_by(0) produces an infinite iterator. Consider using `std::iter::repeat()` instead - --> examples/range.rs:13:5 + --> range.rs:13:5 | 13 | (0..1).step_by(0); | ^^^^^^^^^^^^^^^^^ @@ -7,7 +7,7 @@ error: Range::step_by(0) produces an infinite iterator. Consider using `std::ite = note: `-D range-step-by-zero` implied by `-D warnings` error: Range::step_by(0) produces an infinite iterator. Consider using `std::iter::repeat()` instead - --> examples/range.rs:17:5 + --> range.rs:17:5 | 17 | (1..).step_by(0); | ^^^^^^^^^^^^^^^^ @@ -15,7 +15,7 @@ error: Range::step_by(0) produces an infinite iterator. Consider using `std::ite = note: `-D range-step-by-zero` implied by `-D warnings` error: Range::step_by(0) produces an infinite iterator. Consider using `std::iter::repeat()` instead - --> examples/range.rs:18:5 + --> range.rs:18:5 | 18 | (1...2).step_by(0); | ^^^^^^^^^^^^^^^^^^ @@ -23,7 +23,7 @@ error: Range::step_by(0) produces an infinite iterator. Consider using `std::ite = note: `-D range-step-by-zero` implied by `-D warnings` error: Range::step_by(0) produces an infinite iterator. Consider using `std::iter::repeat()` instead - --> examples/range.rs:21:5 + --> range.rs:21:5 | 21 | x.step_by(0); | ^^^^^^^^^^^^ @@ -31,7 +31,7 @@ error: Range::step_by(0) produces an infinite iterator. Consider using `std::ite = note: `-D range-step-by-zero` implied by `-D warnings` error: It is more idiomatic to use v1.iter().enumerate() - --> examples/range.rs:29:14 + --> range.rs:29:14 | 29 | let _x = v1.iter().zip(0..v1.len()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/clippy_tests/examples/redundant_closure_call.stderr b/clippy_tests/examples/redundant_closure_call.stderr index 69244232b7c..a9eacf380bf 100644 --- a/clippy_tests/examples/redundant_closure_call.stderr +++ b/clippy_tests/examples/redundant_closure_call.stderr @@ -1,5 +1,5 @@ error: Closure called just once immediately after it was declared - --> examples/redundant_closure_call.rs:15:2 + --> redundant_closure_call.rs:15:2 | 15 | i = closure(); | ^^^^^^^^^^^^^ @@ -7,7 +7,7 @@ error: Closure called just once immediately after it was declared = note: `-D redundant-closure-call` implied by `-D warnings` error: Closure called just once immediately after it was declared - --> examples/redundant_closure_call.rs:18:2 + --> redundant_closure_call.rs:18:2 | 18 | i = closure(3); | ^^^^^^^^^^^^^^ @@ -15,7 +15,7 @@ error: Closure called just once immediately after it was declared = note: `-D redundant-closure-call` implied by `-D warnings` error: Try not to call a closure in the expression where it is declared. - --> examples/redundant_closure_call.rs:7:10 + --> redundant_closure_call.rs:7:10 | 7 | let a = (|| 42)(); | ^^^^^^^^^ help: Try doing something like: `42` @@ -23,7 +23,7 @@ error: Try not to call a closure in the expression where it is declared. = note: `-D redundant-closure-call` implied by `-D warnings` error: Try not to call a closure in the expression where it is declared. - --> examples/redundant_closure_call.rs:10:14 + --> redundant_closure_call.rs:10:14 | 10 | let mut k = (|m| m+1)(i); | ^^^^^^^^^^^^ @@ -31,7 +31,7 @@ error: Try not to call a closure in the expression where it is declared. = note: `-D redundant-closure-call` implied by `-D warnings` error: Try not to call a closure in the expression where it is declared. - --> examples/redundant_closure_call.rs:12:6 + --> redundant_closure_call.rs:12:6 | 12 | k = (|a,b| a*b)(1,5); | ^^^^^^^^^^^^^^^^ diff --git a/clippy_tests/examples/reference.stderr b/clippy_tests/examples/reference.stderr index d2f29c9779f..317650d27b1 100644 --- a/clippy_tests/examples/reference.stderr +++ b/clippy_tests/examples/reference.stderr @@ -1,5 +1,5 @@ error: immediately dereferencing a reference - --> examples/reference.rs:19:13 + --> reference.rs:19:13 | 19 | let b = *&a; | ^^^ help: try this `a` @@ -7,7 +7,7 @@ error: immediately dereferencing a reference = note: `-D deref-addrof` implied by `-D warnings` error: immediately dereferencing a reference - --> examples/reference.rs:21:13 + --> reference.rs:21:13 | 21 | let b = *&get_number(); | ^^^^^^^^^^^^^^ help: try this `get_number()` @@ -15,7 +15,7 @@ error: immediately dereferencing a reference = note: `-D deref-addrof` implied by `-D warnings` error: immediately dereferencing a reference - --> examples/reference.rs:26:13 + --> reference.rs:26:13 | 26 | let b = *&bytes[1..2][0]; | ^^^^^^^^^^^^^^^^ help: try this `bytes[1..2][0]` @@ -23,7 +23,7 @@ error: immediately dereferencing a reference = note: `-D deref-addrof` implied by `-D warnings` error: immediately dereferencing a reference - --> examples/reference.rs:30:13 + --> reference.rs:30:13 | 30 | let b = *&(a); | ^^^^^ help: try this `(a)` @@ -31,7 +31,7 @@ error: immediately dereferencing a reference = note: `-D deref-addrof` implied by `-D warnings` error: immediately dereferencing a reference - --> examples/reference.rs:32:13 + --> reference.rs:32:13 | 32 | let b = *(&a); | ^^^^^ help: try this `a` @@ -39,7 +39,7 @@ error: immediately dereferencing a reference = note: `-D deref-addrof` implied by `-D warnings` error: immediately dereferencing a reference - --> examples/reference.rs:34:13 + --> reference.rs:34:13 | 34 | let b = *((&a)); | ^^^^^^^ help: try this `a` @@ -47,7 +47,7 @@ error: immediately dereferencing a reference = note: `-D deref-addrof` implied by `-D warnings` error: immediately dereferencing a reference - --> examples/reference.rs:36:13 + --> reference.rs:36:13 | 36 | let b = *&&a; | ^^^^ help: try this `&a` @@ -55,7 +55,7 @@ error: immediately dereferencing a reference = note: `-D deref-addrof` implied by `-D warnings` error: immediately dereferencing a reference - --> examples/reference.rs:38:14 + --> reference.rs:38:14 | 38 | let b = **&aref; | ^^^^^^ help: try this `aref` @@ -63,7 +63,7 @@ error: immediately dereferencing a reference = note: `-D deref-addrof` implied by `-D warnings` error: immediately dereferencing a reference - --> examples/reference.rs:42:14 + --> reference.rs:42:14 | 42 | let b = **&&a; | ^^^^ help: try this `&a` @@ -71,7 +71,7 @@ error: immediately dereferencing a reference = note: `-D deref-addrof` implied by `-D warnings` error: immediately dereferencing a reference - --> examples/reference.rs:46:17 + --> reference.rs:46:17 | 46 | let y = *&mut x; | ^^^^^^^ help: try this `x` @@ -79,7 +79,7 @@ error: immediately dereferencing a reference = note: `-D deref-addrof` implied by `-D warnings` error: immediately dereferencing a reference - --> examples/reference.rs:53:18 + --> reference.rs:53:18 | 53 | let y = **&mut &mut x; | ^^^^^^^^^^^^ help: try this `&mut x` diff --git a/clippy_tests/examples/regex.stderr b/clippy_tests/examples/regex.stderr index f5887d20bed..078a1dd11cc 100644 --- a/clippy_tests/examples/regex.stderr +++ b/clippy_tests/examples/regex.stderr @@ -1,5 +1,5 @@ error[E0463]: can't find crate for `regex` - --> examples/regex.rs:7:1 + --> regex.rs:7:1 | 7 | extern crate regex; | ^^^^^^^^^^^^^^^^^^^ can't find crate diff --git a/clippy_tests/examples/serde.stderr b/clippy_tests/examples/serde.stderr index f7cd4bdbde4..d0847ed3bc4 100644 --- a/clippy_tests/examples/serde.stderr +++ b/clippy_tests/examples/serde.stderr @@ -1,5 +1,5 @@ error[E0463]: can't find crate for `serde` - --> examples/serde.rs:6:1 + --> serde.rs:6:1 | 6 | extern crate serde; | ^^^^^^^^^^^^^^^^^^^ can't find crate diff --git a/clippy_tests/examples/shadow.stderr b/clippy_tests/examples/shadow.stderr index 179cd52d727..22211248e69 100644 --- a/clippy_tests/examples/shadow.stderr +++ b/clippy_tests/examples/shadow.stderr @@ -1,141 +1,141 @@ error: `x` is shadowed by itself in `&mut x` - --> examples/shadow.rs:13:9 + --> shadow.rs:13:9 | 13 | let x = &mut x; | ^^^^^^^^^^ | = note: `-D shadow-same` implied by `-D warnings` note: previous binding is here - --> examples/shadow.rs:12:13 + --> shadow.rs:12:13 | 12 | let mut x = 1; | ^ error: `x` is shadowed by itself in `{ x }` - --> examples/shadow.rs:14:9 + --> shadow.rs:14:9 | 14 | let x = { x }; | ^^^^^^^^^ | = note: `-D shadow-same` implied by `-D warnings` note: previous binding is here - --> examples/shadow.rs:13:9 + --> shadow.rs:13:9 | 13 | let x = &mut x; | ^ error: `x` is shadowed by itself in `(&*x)` - --> examples/shadow.rs:15:9 + --> shadow.rs:15:9 | 15 | let x = (&*x); | ^^^^^^^^^ | = note: `-D shadow-same` implied by `-D warnings` note: previous binding is here - --> examples/shadow.rs:14:9 + --> shadow.rs:14:9 | 14 | let x = { x }; | ^ error: `x` is shadowed by `{ *x + 1 }` which reuses the original value - --> examples/shadow.rs:16:9 + --> shadow.rs:16:9 | 16 | let x = { *x + 1 }; | ^ | = note: `-D shadow-reuse` implied by `-D warnings` note: initialization happens here - --> examples/shadow.rs:16:13 + --> shadow.rs:16:13 | 16 | let x = { *x + 1 }; | ^^^^^^^^^^ note: previous binding is here - --> examples/shadow.rs:15:9 + --> shadow.rs:15:9 | 15 | let x = (&*x); | ^ error: `x` is shadowed by `id(x)` which reuses the original value - --> examples/shadow.rs:17:9 + --> shadow.rs:17:9 | 17 | let x = id(x); | ^ | = note: `-D shadow-reuse` implied by `-D warnings` note: initialization happens here - --> examples/shadow.rs:17:13 + --> shadow.rs:17:13 | 17 | let x = id(x); | ^^^^^ note: previous binding is here - --> examples/shadow.rs:16:9 + --> shadow.rs:16:9 | 16 | let x = { *x + 1 }; | ^ error: `x` is shadowed by `(1, x)` which reuses the original value - --> examples/shadow.rs:18:9 + --> shadow.rs:18:9 | 18 | let x = (1, x); | ^ | = note: `-D shadow-reuse` implied by `-D warnings` note: initialization happens here - --> examples/shadow.rs:18:13 + --> shadow.rs:18:13 | 18 | let x = (1, x); | ^^^^^^ note: previous binding is here - --> examples/shadow.rs:17:9 + --> shadow.rs:17:9 | 17 | let x = id(x); | ^ error: `x` is shadowed by `first(x)` which reuses the original value - --> examples/shadow.rs:19:9 + --> shadow.rs:19:9 | 19 | let x = first(x); | ^ | = note: `-D shadow-reuse` implied by `-D warnings` note: initialization happens here - --> examples/shadow.rs:19:13 + --> shadow.rs:19:13 | 19 | let x = first(x); | ^^^^^^^^ note: previous binding is here - --> examples/shadow.rs:18:9 + --> shadow.rs:18:9 | 18 | let x = (1, x); | ^ error: `x` is shadowed by `y` - --> examples/shadow.rs:21:9 + --> shadow.rs:21:9 | 21 | let x = y; | ^ | = note: `-D shadow-unrelated` implied by `-D warnings` note: initialization happens here - --> examples/shadow.rs:21:13 + --> shadow.rs:21:13 | 21 | let x = y; | ^ note: previous binding is here - --> examples/shadow.rs:19:9 + --> shadow.rs:19:9 | 19 | let x = first(x); | ^ error: `x` shadows a previous declaration - --> examples/shadow.rs:23:9 + --> shadow.rs:23:9 | 23 | let x; | ^ | = note: `-D shadow-unrelated` implied by `-D warnings` note: previous binding is here - --> examples/shadow.rs:21:9 + --> shadow.rs:21:9 | 21 | let x = y; | ^ diff --git a/clippy_tests/examples/short_circuit_statement.stderr b/clippy_tests/examples/short_circuit_statement.stderr index c2cd3cfb006..4fd1526e24c 100644 --- a/clippy_tests/examples/short_circuit_statement.stderr +++ b/clippy_tests/examples/short_circuit_statement.stderr @@ -1,5 +1,5 @@ error: boolean short circuit operator in statement may be clearer using an explicit test - --> examples/short_circuit_statement.rs:7:5 + --> short_circuit_statement.rs:7:5 | 7 | f() && g(); | ^^^^^^^^^^^ help: replace it with `if f() { g(); }` @@ -7,7 +7,7 @@ error: boolean short circuit operator in statement may be clearer using an expli = note: `-D short-circuit-statement` implied by `-D warnings` error: boolean short circuit operator in statement may be clearer using an explicit test - --> examples/short_circuit_statement.rs:8:5 + --> short_circuit_statement.rs:8:5 | 8 | f() || g(); | ^^^^^^^^^^^ help: replace it with `if !f() { g(); }` @@ -15,7 +15,7 @@ error: boolean short circuit operator in statement may be clearer using an expli = note: `-D short-circuit-statement` implied by `-D warnings` error: boolean short circuit operator in statement may be clearer using an explicit test - --> examples/short_circuit_statement.rs:9:5 + --> short_circuit_statement.rs:9:5 | 9 | 1 == 2 || g(); | ^^^^^^^^^^^^^^ help: replace it with `if !(1 == 2) { g(); }` diff --git a/clippy_tests/examples/should_assert_eq.stderr b/clippy_tests/examples/should_assert_eq.stderr index 10b6646501e..96a8542cde7 100644 --- a/clippy_tests/examples/should_assert_eq.stderr +++ b/clippy_tests/examples/should_assert_eq.stderr @@ -1,5 +1,5 @@ error: use `assert_eq` for better reporting - --> examples/should_assert_eq.rs:14:5 + --> should_assert_eq.rs:14:5 | 14 | assert!(1 == 2); | ^^^^^^^^^^^^^^^^ @@ -8,7 +8,7 @@ error: use `assert_eq` for better reporting = note: this error originates in a macro outside of the current crate error: use `assert_eq` for better reporting - --> examples/should_assert_eq.rs:15:5 + --> should_assert_eq.rs:15:5 | 15 | assert!(Debug(1) == Debug(2)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -17,7 +17,7 @@ error: use `assert_eq` for better reporting = note: this error originates in a macro outside of the current crate error: use `assert_ne` for better reporting - --> examples/should_assert_eq.rs:17:5 + --> should_assert_eq.rs:17:5 | 17 | assert!(Debug(1) != Debug(2)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -26,7 +26,7 @@ error: use `assert_ne` for better reporting = note: this error originates in a macro outside of the current crate error: use `debug_assert_eq` for better reporting - --> examples/should_assert_eq.rs:22:5 + --> should_assert_eq.rs:22:5 | 22 | debug_assert!(4 == 5); | ^^^^^^^^^^^^^^^^^^^^^^ @@ -35,7 +35,7 @@ error: use `debug_assert_eq` for better reporting = note: this error originates in a macro outside of the current crate error: use `debug_assert_ne` for better reporting - --> examples/should_assert_eq.rs:23:5 + --> should_assert_eq.rs:23:5 | 23 | debug_assert!(4 != 6); | ^^^^^^^^^^^^^^^^^^^^^^ @@ -44,7 +44,7 @@ error: use `debug_assert_ne` for better reporting = note: this error originates in a macro outside of the current crate error: use `assert_eq` for better reporting - --> examples/should_assert_eq.rs:27:5 + --> should_assert_eq.rs:27:5 | 27 | assert!(x == y); | ^^^^^^^^^^^^^^^^ @@ -53,7 +53,7 @@ error: use `assert_eq` for better reporting = note: this error originates in a macro outside of the current crate error: use `assert_ne` for better reporting - --> examples/should_assert_eq.rs:30:5 + --> should_assert_eq.rs:30:5 | 30 | assert!(x != y); | ^^^^^^^^^^^^^^^^ diff --git a/clippy_tests/examples/strings.stderr b/clippy_tests/examples/strings.stderr index 5a883e5de1d..df7b8e1c896 100644 --- a/clippy_tests/examples/strings.stderr +++ b/clippy_tests/examples/strings.stderr @@ -1,5 +1,5 @@ error: you added something to a string. Consider using `String::push_str()` instead - --> examples/strings.rs:10:13 + --> strings.rs:10:13 | 10 | x = x + "."; | ^^^^^^^ @@ -7,7 +7,7 @@ error: you added something to a string. Consider using `String::push_str()` inst = note: `-D string-add` implied by `-D warnings` error: you added something to a string. Consider using `String::push_str()` instead - --> examples/strings.rs:14:13 + --> strings.rs:14:13 | 14 | let z = y + "..."; | ^^^^^^^^^ @@ -15,7 +15,7 @@ error: you added something to a string. Consider using `String::push_str()` inst = note: `-D string-add` implied by `-D warnings` error: you assigned the result of adding something to this string. Consider using `String::push_str()` instead - --> examples/strings.rs:24:9 + --> strings.rs:24:9 | 24 | x = x + "."; | ^^^^^^^^^^^ @@ -23,7 +23,7 @@ error: you assigned the result of adding something to this string. Consider usin = note: `-D string-add-assign` implied by `-D warnings` error: you assigned the result of adding something to this string. Consider using `String::push_str()` instead - --> examples/strings.rs:38:9 + --> strings.rs:38:9 | 38 | x = x + "."; | ^^^^^^^^^^^ @@ -31,7 +31,7 @@ error: you assigned the result of adding something to this string. Consider usin = note: `-D string-add-assign` implied by `-D warnings` error: you added something to a string. Consider using `String::push_str()` instead - --> examples/strings.rs:42:13 + --> strings.rs:42:13 | 42 | let z = y + "..."; | ^^^^^^^^^ @@ -39,7 +39,7 @@ error: you added something to a string. Consider using `String::push_str()` inst = note: `-D string-add` implied by `-D warnings` error: calling `as_bytes()` on a string literal - --> examples/strings.rs:50:14 + --> strings.rs:50:14 | 50 | let bs = "hello there".as_bytes(); | ^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using a byte string literal instead `b"hello there"` @@ -47,7 +47,7 @@ error: calling `as_bytes()` on a string literal = note: `-D string-lit-as-bytes` implied by `-D warnings` error: manual implementation of an assign operation - --> examples/strings.rs:65:7 + --> strings.rs:65:7 | 65 | ; x = x + 1; | ^^^^^^^^^ help: replace it with `x += 1` diff --git a/clippy_tests/examples/stutter.stderr b/clippy_tests/examples/stutter.stderr index 585c9342a10..750ed3b05c7 100644 --- a/clippy_tests/examples/stutter.stderr +++ b/clippy_tests/examples/stutter.stderr @@ -1,5 +1,5 @@ error: item name starts with its containing module's name - --> examples/stutter.rs:8:5 + --> stutter.rs:8:5 | 8 | pub fn foo_bar() {} | ^^^^^^^^^^^^^^^^^^^ @@ -7,7 +7,7 @@ error: item name starts with its containing module's name = note: `-D stutter` implied by `-D warnings` error: item name ends with its containing module's name - --> examples/stutter.rs:9:5 + --> stutter.rs:9:5 | 9 | pub fn bar_foo() {} | ^^^^^^^^^^^^^^^^^^^ @@ -15,7 +15,7 @@ error: item name ends with its containing module's name = note: `-D stutter` implied by `-D warnings` error: item name starts with its containing module's name - --> examples/stutter.rs:10:5 + --> stutter.rs:10:5 | 10 | pub struct FooCake {} | ^^^^^^^^^^^^^^^^^^^^^ @@ -23,7 +23,7 @@ error: item name starts with its containing module's name = note: `-D stutter` implied by `-D warnings` error: item name ends with its containing module's name - --> examples/stutter.rs:11:5 + --> stutter.rs:11:5 | 11 | pub enum CakeFoo {} | ^^^^^^^^^^^^^^^^^^^ diff --git a/clippy_tests/examples/swap.stderr b/clippy_tests/examples/swap.stderr index 23fd7688a6e..494bc41a596 100644 --- a/clippy_tests/examples/swap.stderr +++ b/clippy_tests/examples/swap.stderr @@ -1,5 +1,5 @@ error: this looks like you are swapping elements of `foo` manually - --> examples/swap.rs:11:5 + --> swap.rs:11:5 | 11 | / let temp = foo[0]; 12 | | foo[0] = foo[1]; @@ -9,7 +9,7 @@ error: this looks like you are swapping elements of `foo` manually = note: `-D manual-swap` implied by `-D warnings` error: this looks like you are swapping elements of `foo` manually - --> examples/swap.rs:20:5 + --> swap.rs:20:5 | 20 | / let temp = foo[0]; 21 | | foo[0] = foo[1]; @@ -19,7 +19,7 @@ error: this looks like you are swapping elements of `foo` manually = note: `-D manual-swap` implied by `-D warnings` error: this looks like you are swapping elements of `foo` manually - --> examples/swap.rs:29:5 + --> swap.rs:29:5 | 29 | / let temp = foo[0]; 30 | | foo[0] = foo[1]; @@ -29,7 +29,7 @@ error: this looks like you are swapping elements of `foo` manually = note: `-D manual-swap` implied by `-D warnings` error: this looks like you are swapping `a` and `b` manually - --> examples/swap.rs:47:7 + --> swap.rs:47:7 | 47 | ; let t = a; | _______^ @@ -41,7 +41,7 @@ error: this looks like you are swapping `a` and `b` manually = note: or maybe you should use `std::mem::replace`? error: this looks like you are swapping `c.0` and `a` manually - --> examples/swap.rs:56:7 + --> swap.rs:56:7 | 56 | ; let t = c.0; | _______^ @@ -53,7 +53,7 @@ error: this looks like you are swapping `c.0` and `a` manually = note: or maybe you should use `std::mem::replace`? error: this looks like you are trying to swap `a` and `b` - --> examples/swap.rs:44:5 + --> swap.rs:44:5 | 44 | / a = b; 45 | | b = a; @@ -63,7 +63,7 @@ error: this looks like you are trying to swap `a` and `b` = note: or maybe you should use `std::mem::replace`? error: this looks like you are trying to swap `c.0` and `a` - --> examples/swap.rs:53:5 + --> swap.rs:53:5 | 53 | / c.0 = a; 54 | | a = c.0; diff --git a/clippy_tests/examples/temporary_assignment.stderr b/clippy_tests/examples/temporary_assignment.stderr index ad19e7fac5a..73d5070d075 100644 --- a/clippy_tests/examples/temporary_assignment.stderr +++ b/clippy_tests/examples/temporary_assignment.stderr @@ -1,5 +1,5 @@ error: assignment to temporary - --> examples/temporary_assignment.rs:29:5 + --> temporary_assignment.rs:29:5 | 29 | Struct { field: 0 }.field = 1; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -7,7 +7,7 @@ error: assignment to temporary = note: `-D temporary-assignment` implied by `-D warnings` error: assignment to temporary - --> examples/temporary_assignment.rs:30:5 + --> temporary_assignment.rs:30:5 | 30 | (0, 0).0 = 1; | ^^^^^^^^^^^^ diff --git a/clippy_tests/examples/toplevel_ref_arg.stderr b/clippy_tests/examples/toplevel_ref_arg.stderr index ae53f77c741..b25e464f302 100644 --- a/clippy_tests/examples/toplevel_ref_arg.stderr +++ b/clippy_tests/examples/toplevel_ref_arg.stderr @@ -1,5 +1,5 @@ error: `ref` directly on a function argument is ignored. Consider using a reference type instead. - --> examples/toplevel_ref_arg.rs:7:15 + --> toplevel_ref_arg.rs:7:15 | 7 | fn the_answer(ref mut x: u8) { | ^^^^^^^^^ @@ -7,7 +7,7 @@ error: `ref` directly on a function argument is ignored. Consider using a refere = note: `-D toplevel-ref-arg` implied by `-D warnings` error: `ref` on an entire `let` pattern is discouraged, take a reference with `&` instead - --> examples/toplevel_ref_arg.rs:18:7 + --> toplevel_ref_arg.rs:18:7 | 18 | let ref x = 1; | ----^^^^^----- help: try `let x = &1;` @@ -15,7 +15,7 @@ error: `ref` on an entire `let` pattern is discouraged, take a reference with `& = note: `-D toplevel-ref-arg` implied by `-D warnings` error: `ref` on an entire `let` pattern is discouraged, take a reference with `&` instead - --> examples/toplevel_ref_arg.rs:20:7 + --> toplevel_ref_arg.rs:20:7 | 20 | let ref y: (&_, u8) = (&1, 2); | ----^^^^^--------------------- help: try `let y: &(&_, u8) = &(&1, 2);` @@ -23,7 +23,7 @@ error: `ref` on an entire `let` pattern is discouraged, take a reference with `& = note: `-D toplevel-ref-arg` implied by `-D warnings` error: `ref` on an entire `let` pattern is discouraged, take a reference with `&` instead - --> examples/toplevel_ref_arg.rs:22:7 + --> toplevel_ref_arg.rs:22:7 | 22 | let ref z = 1 + 2; | ----^^^^^--------- help: try `let z = &(1 + 2);` @@ -31,7 +31,7 @@ error: `ref` on an entire `let` pattern is discouraged, take a reference with `& = note: `-D toplevel-ref-arg` implied by `-D warnings` error: `ref` on an entire `let` pattern is discouraged, take a reference with `&` instead - --> examples/toplevel_ref_arg.rs:24:7 + --> toplevel_ref_arg.rs:24:7 | 24 | let ref mut z = 1 + 2; | ----^^^^^^^^^--------- help: try `let z = &mut (1 + 2);` diff --git a/clippy_tests/examples/unicode.stderr b/clippy_tests/examples/unicode.stderr index f9c0acbf33a..341006ecd67 100644 --- a/clippy_tests/examples/unicode.stderr +++ b/clippy_tests/examples/unicode.stderr @@ -1,5 +1,5 @@ error: zero-width space detected - --> examples/unicode.rs:6:12 + --> unicode.rs:6:12 | 6 | print!("Here >​< is a ZWS, and ​another"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -9,7 +9,7 @@ error: zero-width space detected ""Here >\u{200B}< is a ZWS, and \u{200B}another"" error: non-nfc unicode sequence detected - --> examples/unicode.rs:12:12 + --> unicode.rs:12:12 | 12 | print!("̀àh?"); | ^^^^^^^ @@ -19,7 +19,7 @@ error: non-nfc unicode sequence detected ""̀àh?"" error: literal non-ASCII character detected - --> examples/unicode.rs:18:12 + --> unicode.rs:18:12 | 18 | print!("Üben!"); | ^^^^^^^ diff --git a/clippy_tests/examples/unit_cmp.stderr b/clippy_tests/examples/unit_cmp.stderr index 2853cdd3d6b..c4bcb635eba 100644 --- a/clippy_tests/examples/unit_cmp.stderr +++ b/clippy_tests/examples/unit_cmp.stderr @@ -1,5 +1,5 @@ error: ==-comparison of unit values detected. This will always be true - --> examples/unit_cmp.rs:16:8 + --> unit_cmp.rs:16:8 | 16 | if { true; } == { false; } { | ^^^^^^^^^^^^^^^^^^^^^^^ @@ -7,7 +7,7 @@ error: ==-comparison of unit values detected. This will always be true = note: `-D unit-cmp` implied by `-D warnings` error: >-comparison of unit values detected. This will always be false - --> examples/unit_cmp.rs:19:8 + --> unit_cmp.rs:19:8 | 19 | if { true; } > { false; } { | ^^^^^^^^^^^^^^^^^^^^^^ diff --git a/clippy_tests/examples/unneeded_field_pattern.stderr b/clippy_tests/examples/unneeded_field_pattern.stderr index 2bd823f97ac..22f9c3cdc8a 100644 --- a/clippy_tests/examples/unneeded_field_pattern.stderr +++ b/clippy_tests/examples/unneeded_field_pattern.stderr @@ -1,5 +1,5 @@ error: You matched a field with a wildcard pattern. Consider using `..` instead - --> examples/unneeded_field_pattern.rs:17:15 + --> unneeded_field_pattern.rs:17:15 | 17 | Foo { a: _, b: 0, .. } => {} | ^^^^ @@ -8,7 +8,7 @@ error: You matched a field with a wildcard pattern. Consider using `..` instead = help: Try with `Foo { b: 0, .. }` error: All the struct fields are matched to a wildcard pattern, consider using `..`. - --> examples/unneeded_field_pattern.rs:19:9 + --> unneeded_field_pattern.rs:19:9 | 19 | Foo { a: _, b: _, c: _ } => {} | ^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/clippy_tests/examples/unsafe_removed_from_name.stderr b/clippy_tests/examples/unsafe_removed_from_name.stderr index 5f4eb8e4b26..8bdee95b557 100644 --- a/clippy_tests/examples/unsafe_removed_from_name.stderr +++ b/clippy_tests/examples/unsafe_removed_from_name.stderr @@ -1,5 +1,5 @@ error: removed "unsafe" from the name of `UnsafeCell` in use as `TotallySafeCell` - --> examples/unsafe_removed_from_name.rs:7:1 + --> unsafe_removed_from_name.rs:7:1 | 7 | use std::cell::{UnsafeCell as TotallySafeCell}; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -7,7 +7,7 @@ error: removed "unsafe" from the name of `UnsafeCell` in use as `TotallySafeCell = note: `-D unsafe-removed-from-name` implied by `-D warnings` error: removed "unsafe" from the name of `UnsafeCell` in use as `TotallySafeCellAgain` - --> examples/unsafe_removed_from_name.rs:9:1 + --> unsafe_removed_from_name.rs:9:1 | 9 | use std::cell::UnsafeCell as TotallySafeCellAgain; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -15,7 +15,7 @@ error: removed "unsafe" from the name of `UnsafeCell` in use as `TotallySafeCell = note: `-D unsafe-removed-from-name` implied by `-D warnings` error: removed "unsafe" from the name of `Unsafe` in use as `LieAboutModSafety` - --> examples/unsafe_removed_from_name.rs:23:1 + --> unsafe_removed_from_name.rs:23:1 | 23 | use mod_with_some_unsafe_things::Unsafe as LieAboutModSafety; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/clippy_tests/examples/unused_io_amount.stderr b/clippy_tests/examples/unused_io_amount.stderr index 5c455f5a94b..3b58cd541d2 100644 --- a/clippy_tests/examples/unused_io_amount.stderr +++ b/clippy_tests/examples/unused_io_amount.stderr @@ -1,5 +1,5 @@ error: handle written amount returned or use `Write::write_all` instead - --> examples/unused_io_amount.rs:11:5 + --> unused_io_amount.rs:11:5 | 11 | try!(s.write(b"test")); | ^^^^^^^^^^^^^^^^^^^^^^^ @@ -8,7 +8,7 @@ error: handle written amount returned or use `Write::write_all` instead = note: this error originates in a macro outside of the current crate error: handle read amount returned or use `Read::read_exact` instead - --> examples/unused_io_amount.rs:13:5 + --> unused_io_amount.rs:13:5 | 13 | try!(s.read(&mut buf)); | ^^^^^^^^^^^^^^^^^^^^^^^ @@ -17,7 +17,7 @@ error: handle read amount returned or use `Read::read_exact` instead = note: this error originates in a macro outside of the current crate error: handle written amount returned or use `Write::write_all` instead - --> examples/unused_io_amount.rs:18:5 + --> unused_io_amount.rs:18:5 | 18 | s.write(b"test")?; | ^^^^^^^^^^^^^^^^^ @@ -25,7 +25,7 @@ error: handle written amount returned or use `Write::write_all` instead = note: `-D unused-io-amount` implied by `-D warnings` error: handle read amount returned or use `Read::read_exact` instead - --> examples/unused_io_amount.rs:20:5 + --> unused_io_amount.rs:20:5 | 20 | s.read(&mut buf)?; | ^^^^^^^^^^^^^^^^^ @@ -33,7 +33,7 @@ error: handle read amount returned or use `Read::read_exact` instead = note: `-D unused-io-amount` implied by `-D warnings` error: handle written amount returned or use `Write::write_all` instead - --> examples/unused_io_amount.rs:25:5 + --> unused_io_amount.rs:25:5 | 25 | s.write(b"test").unwrap(); | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -41,7 +41,7 @@ error: handle written amount returned or use `Write::write_all` instead = note: `-D unused-io-amount` implied by `-D warnings` error: handle read amount returned or use `Read::read_exact` instead - --> examples/unused_io_amount.rs:27:5 + --> unused_io_amount.rs:27:5 | 27 | s.read(&mut buf).unwrap(); | ^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/clippy_tests/examples/unused_labels.stderr b/clippy_tests/examples/unused_labels.stderr index 85edc26498f..1af6dc6b44f 100644 --- a/clippy_tests/examples/unused_labels.stderr +++ b/clippy_tests/examples/unused_labels.stderr @@ -1,5 +1,5 @@ error: unused label `'label` - --> examples/unused_labels.rs:8:5 + --> unused_labels.rs:8:5 | 8 | / 'label: for i in 1..2 { 9 | | if i > 4 { continue } @@ -9,7 +9,7 @@ error: unused label `'label` = note: `-D unused-label` implied by `-D warnings` error: unused label `'a` - --> examples/unused_labels.rs:21:5 + --> unused_labels.rs:21:5 | 21 | 'a: loop { break } | ^^^^^^^^^^^^^^^^^^ @@ -17,7 +17,7 @@ error: unused label `'a` = note: `-D unused-label` implied by `-D warnings` error: unused label `'same_label_in_two_fns` - --> examples/unused_labels.rs:32:5 + --> unused_labels.rs:32:5 | 32 | / 'same_label_in_two_fns: loop { 33 | | let _ = 1; diff --git a/clippy_tests/examples/unused_lt.stderr b/clippy_tests/examples/unused_lt.stderr index 1afe801bd26..d1e354307d2 100644 --- a/clippy_tests/examples/unused_lt.stderr +++ b/clippy_tests/examples/unused_lt.stderr @@ -1,5 +1,5 @@ error: this lifetime isn't used in the function definition - --> examples/unused_lt.rs:16:14 + --> unused_lt.rs:16:14 | 16 | fn unused_lt<'a>(x: u8) { | ^^ @@ -7,7 +7,7 @@ error: this lifetime isn't used in the function definition = note: `-D unused-lifetimes` implied by `-D warnings` error: this lifetime isn't used in the function definition - --> examples/unused_lt.rs:20:25 + --> unused_lt.rs:20:25 | 20 | fn unused_lt_transitive<'a, 'b: 'a>(x: &'b u8) { | ^^ @@ -15,7 +15,7 @@ error: this lifetime isn't used in the function definition = note: `-D unused-lifetimes` implied by `-D warnings` error: this lifetime isn't used in the function definition - --> examples/unused_lt.rs:50:10 + --> unused_lt.rs:50:10 | 50 | fn x<'a>(&self) {} | ^^ diff --git a/clippy_tests/examples/used_underscore_binding.stderr b/clippy_tests/examples/used_underscore_binding.stderr index 4ec01d8b8c0..7cb3c9ca74d 100644 --- a/clippy_tests/examples/used_underscore_binding.stderr +++ b/clippy_tests/examples/used_underscore_binding.stderr @@ -1,5 +1,5 @@ error: used binding `_foo` which is prefixed with an underscore. A leading underscore signals that a binding will not be used. - --> examples/used_underscore_binding.rs:17:5 + --> used_underscore_binding.rs:17:5 | 17 | _foo + 1 | ^^^^ @@ -7,7 +7,7 @@ error: used binding `_foo` which is prefixed with an underscore. A leading under = note: `-D used-underscore-binding` implied by `-D warnings` error: used binding `_foo` which is prefixed with an underscore. A leading underscore signals that a binding will not be used. - --> examples/used_underscore_binding.rs:22:20 + --> used_underscore_binding.rs:22:20 | 22 | println!("{}", _foo); | ^^^^ @@ -15,7 +15,7 @@ error: used binding `_foo` which is prefixed with an underscore. A leading under = note: `-D used-underscore-binding` implied by `-D warnings` error: used binding `_foo` which is prefixed with an underscore. A leading underscore signals that a binding will not be used. - --> examples/used_underscore_binding.rs:23:16 + --> used_underscore_binding.rs:23:16 | 23 | assert_eq!(_foo, _foo); | ^^^^ @@ -23,7 +23,7 @@ error: used binding `_foo` which is prefixed with an underscore. A leading under = note: `-D used-underscore-binding` implied by `-D warnings` error: used binding `_foo` which is prefixed with an underscore. A leading underscore signals that a binding will not be used. - --> examples/used_underscore_binding.rs:23:22 + --> used_underscore_binding.rs:23:22 | 23 | assert_eq!(_foo, _foo); | ^^^^ @@ -31,7 +31,7 @@ error: used binding `_foo` which is prefixed with an underscore. A leading under = note: `-D used-underscore-binding` implied by `-D warnings` error: used binding `_underscore_field` which is prefixed with an underscore. A leading underscore signals that a binding will not be used. - --> examples/used_underscore_binding.rs:36:5 + --> used_underscore_binding.rs:36:5 | 36 | s._underscore_field += 1; | ^^^^^^^^^^^^^^^^^^^ diff --git a/clippy_tests/examples/useless_attribute.stderr b/clippy_tests/examples/useless_attribute.stderr index bd318601b31..d7ab2b0ad26 100644 --- a/clippy_tests/examples/useless_attribute.stderr +++ b/clippy_tests/examples/useless_attribute.stderr @@ -1,5 +1,5 @@ error[E0463]: can't find crate for `clippy_lints` - --> examples/useless_attribute.rs:6:1 + --> useless_attribute.rs:6:1 | 6 | extern crate clippy_lints; | ^^^^^^^^^^^^^^^^^^^^^^^^^^ can't find crate diff --git a/clippy_tests/examples/vec.stderr b/clippy_tests/examples/vec.stderr index 02cc6911d50..e96a0365cf1 100644 --- a/clippy_tests/examples/vec.stderr +++ b/clippy_tests/examples/vec.stderr @@ -1,5 +1,5 @@ error: useless use of `vec!` - --> examples/vec.rs:24:14 + --> vec.rs:24:14 | 24 | on_slice(&vec![]); | ^^^^^^^ help: you can use a slice directly `&[]` @@ -7,7 +7,7 @@ error: useless use of `vec!` = note: `-D useless-vec` implied by `-D warnings` error: useless use of `vec!` - --> examples/vec.rs:27:14 + --> vec.rs:27:14 | 27 | on_slice(&vec![1, 2]); | ^^^^^^^^^^^ help: you can use a slice directly `&[1, 2]` @@ -15,7 +15,7 @@ error: useless use of `vec!` = note: `-D useless-vec` implied by `-D warnings` error: useless use of `vec!` - --> examples/vec.rs:30:14 + --> vec.rs:30:14 | 30 | on_slice(&vec ![1, 2]); | ^^^^^^^^^^^^ help: you can use a slice directly `&[1, 2]` @@ -23,7 +23,7 @@ error: useless use of `vec!` = note: `-D useless-vec` implied by `-D warnings` error: useless use of `vec!` - --> examples/vec.rs:33:14 + --> vec.rs:33:14 | 33 | on_slice(&vec!(1, 2)); | ^^^^^^^^^^^ help: you can use a slice directly `&[1, 2]` @@ -31,7 +31,7 @@ error: useless use of `vec!` = note: `-D useless-vec` implied by `-D warnings` error: useless use of `vec!` - --> examples/vec.rs:36:14 + --> vec.rs:36:14 | 36 | on_slice(&vec![1; 2]); | ^^^^^^^^^^^ help: you can use a slice directly `&[1; 2]` @@ -39,7 +39,7 @@ error: useless use of `vec!` = note: `-D useless-vec` implied by `-D warnings` error: useless use of `vec!` - --> examples/vec.rs:49:14 + --> vec.rs:49:14 | 49 | for a in vec![1, 2, 3] { | ^^^^^^^^^^^^^ help: you can use a slice directly `&[1, 2, 3]` diff --git a/clippy_tests/examples/while_loop.stderr b/clippy_tests/examples/while_loop.stderr index ae7675ad22d..06f68d29bae 100644 --- a/clippy_tests/examples/while_loop.stderr +++ b/clippy_tests/examples/while_loop.stderr @@ -1,5 +1,5 @@ error: this loop could be written as a `while let` loop - --> examples/while_loop.rs:9:5 + --> while_loop.rs:9:5 | 9 | / loop { 10 | | if let Some(_x) = y { @@ -13,7 +13,7 @@ error: this loop could be written as a `while let` loop = note: `-D while-let-loop` implied by `-D warnings` error: this loop could be written as a `while let` loop - --> examples/while_loop.rs:22:5 + --> while_loop.rs:22:5 | 22 | / loop { 23 | | match y { @@ -26,7 +26,7 @@ error: this loop could be written as a `while let` loop = note: `-D while-let-loop` implied by `-D warnings` error: this loop could be written as a `while let` loop - --> examples/while_loop.rs:28:5 + --> while_loop.rs:28:5 | 28 | / loop { 29 | | let x = match y { @@ -40,7 +40,7 @@ error: this loop could be written as a `while let` loop = note: `-D while-let-loop` implied by `-D warnings` error: this loop could be written as a `while let` loop - --> examples/while_loop.rs:36:5 + --> while_loop.rs:36:5 | 36 | / loop { 37 | | let x = match y { @@ -54,7 +54,7 @@ error: this loop could be written as a `while let` loop = note: `-D while-let-loop` implied by `-D warnings` error: this loop could be written as a `while let` loop - --> examples/while_loop.rs:58:5 + --> while_loop.rs:58:5 | 58 | / loop { 59 | | let (e, l) = match "".split_whitespace().next() { @@ -68,7 +68,7 @@ error: this loop could be written as a `while let` loop = note: `-D while-let-loop` implied by `-D warnings` error: this loop could be written as a `for` loop - --> examples/while_loop.rs:68:5 + --> while_loop.rs:68:5 | 68 | / while let Option::Some(x) = iter.next() { 69 | | println!("{}", x); @@ -78,7 +78,7 @@ error: this loop could be written as a `for` loop = note: `-D while-let-on-iterator` implied by `-D warnings` error: this loop could be written as a `for` loop - --> examples/while_loop.rs:73:5 + --> while_loop.rs:73:5 | 73 | / while let Some(x) = iter.next() { 74 | | println!("{}", x); @@ -88,7 +88,7 @@ error: this loop could be written as a `for` loop = note: `-D while-let-on-iterator` implied by `-D warnings` error: this loop could be written as a `for` loop - --> examples/while_loop.rs:78:5 + --> while_loop.rs:78:5 | 78 | while let Some(_) = iter.next() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try `for _ in iter { .. }` @@ -96,7 +96,7 @@ error: this loop could be written as a `for` loop = note: `-D while-let-on-iterator` implied by `-D warnings` error: this loop could be written as a `while let` loop - --> examples/while_loop.rs:118:5 + --> while_loop.rs:118:5 | 118 | / loop { 119 | | let _ = match iter.next() { @@ -110,7 +110,7 @@ error: this loop could be written as a `while let` loop = note: `-D while-let-loop` implied by `-D warnings` error: empty `loop {}` detected. You may want to either use `panic!()` or add `std::thread::sleep(..);` to the loop body. - --> examples/while_loop.rs:123:9 + --> while_loop.rs:123:9 | 123 | loop {} | ^^^^^^^ diff --git a/clippy_tests/examples/wrong_self_convention.stderr b/clippy_tests/examples/wrong_self_convention.stderr index 1d383b07804..4d19311f5ac 100644 --- a/clippy_tests/examples/wrong_self_convention.stderr +++ b/clippy_tests/examples/wrong_self_convention.stderr @@ -1,5 +1,5 @@ error: methods called `from_*` usually take no self; consider choosing a less ambiguous name - --> examples/wrong_self_convention.rs:21:17 + --> wrong_self_convention.rs:21:17 | 21 | fn from_i32(self) {} | ^^^^ @@ -7,7 +7,7 @@ error: methods called `from_*` usually take no self; consider choosing a less am = note: `-D wrong-self-convention` implied by `-D warnings` error: methods called `from_*` usually take no self; consider choosing a less ambiguous name - --> examples/wrong_self_convention.rs:27:21 + --> wrong_self_convention.rs:27:21 | 27 | pub fn from_i64(self) {} | ^^^^ @@ -15,7 +15,7 @@ error: methods called `from_*` usually take no self; consider choosing a less am = note: `-D wrong-self-convention` implied by `-D warnings` error: methods called `as_*` usually take self by reference or self by mutable reference; consider choosing a less ambiguous name - --> examples/wrong_self_convention.rs:38:15 + --> wrong_self_convention.rs:38:15 | 38 | fn as_i32(self) {} | ^^^^ @@ -23,7 +23,7 @@ error: methods called `as_*` usually take self by reference or self by mutable r = note: `-D wrong-self-convention` implied by `-D warnings` error: methods called `into_*` usually take self by value; consider choosing a less ambiguous name - --> examples/wrong_self_convention.rs:40:17 + --> wrong_self_convention.rs:40:17 | 40 | fn into_i32(&self) {} | ^^^^^ @@ -31,7 +31,7 @@ error: methods called `into_*` usually take self by value; consider choosing a l = note: `-D wrong-self-convention` implied by `-D warnings` error: methods called `is_*` usually take self by reference or no self; consider choosing a less ambiguous name - --> examples/wrong_self_convention.rs:42:15 + --> wrong_self_convention.rs:42:15 | 42 | fn is_i32(self) {} | ^^^^ @@ -39,7 +39,7 @@ error: methods called `is_*` usually take self by reference or no self; consider = note: `-D wrong-self-convention` implied by `-D warnings` error: methods called `to_*` usually take self by reference; consider choosing a less ambiguous name - --> examples/wrong_self_convention.rs:44:15 + --> wrong_self_convention.rs:44:15 | 44 | fn to_i32(self) {} | ^^^^ @@ -47,7 +47,7 @@ error: methods called `to_*` usually take self by reference; consider choosing a = note: `-D wrong-self-convention` implied by `-D warnings` error: methods called `from_*` usually take no self; consider choosing a less ambiguous name - --> examples/wrong_self_convention.rs:46:17 + --> wrong_self_convention.rs:46:17 | 46 | fn from_i32(self) {} | ^^^^ @@ -55,7 +55,7 @@ error: methods called `from_*` usually take no self; consider choosing a less am = note: `-D wrong-self-convention` implied by `-D warnings` error: methods called `as_*` usually take self by reference or self by mutable reference; consider choosing a less ambiguous name - --> examples/wrong_self_convention.rs:48:19 + --> wrong_self_convention.rs:48:19 | 48 | pub fn as_i64(self) {} | ^^^^ @@ -63,7 +63,7 @@ error: methods called `as_*` usually take self by reference or self by mutable r = note: `-D wrong-self-convention` implied by `-D warnings` error: methods called `into_*` usually take self by value; consider choosing a less ambiguous name - --> examples/wrong_self_convention.rs:49:21 + --> wrong_self_convention.rs:49:21 | 49 | pub fn into_i64(&self) {} | ^^^^^ @@ -71,7 +71,7 @@ error: methods called `into_*` usually take self by value; consider choosing a l = note: `-D wrong-self-convention` implied by `-D warnings` error: methods called `is_*` usually take self by reference or no self; consider choosing a less ambiguous name - --> examples/wrong_self_convention.rs:50:19 + --> wrong_self_convention.rs:50:19 | 50 | pub fn is_i64(self) {} | ^^^^ @@ -79,7 +79,7 @@ error: methods called `is_*` usually take self by reference or no self; consider = note: `-D wrong-self-convention` implied by `-D warnings` error: methods called `to_*` usually take self by reference; consider choosing a less ambiguous name - --> examples/wrong_self_convention.rs:51:19 + --> wrong_self_convention.rs:51:19 | 51 | pub fn to_i64(self) {} | ^^^^ @@ -87,7 +87,7 @@ error: methods called `to_*` usually take self by reference; consider choosing a = note: `-D wrong-self-convention` implied by `-D warnings` error: methods called `from_*` usually take no self; consider choosing a less ambiguous name - --> examples/wrong_self_convention.rs:52:21 + --> wrong_self_convention.rs:52:21 | 52 | pub fn from_i64(self) {} | ^^^^ diff --git a/clippy_tests/examples/zero_div_zero.stderr b/clippy_tests/examples/zero_div_zero.stderr index cc1e40fdb0e..04605a786d0 100644 --- a/clippy_tests/examples/zero_div_zero.stderr +++ b/clippy_tests/examples/zero_div_zero.stderr @@ -1,5 +1,5 @@ error: equal expressions as operands to `/` - --> examples/zero_div_zero.rs:7:15 + --> zero_div_zero.rs:7:15 | 7 | let nan = 0.0 / 0.0; | ^^^^^^^^^ @@ -7,7 +7,7 @@ error: equal expressions as operands to `/` = note: `-D eq-op` implied by `-D warnings` error: constant division of 0.0 with 0.0 will always result in NaN - --> examples/zero_div_zero.rs:7:15 + --> zero_div_zero.rs:7:15 | 7 | let nan = 0.0 / 0.0; | ^^^^^^^^^ @@ -16,7 +16,7 @@ error: constant division of 0.0 with 0.0 will always result in NaN = help: Consider using `std::f32::NAN` if you would like a constant representing NaN error: equal expressions as operands to `/` - --> examples/zero_div_zero.rs:8:19 + --> zero_div_zero.rs:8:19 | 8 | let f64_nan = 0.0 / 0.0f64; | ^^^^^^^^^^^^ @@ -24,7 +24,7 @@ error: equal expressions as operands to `/` = note: `-D eq-op` implied by `-D warnings` error: constant division of 0.0 with 0.0 will always result in NaN - --> examples/zero_div_zero.rs:8:19 + --> zero_div_zero.rs:8:19 | 8 | let f64_nan = 0.0 / 0.0f64; | ^^^^^^^^^^^^ @@ -33,7 +33,7 @@ error: constant division of 0.0 with 0.0 will always result in NaN = help: Consider using `std::f64::NAN` if you would like a constant representing NaN error: equal expressions as operands to `/` - --> examples/zero_div_zero.rs:9:25 + --> zero_div_zero.rs:9:25 | 9 | let other_f64_nan = 0.0f64 / 0.0; | ^^^^^^^^^^^^ @@ -41,7 +41,7 @@ error: equal expressions as operands to `/` = note: `-D eq-op` implied by `-D warnings` error: constant division of 0.0 with 0.0 will always result in NaN - --> examples/zero_div_zero.rs:9:25 + --> zero_div_zero.rs:9:25 | 9 | let other_f64_nan = 0.0f64 / 0.0; | ^^^^^^^^^^^^ @@ -50,7 +50,7 @@ error: constant division of 0.0 with 0.0 will always result in NaN = help: Consider using `std::f64::NAN` if you would like a constant representing NaN error: equal expressions as operands to `/` - --> examples/zero_div_zero.rs:10:28 + --> zero_div_zero.rs:10:28 | 10 | let one_more_f64_nan = 0.0f64/0.0f64; | ^^^^^^^^^^^^^ @@ -58,7 +58,7 @@ error: equal expressions as operands to `/` = note: `-D eq-op` implied by `-D warnings` error: constant division of 0.0 with 0.0 will always result in NaN - --> examples/zero_div_zero.rs:10:28 + --> zero_div_zero.rs:10:28 | 10 | let one_more_f64_nan = 0.0f64/0.0f64; | ^^^^^^^^^^^^^ diff --git a/clippy_tests/examples/zero_ptr.stderr b/clippy_tests/examples/zero_ptr.stderr index bf2b31f6427..031a3a4d3ed 100644 --- a/clippy_tests/examples/zero_ptr.stderr +++ b/clippy_tests/examples/zero_ptr.stderr @@ -1,5 +1,5 @@ error: `0 as *const _` detected. Consider using `ptr::null()` - --> examples/zero_ptr.rs:6:13 + --> zero_ptr.rs:6:13 | 6 | let x = 0 as *const usize; | ^^^^^^^^^^^^^^^^^ @@ -7,7 +7,7 @@ error: `0 as *const _` detected. Consider using `ptr::null()` = note: `-D zero-ptr` implied by `-D warnings` error: `0 as *mut _` detected. Consider using `ptr::null_mut()` - --> examples/zero_ptr.rs:7:13 + --> zero_ptr.rs:7:13 | 7 | let y = 0 as *mut f64; | ^^^^^^^^^^^^^ diff --git a/tests/examples.rs b/tests/examples.rs index e1ec0ae75aa..0b77b993ff6 100644 --- a/tests/examples.rs +++ b/tests/examples.rs @@ -2,7 +2,7 @@ extern crate duct; #[test] -fn compile_test() { +fn examples() { let mut error = false; for file in std::fs::read_dir("clippy_tests/examples").unwrap() { let file = file.unwrap().path(); @@ -12,7 +12,10 @@ fn compile_test() { } cmd!("touch", &file).run().unwrap(); let output = file.with_extension("stderr"); - cmd!("cargo", "rustc", "-q", "--example", file.file_stem().unwrap(), "--", "-Dwarnings") + cmd!("cargo", "rustc", "-q", "--example", file.file_stem().unwrap(), "--", "-Dwarnings", + "-Zremap-path-prefix-from=examples/", "-Zremap-path-prefix-to=", + "-Zremap-path-prefix-from=examples\\", "-Zremap-path-prefix-to=" + ) .unchecked() .stderr(&output) .env("CLIPPY_DISABLE_WIKI_LINKS", "true")