diff --git a/tests/ui/absurd-extreme-comparisons.stderr b/tests/ui/absurd-extreme-comparisons.stderr index 72b2f7a39..2e5ebec75 100644 --- a/tests/ui/absurd-extreme-comparisons.stderr +++ b/tests/ui/absurd-extreme-comparisons.stderr @@ -4,7 +4,7 @@ error: this comparison involving the minimum or maximum element for this type co 10 | u <= 0; | ^^^^^^ | - = note: `-D absurd-extreme-comparisons` implied by `-D warnings` + = note: `-D clippy::absurd-extreme-comparisons` implied by `-D warnings` = help: because 0 is the minimum value for this type, the case where the two sides are not equal never occurs, consider using u == 0 instead error: this comparison involving the minimum or maximum element for this type contains a case that is always true or always false @@ -141,7 +141,7 @@ error: <-comparison of unit values detected. This will always be false 31 | () < {}; | ^^^^^^^ | - = note: #[deny(unit_cmp)] on by default + = note: #[deny(clippy::unit_cmp)] on by default error: aborting due to 18 previous errors diff --git a/tests/ui/approx_const.stderr b/tests/ui/approx_const.stderr index e5d2ba296..3ff016b9c 100644 --- a/tests/ui/approx_const.stderr +++ b/tests/ui/approx_const.stderr @@ -4,7 +4,7 @@ error: approximate value of `f{32, 64}::consts::E` found. Consider using it dire 7 | let my_e = 2.7182; | ^^^^^^ | - = note: `-D approx-constant` implied by `-D warnings` + = note: `-D clippy::approx-constant` implied by `-D warnings` error: approximate value of `f{32, 64}::consts::E` found. Consider using it directly --> $DIR/approx_const.rs:8:20 diff --git a/tests/ui/arithmetic.stderr b/tests/ui/arithmetic.stderr index ad4a02e21..ee7a594fa 100644 --- a/tests/ui/arithmetic.stderr +++ b/tests/ui/arithmetic.stderr @@ -4,7 +4,7 @@ error: integer arithmetic detected 8 | 1 + i; | ^^^^^ | - = note: `-D integer-arithmetic` implied by `-D warnings` + = note: `-D clippy::integer-arithmetic` implied by `-D warnings` error: integer arithmetic detected --> $DIR/arithmetic.rs:9:5 @@ -37,7 +37,7 @@ error: floating-point arithmetic detected 23 | f * 2.0; | ^^^^^^^ | - = note: `-D float-arithmetic` implied by `-D warnings` + = note: `-D clippy::float-arithmetic` implied by `-D warnings` error: floating-point arithmetic detected --> $DIR/arithmetic.rs:25:5 diff --git a/tests/ui/assign_ops.stderr b/tests/ui/assign_ops.stderr index 826dacc53..fe7ccff78 100644 --- a/tests/ui/assign_ops.stderr +++ b/tests/ui/assign_ops.stderr @@ -1,57 +1,57 @@ -error: manual implementation of an assign operation - --> $DIR/assign_ops.rs:5:5 - | -5 | a = a + 1; - | ^^^^^^^^^ help: replace it with: `a += 1` - | - = note: `-D assign-op-pattern` implied by `-D warnings` - -error: manual implementation of an assign operation - --> $DIR/assign_ops.rs:6:5 - | -6 | a = 1 + a; - | ^^^^^^^^^ help: replace it with: `a += 1` - error: manual implementation of an assign operation --> $DIR/assign_ops.rs:7:5 | -7 | a = a - 1; - | ^^^^^^^^^ help: replace it with: `a -= 1` +7 | a = a + 1; + | ^^^^^^^^^ help: replace it with: `a += 1` + | + = note: `-D clippy::assign-op-pattern` implied by `-D warnings` error: manual implementation of an assign operation --> $DIR/assign_ops.rs:8:5 | -8 | a = a * 99; - | ^^^^^^^^^^ help: replace it with: `a *= 99` +8 | a = 1 + a; + | ^^^^^^^^^ help: replace it with: `a += 1` error: manual implementation of an assign operation --> $DIR/assign_ops.rs:9:5 | -9 | a = 42 * a; - | ^^^^^^^^^^ help: replace it with: `a *= 42` +9 | a = a - 1; + | ^^^^^^^^^ help: replace it with: `a -= 1` error: manual implementation of an assign operation --> $DIR/assign_ops.rs:10:5 | -10 | a = a / 2; - | ^^^^^^^^^ help: replace it with: `a /= 2` +10 | a = a * 99; + | ^^^^^^^^^^ help: replace it with: `a *= 99` error: manual implementation of an assign operation --> $DIR/assign_ops.rs:11:5 | -11 | a = a % 5; - | ^^^^^^^^^ help: replace it with: `a %= 5` +11 | a = 42 * a; + | ^^^^^^^^^^ help: replace it with: `a *= 42` error: manual implementation of an assign operation --> $DIR/assign_ops.rs:12:5 | -12 | a = a & 1; +12 | a = a / 2; + | ^^^^^^^^^ help: replace it with: `a /= 2` + +error: manual implementation of an assign operation + --> $DIR/assign_ops.rs:13:5 + | +13 | a = a % 5; + | ^^^^^^^^^ help: replace it with: `a %= 5` + +error: manual implementation of an assign operation + --> $DIR/assign_ops.rs:14:5 + | +14 | a = a & 1; | ^^^^^^^^^ help: replace it with: `a &= 1` error: manual implementation of an assign operation - --> $DIR/assign_ops.rs:18:5 + --> $DIR/assign_ops.rs:20:5 | -18 | s = s + "bla"; +20 | s = s + "bla"; | ^^^^^^^^^^^^^ help: replace it with: `s += "bla"` error: aborting due to 9 previous errors diff --git a/tests/ui/assign_ops2.stderr b/tests/ui/assign_ops2.stderr index 2858af1f8..93528e505 100644 --- a/tests/ui/assign_ops2.stderr +++ b/tests/ui/assign_ops2.stderr @@ -4,7 +4,7 @@ error: variable appears on both sides of an assignment operation 8 | a += a + 1; | ^^^^^^^^^^ | - = note: `-D misrefactored-assign-op` implied by `-D warnings` + = note: `-D clippy::misrefactored-assign-op` implied by `-D warnings` help: Did you mean a = a + 1 or a = a + a + 1? Consider replacing it with | 8 | a += 1; diff --git a/tests/ui/attrs.stderr b/tests/ui/attrs.stderr index f743399a6..6b6ecd675 100644 --- a/tests/ui/attrs.stderr +++ b/tests/ui/attrs.stderr @@ -4,7 +4,7 @@ error: you have declared `#[inline(always)]` on `test_attr_lint`. This is usuall 6 | #[inline(always)] | ^^^^^^^^^^^^^^^^^ | - = note: `-D inline-always` implied by `-D warnings` + = note: `-D clippy::inline-always` implied by `-D warnings` error: the since field must contain a semver-compliant version --> $DIR/attrs.rs:27:14 @@ -12,7 +12,7 @@ error: the since field must contain a semver-compliant version 27 | #[deprecated(since = "forever")] | ^^^^^^^^^^^^^^^^^ | - = note: `-D deprecated-semver` implied by `-D warnings` + = note: `-D clippy::deprecated-semver` implied by `-D warnings` error: the since field must contain a semver-compliant version --> $DIR/attrs.rs:30:14 diff --git a/tests/ui/author/matches.stderr b/tests/ui/author/matches.stderr index c4f69b10d..46618fe40 100644 --- a/tests/ui/author/matches.stderr +++ b/tests/ui/author/matches.stderr @@ -4,7 +4,7 @@ error: returning the result of a let binding from a block. Consider returning th 9 | x | ^ | - = note: `-D let-and-return` implied by `-D warnings` + = note: `-D clippy::let-and-return` implied by `-D warnings` note: this expression can be directly returned --> $DIR/matches.rs:8:21 | diff --git a/tests/ui/bit_masks.stderr b/tests/ui/bit_masks.stderr index e1a4a4291..dcf3f241b 100644 --- a/tests/ui/bit_masks.stderr +++ b/tests/ui/bit_masks.stderr @@ -4,7 +4,7 @@ error: &-masking with zero 12 | x & 0 == 0; | ^^^^^^^^^^ | - = note: `-D bad-bit-mask` implied by `-D warnings` + = note: `-D clippy::bad-bit-mask` implied by `-D warnings` error: this operation will always return zero. This is likely not the intended outcome --> $DIR/bit_masks.rs:12:5 @@ -12,7 +12,7 @@ error: this operation will always return zero. This is likely not the intended o 12 | x & 0 == 0; | ^^^^^ | - = note: #[deny(erasing_op)] on by default + = note: #[deny(clippy::erasing_op)] on by default error: incompatible bit mask: `_ & 2` can never be equal to `1` --> $DIR/bit_masks.rs:15:5 @@ -86,7 +86,7 @@ error: ineffective bit mask: `x | 1` compared to `3`, is the same as x compared 52 | x | 1 > 3; | ^^^^^^^^^ | - = note: `-D ineffective-bit-mask` implied by `-D warnings` + = note: `-D clippy::ineffective-bit-mask` implied by `-D warnings` error: ineffective bit mask: `x | 1` compared to `4`, is the same as x compared directly --> $DIR/bit_masks.rs:53:5 diff --git a/tests/ui/blacklisted_name.stderr b/tests/ui/blacklisted_name.stderr index 68fbe27a0..472401d5e 100644 --- a/tests/ui/blacklisted_name.stderr +++ b/tests/ui/blacklisted_name.stderr @@ -4,7 +4,7 @@ error: use of a blacklisted/placeholder name `foo` 7 | fn test(foo: ()) {} | ^^^ | - = note: `-D blacklisted-name` implied by `-D warnings` + = note: `-D clippy::blacklisted-name` implied by `-D warnings` error: use of a blacklisted/placeholder name `foo` --> $DIR/blacklisted_name.rs:10:9 diff --git a/tests/ui/block_in_if_condition.stderr b/tests/ui/block_in_if_condition.stderr index 4b7d12598..41f1e9c16 100644 --- a/tests/ui/block_in_if_condition.stderr +++ b/tests/ui/block_in_if_condition.stderr @@ -8,7 +8,7 @@ error: in an 'if' condition, avoid complex blocks or closures with blocks; inste 33 | | } { | |_____^ | - = note: `-D block-in-if-condition-stmt` implied by `-D warnings` + = note: `-D clippy::block-in-if-condition-stmt` implied by `-D warnings` = help: try let res = { let x = 3; @@ -24,7 +24,7 @@ error: omit braces around single expression condition 41 | if { true } { | ^^^^^^^^ | - = note: `-D block-in-if-condition-expr` implied by `-D warnings` + = note: `-D clippy::block-in-if-condition-expr` implied by `-D warnings` = help: try if true { 6 @@ -48,7 +48,7 @@ error: this boolean expression can be simplified 67 | if true && x == 3 { | ^^^^^^^^^^^^^^ help: try: `x == 3` | - = note: `-D nonminimal-bool` implied by `-D warnings` + = note: `-D clippy::nonminimal-bool` implied by `-D warnings` error: aborting due to 5 previous errors diff --git a/tests/ui/bool_comparison.stderr b/tests/ui/bool_comparison.stderr index 4436980bc..2fcde9436 100644 --- a/tests/ui/bool_comparison.stderr +++ b/tests/ui/bool_comparison.stderr @@ -4,7 +4,7 @@ error: equality checks against true are unnecessary 7 | if x == true { "yes" } else { "no" }; | ^^^^^^^^^ help: try simplifying it as shown: `x` | - = note: `-D bool-comparison` implied by `-D warnings` + = note: `-D clippy::bool-comparison` implied by `-D warnings` error: equality checks against false can be replaced by a negation --> $DIR/bool_comparison.rs:8:8 diff --git a/tests/ui/booleans.stderr b/tests/ui/booleans.stderr index f1996e8a2..45e371025 100644 --- a/tests/ui/booleans.stderr +++ b/tests/ui/booleans.stderr @@ -4,7 +4,7 @@ error: this boolean expression contains a logic bug 12 | let _ = a && b || a; | ^^^^^^^^^^^ help: it would look like the following: `a` | - = note: `-D logic-bug` implied by `-D warnings` + = note: `-D clippy::logic-bug` implied by `-D warnings` help: this expression can be optimized out by applying boolean operations to the outer expression --> $DIR/booleans.rs:12:18 | @@ -17,7 +17,7 @@ error: this boolean expression can be simplified 14 | let _ = !true; | ^^^^^ help: try: `false` | - = note: `-D nonminimal-bool` implied by `-D warnings` + = note: `-D clippy::nonminimal-bool` implied by `-D warnings` error: this boolean expression can be simplified --> $DIR/booleans.rs:15:13 diff --git a/tests/ui/borrow_box.stderr b/tests/ui/borrow_box.stderr index 2cf0ea796..1098c7785 100644 --- a/tests/ui/borrow_box.stderr +++ b/tests/ui/borrow_box.stderr @@ -7,8 +7,8 @@ error: you seem to be trying to use `&Box`. Consider using just `&T` note: lint level defined here --> $DIR/borrow_box.rs:4:9 | -4 | #![deny(borrowed_box)] - | ^^^^^^^^^^^^ +4 | #![deny(clippy::borrowed_box)] + | ^^^^^^^^^^^^^^^^^^^^ error: you seem to be trying to use `&Box`. Consider using just `&T` --> $DIR/borrow_box.rs:14:14 diff --git a/tests/ui/box_vec.stderr b/tests/ui/box_vec.stderr index 254d07713..b90bb5e2a 100644 --- a/tests/ui/box_vec.stderr +++ b/tests/ui/box_vec.stderr @@ -4,7 +4,7 @@ error: you seem to be trying to use `Box>`. Consider using just `Vec` 17 | pub fn test(foo: Box>) { | ^^^^^^^^^^^^^^ | - = note: `-D box-vec` implied by `-D warnings` + = note: `-D clippy::box-vec` implied by `-D warnings` = help: `Vec` is already on the heap, `Box>` makes an extra allocation. error: aborting due to previous error diff --git a/tests/ui/builtin-type-shadow.stderr b/tests/ui/builtin-type-shadow.stderr index 5757a6ef3..78924ebf9 100644 --- a/tests/ui/builtin-type-shadow.stderr +++ b/tests/ui/builtin-type-shadow.stderr @@ -4,7 +4,7 @@ error: This generic shadows the built-in type `u32` 5 | fn foo(a: u32) -> u32 { | ^^^ | - = note: `-D builtin-type-shadow` implied by `-D warnings` + = note: `-D clippy::builtin-type-shadow` implied by `-D warnings` error[E0308]: mismatched types --> $DIR/builtin-type-shadow.rs:6:5 diff --git a/tests/ui/bytecount.stderr b/tests/ui/bytecount.stderr index 307edecfd..0564d6a0b 100644 --- a/tests/ui/bytecount.stderr +++ b/tests/ui/bytecount.stderr @@ -7,8 +7,8 @@ error: You appear to be counting bytes the naive way note: lint level defined here --> $DIR/bytecount.rs:4:8 | -4 | #[deny(naive_bytecount)] - | ^^^^^^^^^^^^^^^ +4 | #[deny(clippy::naive_bytecount)] + | ^^^^^^^^^^^^^^^^^^^^^^^ error: You appear to be counting bytes the naive way --> $DIR/bytecount.rs:10:13 diff --git a/tests/ui/cast.stderr b/tests/ui/cast.stderr index 0a008cb68..2578c4989 100644 --- a/tests/ui/cast.stderr +++ b/tests/ui/cast.stderr @@ -4,7 +4,7 @@ error: casting i32 to f32 causes a loss of precision (i32 is 32 bits wide, but f 8 | 1i32 as f32; | ^^^^^^^^^^^ | - = note: `-D cast-precision-loss` implied by `-D warnings` + = note: `-D clippy::cast-precision-loss` implied by `-D warnings` error: casting i64 to f32 causes a loss of precision (i64 is 64 bits wide, but f32's mantissa is only 23 bits wide) --> $DIR/cast.rs:9:5 @@ -42,7 +42,7 @@ error: casting f32 to i32 may truncate the value 15 | 1f32 as i32; | ^^^^^^^^^^^ | - = note: `-D cast-possible-truncation` implied by `-D warnings` + = note: `-D clippy::cast-possible-truncation` implied by `-D warnings` error: casting f32 to u32 may truncate the value --> $DIR/cast.rs:16:5 @@ -56,7 +56,7 @@ error: casting f32 to u32 may lose the sign of the value 16 | 1f32 as u32; | ^^^^^^^^^^^ | - = note: `-D cast-sign-loss` implied by `-D warnings` + = note: `-D clippy::cast-sign-loss` implied by `-D warnings` error: casting f64 to f32 may truncate the value --> $DIR/cast.rs:17:5 @@ -106,7 +106,7 @@ error: casting u8 to i8 may wrap around the value 23 | 1u8 as i8; | ^^^^^^^^^ | - = note: `-D cast-possible-wrap` implied by `-D warnings` + = note: `-D clippy::cast-possible-wrap` implied by `-D warnings` error: casting u16 to i16 may wrap around the value --> $DIR/cast.rs:24:5 @@ -138,7 +138,7 @@ error: casting f32 to f64 may become silently lossy if types change 29 | 1.0f32 as f64; | ^^^^^^^^^^^^^ help: try: `f64::from(1.0f32)` | - = note: `-D cast-lossless` implied by `-D warnings` + = note: `-D clippy::cast-lossless` implied by `-D warnings` error: casting u8 to u16 may become silently lossy if types change --> $DIR/cast.rs:31:5 @@ -164,7 +164,7 @@ error: casting to the same type is unnecessary (`i32` -> `i32`) 37 | 1i32 as i32; | ^^^^^^^^^^^ | - = note: `-D unnecessary-cast` implied by `-D warnings` + = note: `-D clippy::unnecessary-cast` implied by `-D warnings` error: casting to the same type is unnecessary (`f32` -> `f32`) --> $DIR/cast.rs:38:5 diff --git a/tests/ui/cast_alignment.stderr b/tests/ui/cast_alignment.stderr index 42df78a37..d03d727a8 100644 --- a/tests/ui/cast_alignment.stderr +++ b/tests/ui/cast_alignment.stderr @@ -1,15 +1,15 @@ error: casting from `*const u8` to a more-strictly-aligned pointer (`*const u16`) - --> $DIR/cast_alignment.rs:13:5 + --> $DIR/cast_alignment.rs:15:5 | -13 | (&1u8 as *const u8) as *const u16; +15 | (&1u8 as *const u8) as *const u16; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: `-D cast-ptr-alignment` implied by `-D warnings` + = note: `-D clippy::cast-ptr-alignment` implied by `-D warnings` error: casting from `*mut u8` to a more-strictly-aligned pointer (`*mut u16`) - --> $DIR/cast_alignment.rs:14:5 + --> $DIR/cast_alignment.rs:16:5 | -14 | (&mut 1u8 as *mut u8) as *mut u16; +16 | (&mut 1u8 as *mut u8) as *mut u16; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 2 previous errors diff --git a/tests/ui/cast_lossless_float.stderr b/tests/ui/cast_lossless_float.stderr index a60f838fa..9025633a1 100644 --- a/tests/ui/cast_lossless_float.stderr +++ b/tests/ui/cast_lossless_float.stderr @@ -1,63 +1,63 @@ error: casting i8 to f32 may become silently lossy if types change - --> $DIR/cast_lossless_float.rs:5:5 + --> $DIR/cast_lossless_float.rs:7:5 | -5 | 1i8 as f32; +7 | 1i8 as f32; | ^^^^^^^^^^ help: try: `f32::from(1i8)` | - = note: `-D cast-lossless` implied by `-D warnings` + = note: `-D clippy::cast-lossless` implied by `-D warnings` error: casting i8 to f64 may become silently lossy if types change - --> $DIR/cast_lossless_float.rs:6:5 + --> $DIR/cast_lossless_float.rs:8:5 | -6 | 1i8 as f64; +8 | 1i8 as f64; | ^^^^^^^^^^ help: try: `f64::from(1i8)` error: casting u8 to f32 may become silently lossy if types change - --> $DIR/cast_lossless_float.rs:7:5 + --> $DIR/cast_lossless_float.rs:9:5 | -7 | 1u8 as f32; +9 | 1u8 as f32; | ^^^^^^^^^^ help: try: `f32::from(1u8)` error: casting u8 to f64 may become silently lossy if types change - --> $DIR/cast_lossless_float.rs:8:5 - | -8 | 1u8 as f64; - | ^^^^^^^^^^ help: try: `f64::from(1u8)` - -error: casting i16 to f32 may become silently lossy if types change - --> $DIR/cast_lossless_float.rs:9:5 - | -9 | 1i16 as f32; - | ^^^^^^^^^^^ help: try: `f32::from(1i16)` - -error: casting i16 to f64 may become silently lossy if types change --> $DIR/cast_lossless_float.rs:10:5 | -10 | 1i16 as f64; +10 | 1u8 as f64; + | ^^^^^^^^^^ help: try: `f64::from(1u8)` + +error: casting i16 to f32 may become silently lossy if types change + --> $DIR/cast_lossless_float.rs:11:5 + | +11 | 1i16 as f32; + | ^^^^^^^^^^^ help: try: `f32::from(1i16)` + +error: casting i16 to f64 may become silently lossy if types change + --> $DIR/cast_lossless_float.rs:12:5 + | +12 | 1i16 as f64; | ^^^^^^^^^^^ help: try: `f64::from(1i16)` error: casting u16 to f32 may become silently lossy if types change - --> $DIR/cast_lossless_float.rs:11:5 + --> $DIR/cast_lossless_float.rs:13:5 | -11 | 1u16 as f32; +13 | 1u16 as f32; | ^^^^^^^^^^^ help: try: `f32::from(1u16)` error: casting u16 to f64 may become silently lossy if types change - --> $DIR/cast_lossless_float.rs:12:5 + --> $DIR/cast_lossless_float.rs:14:5 | -12 | 1u16 as f64; +14 | 1u16 as f64; | ^^^^^^^^^^^ help: try: `f64::from(1u16)` error: casting i32 to f64 may become silently lossy if types change - --> $DIR/cast_lossless_float.rs:13:5 + --> $DIR/cast_lossless_float.rs:15:5 | -13 | 1i32 as f64; +15 | 1i32 as f64; | ^^^^^^^^^^^ help: try: `f64::from(1i32)` error: casting u32 to f64 may become silently lossy if types change - --> $DIR/cast_lossless_float.rs:14:5 + --> $DIR/cast_lossless_float.rs:16:5 | -14 | 1u32 as f64; +16 | 1u32 as f64; | ^^^^^^^^^^^ help: try: `f64::from(1u32)` error: aborting due to 10 previous errors diff --git a/tests/ui/cast_lossless_integer.stderr b/tests/ui/cast_lossless_integer.stderr index 19d617619..9640e1e18 100644 --- a/tests/ui/cast_lossless_integer.stderr +++ b/tests/ui/cast_lossless_integer.stderr @@ -4,7 +4,7 @@ error: casting i8 to i16 may become silently lossy if types change 6 | 1i8 as i16; | ^^^^^^^^^^ help: try: `i16::from(1i8)` | - = note: `-D cast-lossless` implied by `-D warnings` + = note: `-D clippy::cast-lossless` implied by `-D warnings` error: casting i8 to i32 may become silently lossy if types change --> $DIR/cast_lossless_integer.rs:7:5 diff --git a/tests/ui/cast_size.stderr b/tests/ui/cast_size.stderr index 1c4b12bce..1797e2e36 100644 --- a/tests/ui/cast_size.stderr +++ b/tests/ui/cast_size.stderr @@ -1,123 +1,123 @@ error: casting isize to i8 may truncate the value - --> $DIR/cast_size.rs:5:5 - | -5 | 1isize as i8; - | ^^^^^^^^^^^^ - | - = 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) - --> $DIR/cast_size.rs:6:5 - | -6 | 1isize as f64; - | ^^^^^^^^^^^^^ - | - = 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) --> $DIR/cast_size.rs:7:5 | -7 | 1usize as f64; +7 | 1isize as i8; + | ^^^^^^^^^^^^ + | + = note: `-D clippy::cast-possible-truncation` implied by `-D warnings` + +error: casting isize to f64 causes a loss of precision on targets with 64-bit wide pointers (isize is 64 bits wide, but f64's mantissa is only 52 bits wide) + --> $DIR/cast_size.rs:8:5 + | +8 | 1isize as f64; + | ^^^^^^^^^^^^^ + | + = note: `-D clippy::cast-precision-loss` implied by `-D warnings` + +error: casting usize to f64 causes a loss of precision on targets with 64-bit wide pointers (usize is 64 bits wide, but f64's mantissa is only 52 bits wide) + --> $DIR/cast_size.rs:9:5 + | +9 | 1usize as f64; | ^^^^^^^^^^^^^ error: casting isize to f32 causes a loss of precision (isize is 32 or 64 bits wide, but f32's mantissa is only 23 bits wide) - --> $DIR/cast_size.rs:8:5 - | -8 | 1isize as f32; - | ^^^^^^^^^^^^^ - -error: casting usize to f32 causes a loss of precision (usize is 32 or 64 bits wide, but f32's mantissa is only 23 bits wide) - --> $DIR/cast_size.rs:9:5 - | -9 | 1usize as f32; - | ^^^^^^^^^^^^^ - -error: casting isize to i32 may truncate the value on targets with 64-bit wide pointers --> $DIR/cast_size.rs:10:5 | -10 | 1isize as i32; +10 | 1isize as f32; + | ^^^^^^^^^^^^^ + +error: casting usize to f32 causes a loss of precision (usize is 32 or 64 bits wide, but f32's mantissa is only 23 bits wide) + --> $DIR/cast_size.rs:11:5 + | +11 | 1usize as f32; + | ^^^^^^^^^^^^^ + +error: casting isize to i32 may truncate the value on targets with 64-bit wide pointers + --> $DIR/cast_size.rs:12:5 + | +12 | 1isize as i32; | ^^^^^^^^^^^^^ error: casting isize to u32 may lose the sign of the value - --> $DIR/cast_size.rs:11:5 + --> $DIR/cast_size.rs:13:5 | -11 | 1isize as u32; +13 | 1isize as u32; | ^^^^^^^^^^^^^ | - = note: `-D cast-sign-loss` implied by `-D warnings` + = note: `-D clippy::cast-sign-loss` implied by `-D warnings` error: casting isize to u32 may truncate the value on targets with 64-bit wide pointers - --> $DIR/cast_size.rs:11:5 + --> $DIR/cast_size.rs:13:5 | -11 | 1isize as u32; +13 | 1isize as u32; | ^^^^^^^^^^^^^ error: casting usize to u32 may truncate the value on targets with 64-bit wide pointers - --> $DIR/cast_size.rs:12:5 + --> $DIR/cast_size.rs:14:5 | -12 | 1usize as u32; +14 | 1usize as u32; | ^^^^^^^^^^^^^ error: casting usize to i32 may truncate the value on targets with 64-bit wide pointers - --> $DIR/cast_size.rs:13:5 + --> $DIR/cast_size.rs:15:5 | -13 | 1usize as i32; +15 | 1usize as i32; | ^^^^^^^^^^^^^ error: casting usize to i32 may wrap around the value on targets with 32-bit wide pointers - --> $DIR/cast_size.rs:13:5 - | -13 | 1usize as i32; - | ^^^^^^^^^^^^^ - | - = 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 --> $DIR/cast_size.rs:15:5 | -15 | 1i64 as isize; +15 | 1usize as i32; + | ^^^^^^^^^^^^^ + | + = note: `-D clippy::cast-possible-wrap` implied by `-D warnings` + +error: casting i64 to isize may truncate the value on targets with 32-bit wide pointers + --> $DIR/cast_size.rs:17:5 + | +17 | 1i64 as isize; | ^^^^^^^^^^^^^ error: casting i64 to usize may lose the sign of the value - --> $DIR/cast_size.rs:16:5 + --> $DIR/cast_size.rs:18:5 | -16 | 1i64 as usize; +18 | 1i64 as usize; | ^^^^^^^^^^^^^ error: casting i64 to usize may truncate the value on targets with 32-bit wide pointers - --> $DIR/cast_size.rs:16:5 + --> $DIR/cast_size.rs:18:5 | -16 | 1i64 as usize; +18 | 1i64 as usize; | ^^^^^^^^^^^^^ error: casting u64 to isize may truncate the value on targets with 32-bit wide pointers - --> $DIR/cast_size.rs:17:5 + --> $DIR/cast_size.rs:19:5 | -17 | 1u64 as isize; +19 | 1u64 as isize; | ^^^^^^^^^^^^^ error: casting u64 to isize may wrap around the value on targets with 64-bit wide pointers - --> $DIR/cast_size.rs:17:5 + --> $DIR/cast_size.rs:19:5 | -17 | 1u64 as isize; +19 | 1u64 as isize; | ^^^^^^^^^^^^^ error: casting u64 to usize may truncate the value on targets with 32-bit wide pointers - --> $DIR/cast_size.rs:18:5 + --> $DIR/cast_size.rs:20:5 | -18 | 1u64 as usize; +20 | 1u64 as usize; | ^^^^^^^^^^^^^ error: casting u32 to isize may wrap around the value on targets with 32-bit wide pointers - --> $DIR/cast_size.rs:19:5 + --> $DIR/cast_size.rs:21:5 | -19 | 1u32 as isize; +21 | 1u32 as isize; | ^^^^^^^^^^^^^ error: casting i32 to usize may lose the sign of the value - --> $DIR/cast_size.rs:22:5 + --> $DIR/cast_size.rs:24:5 | -22 | 1i32 as usize; +24 | 1i32 as usize; | ^^^^^^^^^^^^^ error: aborting due to 19 previous errors diff --git a/tests/ui/char_lit_as_u8.stderr b/tests/ui/char_lit_as_u8.stderr index fcf038fe0..f6ea10d57 100644 --- a/tests/ui/char_lit_as_u8.stderr +++ b/tests/ui/char_lit_as_u8.stderr @@ -4,7 +4,7 @@ error: casting character literal to u8. `char`s are 4 bytes wide in rust, so cas 7 | let c = 'a' as u8; | ^^^^^^^^^ | - = note: `-D char-lit-as-u8` implied by `-D warnings` + = note: `-D clippy::char-lit-as-u8` implied by `-D warnings` = help: Consider using a byte literal instead: b'a' diff --git a/tests/ui/checked_unwrap.stderr b/tests/ui/checked_unwrap.stderr index 1b46ceb5f..4508ce442 100644 --- a/tests/ui/checked_unwrap.stderr +++ b/tests/ui/checked_unwrap.stderr @@ -1,313 +1,313 @@ error: You checked before that `unwrap()` cannot fail. Instead of checking and unwrapping, it's better to use `if let` or `match`. - --> $DIR/checked_unwrap.rs:7:9 - | -6 | if x.is_some() { - | ----------- the check is happening here -7 | x.unwrap(); // unnecessary - | ^^^^^^^^^^ - | -note: lint level defined here - --> $DIR/checked_unwrap.rs:1:27 - | -1 | #![deny(panicking_unwrap, unnecessary_unwrap)] - | ^^^^^^^^^^^^^^^^^^ - -error: This call to `unwrap()` will always panic. --> $DIR/checked_unwrap.rs:9:9 | -6 | if x.is_some() { - | ----------- because of this check -... -9 | x.unwrap(); // will panic +8 | if x.is_some() { + | ----------- the check is happening here +9 | x.unwrap(); // unnecessary | ^^^^^^^^^^ | note: lint level defined here - --> $DIR/checked_unwrap.rs:1:9 + --> $DIR/checked_unwrap.rs:3:35 | -1 | #![deny(panicking_unwrap, unnecessary_unwrap)] - | ^^^^^^^^^^^^^^^^ +3 | #![deny(clippy::panicking_unwrap, clippy::unnecessary_unwrap)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ error: This call to `unwrap()` will always panic. - --> $DIR/checked_unwrap.rs:12:9 + --> $DIR/checked_unwrap.rs:11:9 | -11 | if x.is_none() { +8 | if x.is_some() { | ----------- because of this check -12 | x.unwrap(); // will panic +... +11 | x.unwrap(); // will panic | ^^^^^^^^^^ + | +note: lint level defined here + --> $DIR/checked_unwrap.rs:3:9 + | +3 | #![deny(clippy::panicking_unwrap, clippy::unnecessary_unwrap)] + | ^^^^^^^^^^^^^^^^^^^^^^^^ -error: You checked before that `unwrap()` cannot fail. Instead of checking and unwrapping, it's better to use `if let` or `match`. +error: This call to `unwrap()` will always panic. --> $DIR/checked_unwrap.rs:14:9 | -11 | if x.is_none() { +13 | if x.is_none() { + | ----------- because of this check +14 | x.unwrap(); // will panic + | ^^^^^^^^^^ + +error: You checked before that `unwrap()` cannot fail. Instead of checking and unwrapping, it's better to use `if let` or `match`. + --> $DIR/checked_unwrap.rs:16:9 + | +13 | if x.is_none() { | ----------- the check is happening here ... -14 | x.unwrap(); // unnecessary +16 | x.unwrap(); // unnecessary | ^^^^^^^^^^ error: You checked before that `unwrap()` cannot fail. Instead of checking and unwrapping, it's better to use `if let` or `match`. - --> $DIR/checked_unwrap.rs:18:9 + --> $DIR/checked_unwrap.rs:20:9 | -17 | if x.is_ok() { +19 | if x.is_ok() { | --------- the check is happening here -18 | x.unwrap(); // unnecessary +20 | x.unwrap(); // unnecessary | ^^^^^^^^^^ error: This call to `unwrap_err()` will always panic. - --> $DIR/checked_unwrap.rs:19:9 - | -17 | if x.is_ok() { - | --------- because of this check -18 | x.unwrap(); // unnecessary -19 | x.unwrap_err(); // will panic - | ^^^^^^^^^^^^^^ - -error: This call to `unwrap()` will always panic. --> $DIR/checked_unwrap.rs:21:9 | -17 | if x.is_ok() { +19 | if x.is_ok() { | --------- because of this check -... -21 | x.unwrap(); // will panic - | ^^^^^^^^^^ - -error: You checked before that `unwrap_err()` cannot fail. Instead of checking and unwrapping, it's better to use `if let` or `match`. - --> $DIR/checked_unwrap.rs:22:9 - | -17 | if x.is_ok() { - | --------- the check is happening here -... -22 | x.unwrap_err(); // unnecessary +20 | x.unwrap(); // unnecessary +21 | x.unwrap_err(); // will panic | ^^^^^^^^^^^^^^ error: This call to `unwrap()` will always panic. - --> $DIR/checked_unwrap.rs:25:9 + --> $DIR/checked_unwrap.rs:23:9 | -24 | if x.is_err() { - | ---------- because of this check -25 | x.unwrap(); // will panic +19 | if x.is_ok() { + | --------- because of this check +... +23 | x.unwrap(); // will panic | ^^^^^^^^^^ error: You checked before that `unwrap_err()` cannot fail. Instead of checking and unwrapping, it's better to use `if let` or `match`. - --> $DIR/checked_unwrap.rs:26:9 + --> $DIR/checked_unwrap.rs:24:9 | -24 | if x.is_err() { - | ---------- the check is happening here -25 | x.unwrap(); // will panic -26 | x.unwrap_err(); // unnecessary +19 | if x.is_ok() { + | --------- the check is happening here +... +24 | x.unwrap_err(); // unnecessary | ^^^^^^^^^^^^^^ -error: You checked before that `unwrap()` cannot fail. Instead of checking and unwrapping, it's better to use `if let` or `match`. +error: This call to `unwrap()` will always panic. + --> $DIR/checked_unwrap.rs:27:9 + | +26 | if x.is_err() { + | ---------- because of this check +27 | x.unwrap(); // will panic + | ^^^^^^^^^^ + +error: You checked before that `unwrap_err()` cannot fail. Instead of checking and unwrapping, it's better to use `if let` or `match`. --> $DIR/checked_unwrap.rs:28:9 | -24 | if x.is_err() { +26 | if x.is_err() { | ---------- the check is happening here -... -28 | x.unwrap(); // unnecessary - | ^^^^^^^^^^ - -error: This call to `unwrap_err()` will always panic. - --> $DIR/checked_unwrap.rs:29:9 - | -24 | if x.is_err() { - | ---------- because of this check -... -29 | x.unwrap_err(); // will panic +27 | x.unwrap(); // will panic +28 | x.unwrap_err(); // unnecessary | ^^^^^^^^^^^^^^ error: You checked before that `unwrap()` cannot fail. Instead of checking and unwrapping, it's better to use `if let` or `match`. - --> $DIR/checked_unwrap.rs:46:9 + --> $DIR/checked_unwrap.rs:30:9 | -45 | if x.is_ok() && y.is_err() { - | --------- the check is happening here -46 | x.unwrap(); // unnecessary +26 | if x.is_err() { + | ---------- the check is happening here +... +30 | x.unwrap(); // unnecessary | ^^^^^^^^^^ error: This call to `unwrap_err()` will always panic. - --> $DIR/checked_unwrap.rs:47:9 + --> $DIR/checked_unwrap.rs:31:9 | -45 | if x.is_ok() && y.is_err() { - | --------- because of this check -46 | x.unwrap(); // unnecessary -47 | x.unwrap_err(); // will panic +26 | if x.is_err() { + | ---------- because of this check +... +31 | x.unwrap_err(); // will panic | ^^^^^^^^^^^^^^ -error: This call to `unwrap()` will always panic. +error: You checked before that `unwrap()` cannot fail. Instead of checking and unwrapping, it's better to use `if let` or `match`. --> $DIR/checked_unwrap.rs:48:9 | -45 | if x.is_ok() && y.is_err() { - | ---------- because of this check -... -48 | y.unwrap(); // will panic +47 | if x.is_ok() && y.is_err() { + | --------- the check is happening here +48 | x.unwrap(); // unnecessary | ^^^^^^^^^^ -error: You checked before that `unwrap_err()` cannot fail. Instead of checking and unwrapping, it's better to use `if let` or `match`. +error: This call to `unwrap_err()` will always panic. --> $DIR/checked_unwrap.rs:49:9 | -45 | if x.is_ok() && y.is_err() { - | ---------- the check is happening here -... -49 | y.unwrap_err(); // unnecessary +47 | if x.is_ok() && y.is_err() { + | --------- because of this check +48 | x.unwrap(); // unnecessary +49 | x.unwrap_err(); // will panic | ^^^^^^^^^^^^^^ error: This call to `unwrap()` will always panic. - --> $DIR/checked_unwrap.rs:63:9 + --> $DIR/checked_unwrap.rs:50:9 | -58 | if x.is_ok() || y.is_ok() { - | --------- because of this check +47 | if x.is_ok() && y.is_err() { + | ---------- because of this check ... -63 | x.unwrap(); // will panic +50 | y.unwrap(); // will panic | ^^^^^^^^^^ error: You checked before that `unwrap_err()` cannot fail. Instead of checking and unwrapping, it's better to use `if let` or `match`. - --> $DIR/checked_unwrap.rs:64:9 + --> $DIR/checked_unwrap.rs:51:9 | -58 | if x.is_ok() || y.is_ok() { - | --------- the check is happening here +47 | if x.is_ok() && y.is_err() { + | ---------- the check is happening here ... -64 | x.unwrap_err(); // unnecessary +51 | y.unwrap_err(); // unnecessary | ^^^^^^^^^^^^^^ error: This call to `unwrap()` will always panic. --> $DIR/checked_unwrap.rs:65:9 | -58 | if x.is_ok() || y.is_ok() { - | --------- because of this check +60 | if x.is_ok() || y.is_ok() { + | --------- because of this check ... -65 | y.unwrap(); // will panic +65 | x.unwrap(); // will panic | ^^^^^^^^^^ error: You checked before that `unwrap_err()` cannot fail. Instead of checking and unwrapping, it's better to use `if let` or `match`. --> $DIR/checked_unwrap.rs:66:9 | -58 | if x.is_ok() || y.is_ok() { +60 | if x.is_ok() || y.is_ok() { + | --------- the check is happening here +... +66 | x.unwrap_err(); // unnecessary + | ^^^^^^^^^^^^^^ + +error: This call to `unwrap()` will always panic. + --> $DIR/checked_unwrap.rs:67:9 + | +60 | if x.is_ok() || y.is_ok() { + | --------- because of this check +... +67 | y.unwrap(); // will panic + | ^^^^^^^^^^ + +error: You checked before that `unwrap_err()` cannot fail. Instead of checking and unwrapping, it's better to use `if let` or `match`. + --> $DIR/checked_unwrap.rs:68:9 + | +60 | if x.is_ok() || y.is_ok() { | --------- the check is happening here ... -66 | y.unwrap_err(); // unnecessary +68 | y.unwrap_err(); // unnecessary | ^^^^^^^^^^^^^^ error: You checked before that `unwrap()` cannot fail. Instead of checking and unwrapping, it's better to use `if let` or `match`. - --> $DIR/checked_unwrap.rs:70:9 - | -69 | if x.is_ok() && !(y.is_ok() || z.is_err()) { - | --------- the check is happening here -70 | x.unwrap(); // unnecessary - | ^^^^^^^^^^ - -error: This call to `unwrap_err()` will always panic. - --> $DIR/checked_unwrap.rs:71:9 - | -69 | if x.is_ok() && !(y.is_ok() || z.is_err()) { - | --------- because of this check -70 | x.unwrap(); // unnecessary -71 | x.unwrap_err(); // will panic - | ^^^^^^^^^^^^^^ - -error: This call to `unwrap()` will always panic. --> $DIR/checked_unwrap.rs:72:9 | -69 | if x.is_ok() && !(y.is_ok() || z.is_err()) { - | --------- because of this check -... -72 | y.unwrap(); // will panic +71 | if x.is_ok() && !(y.is_ok() || z.is_err()) { + | --------- the check is happening here +72 | x.unwrap(); // unnecessary | ^^^^^^^^^^ -error: You checked before that `unwrap_err()` cannot fail. Instead of checking and unwrapping, it's better to use `if let` or `match`. +error: This call to `unwrap_err()` will always panic. --> $DIR/checked_unwrap.rs:73:9 | -69 | if x.is_ok() && !(y.is_ok() || z.is_err()) { - | --------- the check is happening here -... -73 | y.unwrap_err(); // unnecessary +71 | if x.is_ok() && !(y.is_ok() || z.is_err()) { + | --------- because of this check +72 | x.unwrap(); // unnecessary +73 | x.unwrap_err(); // will panic | ^^^^^^^^^^^^^^ -error: You checked before that `unwrap()` cannot fail. Instead of checking and unwrapping, it's better to use `if let` or `match`. +error: This call to `unwrap()` will always panic. --> $DIR/checked_unwrap.rs:74:9 | -69 | if x.is_ok() && !(y.is_ok() || z.is_err()) { - | ---------- the check is happening here -... -74 | z.unwrap(); // unnecessary - | ^^^^^^^^^^ - -error: This call to `unwrap_err()` will always panic. - --> $DIR/checked_unwrap.rs:75:9 - | -69 | if x.is_ok() && !(y.is_ok() || z.is_err()) { - | ---------- because of this check -... -75 | z.unwrap_err(); // will panic - | ^^^^^^^^^^^^^^ - -error: This call to `unwrap()` will always panic. - --> $DIR/checked_unwrap.rs:83:9 - | -77 | if x.is_ok() || !(y.is_ok() && z.is_err()) { - | --------- because of this check -... -83 | x.unwrap(); // will panic - | ^^^^^^^^^^ - -error: You checked before that `unwrap_err()` cannot fail. Instead of checking and unwrapping, it's better to use `if let` or `match`. - --> $DIR/checked_unwrap.rs:84:9 - | -77 | if x.is_ok() || !(y.is_ok() && z.is_err()) { - | --------- the check is happening here -... -84 | x.unwrap_err(); // unnecessary - | ^^^^^^^^^^^^^^ - -error: You checked before that `unwrap()` cannot fail. Instead of checking and unwrapping, it's better to use `if let` or `match`. - --> $DIR/checked_unwrap.rs:85:9 - | -77 | if x.is_ok() || !(y.is_ok() && z.is_err()) { - | --------- the check is happening here -... -85 | y.unwrap(); // unnecessary - | ^^^^^^^^^^ - -error: This call to `unwrap_err()` will always panic. - --> $DIR/checked_unwrap.rs:86:9 - | -77 | if x.is_ok() || !(y.is_ok() && z.is_err()) { +71 | if x.is_ok() && !(y.is_ok() || z.is_err()) { | --------- because of this check ... -86 | y.unwrap_err(); // will panic - | ^^^^^^^^^^^^^^ - -error: This call to `unwrap()` will always panic. - --> $DIR/checked_unwrap.rs:87:9 - | -77 | if x.is_ok() || !(y.is_ok() && z.is_err()) { - | ---------- because of this check -... -87 | z.unwrap(); // will panic +74 | y.unwrap(); // will panic | ^^^^^^^^^^ error: You checked before that `unwrap_err()` cannot fail. Instead of checking and unwrapping, it's better to use `if let` or `match`. - --> $DIR/checked_unwrap.rs:88:9 + --> $DIR/checked_unwrap.rs:75:9 | -77 | if x.is_ok() || !(y.is_ok() && z.is_err()) { - | ---------- the check is happening here +71 | if x.is_ok() && !(y.is_ok() || z.is_err()) { + | --------- the check is happening here ... -88 | z.unwrap_err(); // unnecessary +75 | y.unwrap_err(); // unnecessary | ^^^^^^^^^^^^^^ error: You checked before that `unwrap()` cannot fail. Instead of checking and unwrapping, it's better to use `if let` or `match`. - --> $DIR/checked_unwrap.rs:96:13 + --> $DIR/checked_unwrap.rs:76:9 | -95 | if x.is_some() { +71 | if x.is_ok() && !(y.is_ok() || z.is_err()) { + | ---------- the check is happening here +... +76 | z.unwrap(); // unnecessary + | ^^^^^^^^^^ + +error: This call to `unwrap_err()` will always panic. + --> $DIR/checked_unwrap.rs:77:9 + | +71 | if x.is_ok() && !(y.is_ok() || z.is_err()) { + | ---------- because of this check +... +77 | z.unwrap_err(); // will panic + | ^^^^^^^^^^^^^^ + +error: This call to `unwrap()` will always panic. + --> $DIR/checked_unwrap.rs:85:9 + | +79 | if x.is_ok() || !(y.is_ok() && z.is_err()) { + | --------- because of this check +... +85 | x.unwrap(); // will panic + | ^^^^^^^^^^ + +error: You checked before that `unwrap_err()` cannot fail. Instead of checking and unwrapping, it's better to use `if let` or `match`. + --> $DIR/checked_unwrap.rs:86:9 + | +79 | if x.is_ok() || !(y.is_ok() && z.is_err()) { + | --------- the check is happening here +... +86 | x.unwrap_err(); // unnecessary + | ^^^^^^^^^^^^^^ + +error: You checked before that `unwrap()` cannot fail. Instead of checking and unwrapping, it's better to use `if let` or `match`. + --> $DIR/checked_unwrap.rs:87:9 + | +79 | if x.is_ok() || !(y.is_ok() && z.is_err()) { + | --------- the check is happening here +... +87 | y.unwrap(); // unnecessary + | ^^^^^^^^^^ + +error: This call to `unwrap_err()` will always panic. + --> $DIR/checked_unwrap.rs:88:9 + | +79 | if x.is_ok() || !(y.is_ok() && z.is_err()) { + | --------- because of this check +... +88 | y.unwrap_err(); // will panic + | ^^^^^^^^^^^^^^ + +error: This call to `unwrap()` will always panic. + --> $DIR/checked_unwrap.rs:89:9 + | +79 | if x.is_ok() || !(y.is_ok() && z.is_err()) { + | ---------- because of this check +... +89 | z.unwrap(); // will panic + | ^^^^^^^^^^ + +error: You checked before that `unwrap_err()` cannot fail. Instead of checking and unwrapping, it's better to use `if let` or `match`. + --> $DIR/checked_unwrap.rs:90:9 + | +79 | if x.is_ok() || !(y.is_ok() && z.is_err()) { + | ---------- the check is happening here +... +90 | z.unwrap_err(); // unnecessary + | ^^^^^^^^^^^^^^ + +error: You checked before that `unwrap()` cannot fail. Instead of checking and unwrapping, it's better to use `if let` or `match`. + --> $DIR/checked_unwrap.rs:98:13 + | +97 | if x.is_some() { | ----------- the check is happening here -96 | x.unwrap(); // unnecessary +98 | x.unwrap(); // unnecessary | ^^^^^^^^^^ error: This call to `unwrap()` will always panic. - --> $DIR/checked_unwrap.rs:98:13 - | -95 | if x.is_some() { - | ----------- because of this check + --> $DIR/checked_unwrap.rs:100:13 + | +97 | if x.is_some() { + | ----------- because of this check ... -98 | x.unwrap(); // will panic - | ^^^^^^^^^^ +100 | x.unwrap(); // will panic + | ^^^^^^^^^^ error: aborting due to 34 previous errors diff --git a/tests/ui/cmp_nan.stderr b/tests/ui/cmp_nan.stderr index 46f3d3d57..7f636e6b5 100644 --- a/tests/ui/cmp_nan.stderr +++ b/tests/ui/cmp_nan.stderr @@ -4,7 +4,7 @@ error: doomed comparison with NAN, use `std::{f32,f64}::is_nan()` instead 8 | x == std::f32::NAN; | ^^^^^^^^^^^^^^^^^^ | - = note: `-D cmp-nan` implied by `-D warnings` + = note: `-D clippy::cmp-nan` implied by `-D warnings` error: doomed comparison with NAN, use `std::{f32,f64}::is_nan()` instead --> $DIR/cmp_nan.rs:9:5 diff --git a/tests/ui/cmp_null.stderr b/tests/ui/cmp_null.stderr index 481a4d0f9..55050d2a3 100644 --- a/tests/ui/cmp_null.stderr +++ b/tests/ui/cmp_null.stderr @@ -4,7 +4,7 @@ error: Comparing with null is better expressed by the .is_null() method 11 | if p == ptr::null() { | ^^^^^^^^^^^^^^^^ | - = note: `-D cmp-null` implied by `-D warnings` + = note: `-D clippy::cmp-null` implied by `-D warnings` error: Comparing with null is better expressed by the .is_null() method --> $DIR/cmp_null.rs:16:8 diff --git a/tests/ui/cmp_owned.stderr b/tests/ui/cmp_owned.stderr index d40fb4b8a..2691c12ea 100644 --- a/tests/ui/cmp_owned.stderr +++ b/tests/ui/cmp_owned.stderr @@ -4,7 +4,7 @@ error: this creates an owned instance just for comparison 8 | x != "foo".to_string(); | ^^^^^^^^^^^^^^^^^ help: try: `"foo"` | - = note: `-D cmp-owned` implied by `-D warnings` + = note: `-D clippy::cmp-owned` implied by `-D warnings` error: this creates an owned instance just for comparison --> $DIR/cmp_owned.rs:10:9 diff --git a/tests/ui/collapsible_if.stderr b/tests/ui/collapsible_if.stderr index 69f2013c1..a447fab7b 100644 --- a/tests/ui/collapsible_if.stderr +++ b/tests/ui/collapsible_if.stderr @@ -8,7 +8,7 @@ error: this if statement can be collapsed 12 | | } | |_____^ | - = note: `-D collapsible-if` implied by `-D warnings` + = note: `-D clippy::collapsible-if` implied by `-D warnings` help: try | 8 | if x == "hello" && y == "world" { diff --git a/tests/ui/complex_types.stderr b/tests/ui/complex_types.stderr index 829a22c23..1c9106c0c 100644 --- a/tests/ui/complex_types.stderr +++ b/tests/ui/complex_types.stderr @@ -4,7 +4,7 @@ error: very complex type used. Consider factoring parts into `type` definitions 9 | const CST: (u32, (u32, (u32, (u32, u32)))) = (0, (0, (0, (0, 0)))); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: `-D type-complexity` implied by `-D warnings` + = note: `-D clippy::type-complexity` implied by `-D warnings` error: very complex type used. Consider factoring parts into `type` definitions --> $DIR/complex_types.rs:10:12 diff --git a/tests/ui/const_static_lifetime.stderr b/tests/ui/const_static_lifetime.stderr index db33744c7..db6c4d944 100644 --- a/tests/ui/const_static_lifetime.stderr +++ b/tests/ui/const_static_lifetime.stderr @@ -4,7 +4,7 @@ error: Constants have by default a `'static` lifetime 4 | const VAR_ONE: &'static str = "Test constant #1"; // ERROR Consider removing 'static. | -^^^^^^^---- help: consider removing `'static`: `&str` | - = note: `-D const-static-lifetime` implied by `-D warnings` + = note: `-D clippy::const-static-lifetime` implied by `-D warnings` error: Constants have by default a `'static` lifetime --> $DIR/const_static_lifetime.rs:8:21 diff --git a/tests/ui/copies.stderr b/tests/ui/copies.stderr index cce63280c..febd34603 100644 --- a/tests/ui/copies.stderr +++ b/tests/ui/copies.stderr @@ -1,384 +1,384 @@ error: this `if` has identical blocks - --> $DIR/copies.rs:29:10 + --> $DIR/copies.rs:31:10 | -29 | else { //~ ERROR same body as `if` block +31 | else { //~ ERROR same body as `if` block | __________^ -30 | | Foo { bar: 42 }; -31 | | 0..10; -32 | | ..; +32 | | Foo { bar: 42 }; +33 | | 0..10; +34 | | ..; ... | -36 | | foo(); -37 | | } +38 | | foo(); +39 | | } | |_____^ | - = note: `-D if-same-then-else` implied by `-D warnings` + = note: `-D clippy::if-same-then-else` implied by `-D warnings` note: same as this - --> $DIR/copies.rs:20:13 + --> $DIR/copies.rs:22:13 | -20 | if true { +22 | if true { | _____________^ -21 | | Foo { bar: 42 }; -22 | | 0..10; -23 | | ..; +23 | | Foo { bar: 42 }; +24 | | 0..10; +25 | | ..; ... | -27 | | foo(); -28 | | } +29 | | foo(); +30 | | } | |_____^ error: this `match` has identical arm bodies - --> $DIR/copies.rs:78:14 + --> $DIR/copies.rs:80:14 | -78 | _ => { //~ ERROR match arms have same body +80 | _ => { //~ ERROR match arms have same body | ______________^ -79 | | foo(); -80 | | let mut a = 42 + [23].len() as i32; -81 | | if true { +81 | | foo(); +82 | | let mut a = 42 + [23].len() as i32; +83 | | if true { ... | -85 | | a -86 | | } +87 | | a +88 | | } | |_________^ | - = note: `-D match-same-arms` implied by `-D warnings` + = note: `-D clippy::match-same-arms` implied by `-D warnings` note: same as this - --> $DIR/copies.rs:69:15 + --> $DIR/copies.rs:71:15 | -69 | 42 => { +71 | 42 => { | _______________^ -70 | | foo(); -71 | | let mut a = 42 + [23].len() as i32; -72 | | if true { +72 | | foo(); +73 | | let mut a = 42 + [23].len() as i32; +74 | | if true { ... | -76 | | a -77 | | } +78 | | a +79 | | } | |_________^ note: `42` has the same arm body as the `_` wildcard, consider removing it` - --> $DIR/copies.rs:69:15 + --> $DIR/copies.rs:71:15 | -69 | 42 => { +71 | 42 => { | _______________^ -70 | | foo(); -71 | | let mut a = 42 + [23].len() as i32; -72 | | if true { +72 | | foo(); +73 | | let mut a = 42 + [23].len() as i32; +74 | | if true { ... | -76 | | a -77 | | } +78 | | a +79 | | } | |_________^ error: this `match` has identical arm bodies - --> $DIR/copies.rs:92:14 + --> $DIR/copies.rs:94:14 | -92 | _ => 0, //~ ERROR match arms have same body +94 | _ => 0, //~ ERROR match arms have same body | ^ | note: same as this - --> $DIR/copies.rs:90:19 + --> $DIR/copies.rs:92:19 | -90 | Abc::A => 0, +92 | Abc::A => 0, | ^ note: `Abc::A` has the same arm body as the `_` wildcard, consider removing it` - --> $DIR/copies.rs:90:19 + --> $DIR/copies.rs:92:19 | -90 | Abc::A => 0, +92 | Abc::A => 0, | ^ error: this `if` has identical blocks - --> $DIR/copies.rs:102:10 + --> $DIR/copies.rs:104:10 | -102 | else { //~ ERROR same body as `if` block +104 | else { //~ ERROR same body as `if` block | __________^ -103 | | 42 -104 | | }; +105 | | 42 +106 | | }; | |_____^ | note: same as this - --> $DIR/copies.rs:99:21 + --> $DIR/copies.rs:101:21 | -99 | let _ = if true { +101 | let _ = if true { | _____________________^ -100 | | 42 -101 | | } +102 | | 42 +103 | | } | |_____^ error: this `if` has identical blocks - --> $DIR/copies.rs:116:10 + --> $DIR/copies.rs:118:10 | -116 | else { //~ ERROR same body as `if` block +118 | else { //~ ERROR same body as `if` block | __________^ -117 | | for _ in &[42] { -118 | | let foo: &Option<_> = &Some::(42); -119 | | if true { +119 | | for _ in &[42] { +120 | | let foo: &Option<_> = &Some::(42); +121 | | if true { ... | -124 | | } -125 | | } +126 | | } +127 | | } | |_____^ | note: same as this - --> $DIR/copies.rs:106:13 + --> $DIR/copies.rs:108:13 | -106 | if true { +108 | if true { | _____________^ -107 | | for _ in &[42] { -108 | | let foo: &Option<_> = &Some::(42); -109 | | if true { +109 | | for _ in &[42] { +110 | | let foo: &Option<_> = &Some::(42); +111 | | if true { ... | -114 | | } -115 | | } +116 | | } +117 | | } | |_____^ error: this `if` has identical blocks - --> $DIR/copies.rs:138:10 + --> $DIR/copies.rs:140:10 | -138 | else { //~ ERROR same body as `if` block +140 | else { //~ ERROR same body as `if` block | __________^ -139 | | let bar = if true { -140 | | 42 -141 | | } +141 | | let bar = if true { +142 | | 42 +143 | | } ... | -147 | | bar + 1; -148 | | } +149 | | bar + 1; +150 | | } | |_____^ | note: same as this - --> $DIR/copies.rs:127:13 + --> $DIR/copies.rs:129:13 | -127 | if true { +129 | if true { | _____________^ -128 | | let bar = if true { -129 | | 42 -130 | | } +130 | | let bar = if true { +131 | | 42 +132 | | } ... | -136 | | bar + 1; -137 | | } +138 | | bar + 1; +139 | | } | |_____^ error: this `if` has identical blocks - --> $DIR/copies.rs:173:10 + --> $DIR/copies.rs:175:10 | -173 | else { //~ ERROR same body as `if` block +175 | else { //~ ERROR same body as `if` block | __________^ -174 | | if let Some(a) = Some(42) {} -175 | | } +176 | | if let Some(a) = Some(42) {} +177 | | } | |_____^ | note: same as this - --> $DIR/copies.rs:170:13 + --> $DIR/copies.rs:172:13 | -170 | if true { +172 | if true { | _____________^ -171 | | if let Some(a) = Some(42) {} -172 | | } +173 | | if let Some(a) = Some(42) {} +174 | | } | |_____^ error: this `if` has identical blocks - --> $DIR/copies.rs:180:10 + --> $DIR/copies.rs:182:10 | -180 | else { //~ ERROR same body as `if` block +182 | else { //~ ERROR same body as `if` block | __________^ -181 | | if let (1, .., 3) = (1, 2, 3) {} -182 | | } +183 | | if let (1, .., 3) = (1, 2, 3) {} +184 | | } | |_____^ | note: same as this - --> $DIR/copies.rs:177:13 + --> $DIR/copies.rs:179:13 | -177 | if true { +179 | if true { | _____________^ -178 | | if let (1, .., 3) = (1, 2, 3) {} -179 | | } +180 | | if let (1, .., 3) = (1, 2, 3) {} +181 | | } | |_____^ error: this `match` has identical arm bodies - --> $DIR/copies.rs:235:15 + --> $DIR/copies.rs:237:15 | -235 | 51 => foo(), //~ ERROR match arms have same body +237 | 51 => foo(), //~ ERROR match arms have same body | ^^^^^ | note: same as this - --> $DIR/copies.rs:234:15 + --> $DIR/copies.rs:236:15 | -234 | 42 => foo(), +236 | 42 => foo(), | ^^^^^ note: consider refactoring into `42 | 51` - --> $DIR/copies.rs:234:15 + --> $DIR/copies.rs:236:15 | -234 | 42 => foo(), +236 | 42 => foo(), | ^^^^^ error: this `match` has identical arm bodies - --> $DIR/copies.rs:241:17 + --> $DIR/copies.rs:243:17 | -241 | None => 24, //~ ERROR match arms have same body +243 | None => 24, //~ ERROR match arms have same body | ^^ | note: same as this - --> $DIR/copies.rs:240:20 + --> $DIR/copies.rs:242:20 | -240 | Some(_) => 24, +242 | Some(_) => 24, | ^^ note: consider refactoring into `Some(_) | None` - --> $DIR/copies.rs:240:20 + --> $DIR/copies.rs:242:20 | -240 | Some(_) => 24, +242 | Some(_) => 24, | ^^ error: this `match` has identical arm bodies - --> $DIR/copies.rs:263:28 + --> $DIR/copies.rs:265:28 | -263 | (None, Some(a)) => bar(a), //~ ERROR match arms have same body +265 | (None, Some(a)) => bar(a), //~ ERROR match arms have same body | ^^^^^^ | note: same as this - --> $DIR/copies.rs:262:28 + --> $DIR/copies.rs:264:28 | -262 | (Some(a), None) => bar(a), +264 | (Some(a), None) => bar(a), | ^^^^^^ note: consider refactoring into `(Some(a), None) | (None, Some(a))` - --> $DIR/copies.rs:262:28 + --> $DIR/copies.rs:264:28 | -262 | (Some(a), None) => bar(a), +264 | (Some(a), None) => bar(a), | ^^^^^^ error: this `match` has identical arm bodies - --> $DIR/copies.rs:269:26 + --> $DIR/copies.rs:271:26 | -269 | (.., Some(a)) => bar(a), //~ ERROR match arms have same body +271 | (.., Some(a)) => bar(a), //~ ERROR match arms have same body | ^^^^^^ | note: same as this - --> $DIR/copies.rs:268:26 + --> $DIR/copies.rs:270:26 | -268 | (Some(a), ..) => bar(a), +270 | (Some(a), ..) => bar(a), | ^^^^^^ note: consider refactoring into `(Some(a), ..) | (.., Some(a))` - --> $DIR/copies.rs:268:26 + --> $DIR/copies.rs:270:26 | -268 | (Some(a), ..) => bar(a), +270 | (Some(a), ..) => bar(a), | ^^^^^^ error: this `match` has identical arm bodies - --> $DIR/copies.rs:275:20 + --> $DIR/copies.rs:277:20 | -275 | (.., 3) => 42, //~ ERROR match arms have same body +277 | (.., 3) => 42, //~ ERROR match arms have same body | ^^ | note: same as this - --> $DIR/copies.rs:274:23 + --> $DIR/copies.rs:276:23 | -274 | (1, .., 3) => 42, +276 | (1, .., 3) => 42, | ^^ note: consider refactoring into `(1, .., 3) | (.., 3)` - --> $DIR/copies.rs:274:23 + --> $DIR/copies.rs:276:23 | -274 | (1, .., 3) => 42, +276 | (1, .., 3) => 42, | ^^ error: this `if` has identical blocks - --> $DIR/copies.rs:281:12 + --> $DIR/copies.rs:283:12 | -281 | } else { //~ ERROR same body as `if` block +283 | } else { //~ ERROR same body as `if` block | ____________^ +284 | | 0.0 +285 | | }; + | |_____^ + | +note: same as this + --> $DIR/copies.rs:281:21 + | +281 | let _ = if true { + | _____________________^ 282 | | 0.0 -283 | | }; - | |_____^ - | -note: same as this - --> $DIR/copies.rs:279:21 - | -279 | let _ = if true { - | _____________________^ -280 | | 0.0 -281 | | } else { //~ ERROR same body as `if` block +283 | | } else { //~ ERROR same body as `if` block | |_____^ error: this `if` has identical blocks - --> $DIR/copies.rs:287:12 + --> $DIR/copies.rs:289:12 | -287 | } else { //~ ERROR same body as `if` block +289 | } else { //~ ERROR same body as `if` block | ____________^ +290 | | -0.0 +291 | | }; + | |_____^ + | +note: same as this + --> $DIR/copies.rs:287:21 + | +287 | let _ = if true { + | _____________________^ 288 | | -0.0 -289 | | }; - | |_____^ - | -note: same as this - --> $DIR/copies.rs:285:21 - | -285 | let _ = if true { - | _____________________^ -286 | | -0.0 -287 | | } else { //~ ERROR same body as `if` block +289 | | } else { //~ ERROR same body as `if` block | |_____^ error: this `if` has identical blocks - --> $DIR/copies.rs:307:12 + --> $DIR/copies.rs:309:12 | -307 | } else { //~ ERROR same body as `if` block +309 | } else { //~ ERROR same body as `if` block | ____________^ -308 | | std::f32::NAN -309 | | }; +310 | | std::f32::NAN +311 | | }; | |_____^ | note: same as this - --> $DIR/copies.rs:305:21 + --> $DIR/copies.rs:307:21 | -305 | let _ = if true { +307 | let _ = if true { | _____________________^ -306 | | std::f32::NAN -307 | | } else { //~ ERROR same body as `if` block +308 | | std::f32::NAN +309 | | } else { //~ ERROR same body as `if` block | |_____^ error: this `if` has identical blocks - --> $DIR/copies.rs:325:10 + --> $DIR/copies.rs:327:10 | -325 | else { //~ ERROR same body as `if` block +327 | else { //~ ERROR same body as `if` block | __________^ -326 | | try!(Ok("foo")); -327 | | } +328 | | try!(Ok("foo")); +329 | | } | |_____^ | note: same as this - --> $DIR/copies.rs:322:13 + --> $DIR/copies.rs:324:13 | -322 | if true { +324 | if true { | _____________^ -323 | | try!(Ok("foo")); -324 | | } +325 | | try!(Ok("foo")); +326 | | } | |_____^ error: this `if` has the same condition as a previous if - --> $DIR/copies.rs:351:13 + --> $DIR/copies.rs:353:13 | -351 | else if b { //~ ERROR ifs same condition +353 | else if b { //~ ERROR ifs same condition | ^ | - = note: `-D ifs-same-cond` implied by `-D warnings` + = note: `-D clippy::ifs-same-cond` implied by `-D warnings` note: same as this - --> $DIR/copies.rs:349:8 + --> $DIR/copies.rs:351:8 | -349 | if b { +351 | if b { | ^ error: this `if` has the same condition as a previous if - --> $DIR/copies.rs:356:13 + --> $DIR/copies.rs:358:13 | -356 | else if a == 1 { //~ ERROR ifs same condition +358 | else if a == 1 { //~ ERROR ifs same condition | ^^^^^^ | note: same as this - --> $DIR/copies.rs:354:8 + --> $DIR/copies.rs:356:8 | -354 | if a == 1 { +356 | if a == 1 { | ^^^^^^ error: this `if` has the same condition as a previous if - --> $DIR/copies.rs:363:13 + --> $DIR/copies.rs:365:13 | -363 | else if 2*a == 1 { //~ ERROR ifs same condition +365 | else if 2*a == 1 { //~ ERROR ifs same condition | ^^^^^^^^ | note: same as this - --> $DIR/copies.rs:359:8 + --> $DIR/copies.rs:361:8 | -359 | if 2*a == 1 { +361 | if 2*a == 1 { | ^^^^^^^^ error: aborting due to 20 previous errors diff --git a/tests/ui/copy_iterator.stderr b/tests/ui/copy_iterator.stderr index f520156b0..9a06a52d4 100644 --- a/tests/ui/copy_iterator.stderr +++ b/tests/ui/copy_iterator.stderr @@ -1,16 +1,16 @@ error: you are implementing `Iterator` on a `Copy` type - --> $DIR/copy_iterator.rs:6:1 + --> $DIR/copy_iterator.rs:8:1 | -6 | / impl Iterator for Countdown { -7 | | type Item = u8; -8 | | -9 | | fn next(&mut self) -> Option { +8 | / impl Iterator for Countdown { +9 | | type Item = u8; +10 | | +11 | | fn next(&mut self) -> Option { ... | -14 | | } -15 | | } +16 | | } +17 | | } | |_^ | - = note: `-D copy-iterator` implied by `-D warnings` + = note: `-D clippy::copy-iterator` implied by `-D warnings` = note: consider implementing `IntoIterator` instead error: aborting due to previous error diff --git a/tests/ui/cstring.stderr b/tests/ui/cstring.stderr index 0e90f6963..2b2b51de6 100644 --- a/tests/ui/cstring.stderr +++ b/tests/ui/cstring.stderr @@ -1,15 +1,15 @@ error: you are getting the inner pointer of a temporary `CString` - --> $DIR/cstring.rs:7:5 + --> $DIR/cstring.rs:9:5 | -7 | CString::new("foo").unwrap().as_ptr(); +9 | CString::new("foo").unwrap().as_ptr(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: #[deny(temporary_cstring_as_ptr)] on by default + = note: #[deny(clippy::temporary_cstring_as_ptr)] on by default = note: that pointer will be invalid outside this expression help: assign the `CString` to a variable to extend its lifetime - --> $DIR/cstring.rs:7:5 + --> $DIR/cstring.rs:9:5 | -7 | CString::new("foo").unwrap().as_ptr(); +9 | CString::new("foo").unwrap().as_ptr(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/tests/ui/cyclomatic_complexity.stderr b/tests/ui/cyclomatic_complexity.stderr index 43676762d..ff93f21e3 100644 --- a/tests/ui/cyclomatic_complexity.stderr +++ b/tests/ui/cyclomatic_complexity.stderr @@ -10,7 +10,7 @@ error: the function has a cyclomatic complexity of 28 89 | | } | |_^ | - = note: `-D cyclomatic-complexity` implied by `-D warnings` + = note: `-D clippy::cyclomatic-complexity` implied by `-D warnings` = help: you could split it up into multiple smaller functions error: the function has a cyclomatic complexity of 7 diff --git a/tests/ui/cyclomatic_complexity_attr_used.stderr b/tests/ui/cyclomatic_complexity_attr_used.stderr index e671b3439..f8342f0d9 100644 --- a/tests/ui/cyclomatic_complexity_attr_used.stderr +++ b/tests/ui/cyclomatic_complexity_attr_used.stderr @@ -10,7 +10,7 @@ error: the function has a cyclomatic complexity of 3 17 | | } | |_^ | - = note: `-D cyclomatic-complexity` implied by `-D warnings` + = note: `-D clippy::cyclomatic-complexity` implied by `-D warnings` = help: you could split it up into multiple smaller functions error: aborting due to previous error diff --git a/tests/ui/decimal_literal_representation.stderr b/tests/ui/decimal_literal_representation.stderr index baed3c411..343936bb7 100644 --- a/tests/ui/decimal_literal_representation.stderr +++ b/tests/ui/decimal_literal_representation.stderr @@ -4,7 +4,7 @@ error: integer literal has a better hexadecimal representation 18 | 32_773, // 0x8005 | ^^^^^^ help: consider: `0x8005` | - = note: `-D decimal-literal-representation` implied by `-D warnings` + = note: `-D clippy::decimal-literal-representation` implied by `-D warnings` error: integer literal has a better hexadecimal representation --> $DIR/decimal_literal_representation.rs:19:9 diff --git a/tests/ui/default_trait_access.stderr b/tests/ui/default_trait_access.stderr index 8bb473103..e3c263e77 100644 --- a/tests/ui/default_trait_access.stderr +++ b/tests/ui/default_trait_access.stderr @@ -1,51 +1,51 @@ error: Calling std::string::String::default() is more clear than this expression - --> $DIR/default_trait_access.rs:8:22 - | -8 | let s1: String = Default::default(); - | ^^^^^^^^^^^^^^^^^^ help: try: `std::string::String::default()` - | - = note: `-D default-trait-access` implied by `-D warnings` - -error: Calling std::string::String::default() is more clear than this expression - --> $DIR/default_trait_access.rs:12:22 + --> $DIR/default_trait_access.rs:10:22 | -12 | let s3: String = D2::default(); - | ^^^^^^^^^^^^^ help: try: `std::string::String::default()` +10 | let s1: String = Default::default(); + | ^^^^^^^^^^^^^^^^^^ help: try: `std::string::String::default()` + | + = note: `-D clippy::default-trait-access` implied by `-D warnings` error: Calling std::string::String::default() is more clear than this expression --> $DIR/default_trait_access.rs:14:22 | -14 | let s4: String = std::default::Default::default(); +14 | let s3: String = D2::default(); + | ^^^^^^^^^^^^^ help: try: `std::string::String::default()` + +error: Calling std::string::String::default() is more clear than this expression + --> $DIR/default_trait_access.rs:16:22 + | +16 | let s4: String = std::default::Default::default(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `std::string::String::default()` error: Calling std::string::String::default() is more clear than this expression - --> $DIR/default_trait_access.rs:18:22 + --> $DIR/default_trait_access.rs:20:22 | -18 | let s6: String = default::Default::default(); +20 | let s6: String = default::Default::default(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `std::string::String::default()` error: Calling GenericDerivedDefault::default() is more clear than this expression - --> $DIR/default_trait_access.rs:28:46 + --> $DIR/default_trait_access.rs:30:46 | -28 | let s11: GenericDerivedDefault = Default::default(); +30 | let s11: GenericDerivedDefault = Default::default(); | ^^^^^^^^^^^^^^^^^^ help: try: `GenericDerivedDefault::default()` error: Calling TupleDerivedDefault::default() is more clear than this expression - --> $DIR/default_trait_access.rs:34:36 + --> $DIR/default_trait_access.rs:36:36 | -34 | let s14: TupleDerivedDefault = Default::default(); +36 | let s14: TupleDerivedDefault = Default::default(); | ^^^^^^^^^^^^^^^^^^ help: try: `TupleDerivedDefault::default()` error: Calling ArrayDerivedDefault::default() is more clear than this expression - --> $DIR/default_trait_access.rs:36:36 + --> $DIR/default_trait_access.rs:38:36 | -36 | let s15: ArrayDerivedDefault = Default::default(); +38 | let s15: ArrayDerivedDefault = Default::default(); | ^^^^^^^^^^^^^^^^^^ help: try: `ArrayDerivedDefault::default()` error: Calling TupleStructDerivedDefault::default() is more clear than this expression - --> $DIR/default_trait_access.rs:40:42 + --> $DIR/default_trait_access.rs:42:42 | -40 | let s17: TupleStructDerivedDefault = Default::default(); +42 | let s17: TupleStructDerivedDefault = Default::default(); | ^^^^^^^^^^^^^^^^^^ help: try: `TupleStructDerivedDefault::default()` error: aborting due to 8 previous errors diff --git a/tests/ui/derive.stderr b/tests/ui/derive.stderr index cbe3fe102..fa706f22b 100644 --- a/tests/ui/derive.stderr +++ b/tests/ui/derive.stderr @@ -4,7 +4,7 @@ error: you are deriving `Hash` but have implemented `PartialEq` explicitly 17 | #[derive(Hash)] | ^^^^ | - = note: #[deny(derive_hash_xor_eq)] on by default + = note: #[deny(clippy::derive_hash_xor_eq)] on by default note: `PartialEq` implemented here --> $DIR/derive.rs:20:1 | @@ -49,7 +49,7 @@ error: you are implementing `Clone` explicitly on a `Copy` type 43 | | } | |_^ | - = note: `-D expl-impl-clone-on-copy` implied by `-D warnings` + = note: `-D clippy::expl-impl-clone-on-copy` implied by `-D warnings` note: consider deriving `Clone` or removing `Copy` --> $DIR/derive.rs:41:1 | diff --git a/tests/ui/diverging_sub_expression.stderr b/tests/ui/diverging_sub_expression.stderr index 0d7b1ca6f..8e86a7734 100644 --- a/tests/ui/diverging_sub_expression.stderr +++ b/tests/ui/diverging_sub_expression.stderr @@ -1,39 +1,39 @@ error: sub-expression diverges - --> $DIR/diverging_sub_expression.rs:18:10 + --> $DIR/diverging_sub_expression.rs:20:10 | -18 | b || diverge(); +20 | b || diverge(); | ^^^^^^^^^ | - = note: `-D diverging-sub-expression` implied by `-D warnings` + = note: `-D clippy::diverging-sub-expression` implied by `-D warnings` error: sub-expression diverges - --> $DIR/diverging_sub_expression.rs:19:10 + --> $DIR/diverging_sub_expression.rs:21:10 | -19 | b || A.foo(); +21 | b || A.foo(); | ^^^^^^^ error: sub-expression diverges - --> $DIR/diverging_sub_expression.rs:28:26 + --> $DIR/diverging_sub_expression.rs:30:26 | -28 | 6 => true || return, +30 | 6 => true || return, | ^^^^^^ error: sub-expression diverges - --> $DIR/diverging_sub_expression.rs:29:26 + --> $DIR/diverging_sub_expression.rs:31:26 | -29 | 7 => true || continue, +31 | 7 => true || continue, | ^^^^^^^^ error: sub-expression diverges - --> $DIR/diverging_sub_expression.rs:32:26 + --> $DIR/diverging_sub_expression.rs:34:26 | -32 | 3 => true || diverge(), +34 | 3 => true || diverge(), | ^^^^^^^^^ error: sub-expression diverges - --> $DIR/diverging_sub_expression.rs:37:26 + --> $DIR/diverging_sub_expression.rs:39:26 | -37 | _ => true || break, +39 | _ => true || break, | ^^^^^ error: aborting due to 6 previous errors diff --git a/tests/ui/dlist.stderr b/tests/ui/dlist.stderr index de0422e17..532207520 100644 --- a/tests/ui/dlist.stderr +++ b/tests/ui/dlist.stderr @@ -1,48 +1,48 @@ error: I see you're using a LinkedList! Perhaps you meant some other data structure? - --> $DIR/dlist.rs:12:16 + --> $DIR/dlist.rs:14:16 | -12 | type Baz = LinkedList; +14 | type Baz = LinkedList; | ^^^^^^^^^^^^^^ | - = note: `-D linkedlist` implied by `-D warnings` + = note: `-D clippy::linkedlist` implied by `-D warnings` = help: a VecDeque might work error: I see you're using a LinkedList! Perhaps you meant some other data structure? - --> $DIR/dlist.rs:13:12 + --> $DIR/dlist.rs:15:12 | -13 | fn foo(LinkedList); +15 | fn foo(LinkedList); | ^^^^^^^^^^^^^^ | = help: a VecDeque might work error: I see you're using a LinkedList! Perhaps you meant some other data structure? - --> $DIR/dlist.rs:14:24 + --> $DIR/dlist.rs:16:24 | -14 | const BAR : Option>; +16 | const BAR : Option>; | ^^^^^^^^^^^^^^ | = help: a VecDeque might work error: I see you're using a LinkedList! Perhaps you meant some other data structure? - --> $DIR/dlist.rs:25:15 + --> $DIR/dlist.rs:27:15 | -25 | fn foo(_: LinkedList) {} +27 | fn foo(_: LinkedList) {} | ^^^^^^^^^^^^^^ | = help: a VecDeque might work error: I see you're using a LinkedList! Perhaps you meant some other data structure? - --> $DIR/dlist.rs:28:39 + --> $DIR/dlist.rs:30:39 | -28 | pub fn test(my_favourite_linked_list: LinkedList) { +30 | pub fn test(my_favourite_linked_list: LinkedList) { | ^^^^^^^^^^^^^^ | = help: a VecDeque might work error: I see you're using a LinkedList! Perhaps you meant some other data structure? - --> $DIR/dlist.rs:32:29 + --> $DIR/dlist.rs:34:29 | -32 | pub fn test_ret() -> Option> { +34 | pub fn test_ret() -> Option> { | ^^^^^^^^^^^^^^ | = help: a VecDeque might work diff --git a/tests/ui/doc.stderr b/tests/ui/doc.stderr index f38678e89..c781f36db 100644 --- a/tests/ui/doc.stderr +++ b/tests/ui/doc.stderr @@ -1,183 +1,183 @@ error: you should put `DOC_MARKDOWN` between ticks in the documentation - --> $DIR/doc.rs:1:29 + --> $DIR/doc.rs:3:29 | -1 | //! This file tests for the DOC_MARKDOWN lint +3 | //! This file tests for the DOC_MARKDOWN lint | ^^^^^^^^^^^^ | - = note: `-D doc-markdown` implied by `-D warnings` + = note: `-D clippy::doc-markdown` implied by `-D warnings` error: you should put `foo_bar` between ticks in the documentation - --> $DIR/doc.rs:8:9 - | -8 | /// The foo_bar function does _nothing_. See also foo::bar. (note the dot there) - | ^^^^^^^ + --> $DIR/doc.rs:10:9 + | +10 | /// The foo_bar function does _nothing_. See also foo::bar. (note the dot there) + | ^^^^^^^ error: you should put `foo::bar` between ticks in the documentation - --> $DIR/doc.rs:8:51 - | -8 | /// The foo_bar function does _nothing_. See also foo::bar. (note the dot there) - | ^^^^^^^^ + --> $DIR/doc.rs:10:51 + | +10 | /// The foo_bar function does _nothing_. See also foo::bar. (note the dot there) + | ^^^^^^^^ error: you should put `Foo::some_fun` between ticks in the documentation - --> $DIR/doc.rs:9:84 - | -9 | /// Markdown is _weird_. I mean _really weird_. This /_ is ok. So is `_`. But not Foo::some_fun - | ^^^^^^^^^^^^^ + --> $DIR/doc.rs:11:84 + | +11 | /// Markdown is _weird_. I mean _really weird_. This /_ is ok. So is `_`. But not Foo::some_fun + | ^^^^^^^^^^^^^ error: you should put `a::global:path` between ticks in the documentation - --> $DIR/doc.rs:11:15 + --> $DIR/doc.rs:13:15 | -11 | /// Here be ::a::global:path. +13 | /// Here be ::a::global:path. | ^^^^^^^^^^^^^^ error: you should put `NotInCodeBlock` between ticks in the documentation - --> $DIR/doc.rs:12:22 + --> $DIR/doc.rs:14:22 | -12 | /// That's not code ~NotInCodeBlock~. +14 | /// That's not code ~NotInCodeBlock~. | ^^^^^^^^^^^^^^ error: you should put `be_sure_we_got_to_the_end_of_it` between ticks in the documentation - --> $DIR/doc.rs:13:5 + --> $DIR/doc.rs:15:5 | -13 | /// be_sure_we_got_to_the_end_of_it +15 | /// be_sure_we_got_to_the_end_of_it | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: you should put `be_sure_we_got_to_the_end_of_it` between ticks in the documentation - --> $DIR/doc.rs:27:5 + --> $DIR/doc.rs:29:5 | -27 | /// be_sure_we_got_to_the_end_of_it +29 | /// be_sure_we_got_to_the_end_of_it | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: you should put `be_sure_we_got_to_the_end_of_it` between ticks in the documentation - --> $DIR/doc.rs:34:5 + --> $DIR/doc.rs:36:5 | -34 | /// be_sure_we_got_to_the_end_of_it +36 | /// be_sure_we_got_to_the_end_of_it | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: you should put `be_sure_we_got_to_the_end_of_it` between ticks in the documentation - --> $DIR/doc.rs:48:5 + --> $DIR/doc.rs:50:5 | -48 | /// be_sure_we_got_to_the_end_of_it +50 | /// be_sure_we_got_to_the_end_of_it | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: you should put `link_with_underscores` between ticks in the documentation - --> $DIR/doc.rs:52:22 + --> $DIR/doc.rs:54:22 | -52 | /// This test has [a link_with_underscores][chunked-example] inside it. See #823. +54 | /// This test has [a link_with_underscores][chunked-example] inside it. See #823. | ^^^^^^^^^^^^^^^^^^^^^ error: you should put `inline_link2` between ticks in the documentation - --> $DIR/doc.rs:55:21 + --> $DIR/doc.rs:57:21 | -55 | /// It can also be [inline_link2]. +57 | /// It can also be [inline_link2]. | ^^^^^^^^^^^^ error: you should put `be_sure_we_got_to_the_end_of_it` between ticks in the documentation - --> $DIR/doc.rs:65:5 + --> $DIR/doc.rs:67:5 | -65 | /// be_sure_we_got_to_the_end_of_it +67 | /// be_sure_we_got_to_the_end_of_it | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: you should put `CamelCaseThing` between ticks in the documentation - --> $DIR/doc.rs:73:8 + --> $DIR/doc.rs:75:8 | -73 | /// ## CamelCaseThing +75 | /// ## CamelCaseThing | ^^^^^^^^^^^^^^ error: you should put `CamelCaseThing` between ticks in the documentation - --> $DIR/doc.rs:76:7 + --> $DIR/doc.rs:78:7 | -76 | /// # CamelCaseThing +78 | /// # CamelCaseThing | ^^^^^^^^^^^^^^ error: you should put `CamelCaseThing` between ticks in the documentation - --> $DIR/doc.rs:78:22 + --> $DIR/doc.rs:80:22 | -78 | /// Not a title #897 CamelCaseThing +80 | /// Not a title #897 CamelCaseThing | ^^^^^^^^^^^^^^ error: you should put `be_sure_we_got_to_the_end_of_it` between ticks in the documentation - --> $DIR/doc.rs:79:5 + --> $DIR/doc.rs:81:5 | -79 | /// be_sure_we_got_to_the_end_of_it +81 | /// be_sure_we_got_to_the_end_of_it | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: you should put `be_sure_we_got_to_the_end_of_it` between ticks in the documentation - --> $DIR/doc.rs:86:5 + --> $DIR/doc.rs:88:5 | -86 | /// be_sure_we_got_to_the_end_of_it +88 | /// be_sure_we_got_to_the_end_of_it | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: you should put `be_sure_we_got_to_the_end_of_it` between ticks in the documentation - --> $DIR/doc.rs:99:5 - | -99 | /// be_sure_we_got_to_the_end_of_it - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error: you should put `FooBar` between ticks in the documentation - --> $DIR/doc.rs:110:42 + --> $DIR/doc.rs:101:5 | -110 | /** E.g. serialization of an empty list: FooBar - | ^^^^^^ - -error: you should put `BarQuz` between ticks in the documentation - --> $DIR/doc.rs:115:5 - | -115 | And BarQuz too. - | ^^^^^^ - -error: you should put `be_sure_we_got_to_the_end_of_it` between ticks in the documentation - --> $DIR/doc.rs:116:1 - | -116 | be_sure_we_got_to_the_end_of_it - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error: you should put `FooBar` between ticks in the documentation - --> $DIR/doc.rs:121:42 - | -121 | /** E.g. serialization of an empty list: FooBar - | ^^^^^^ - -error: you should put `BarQuz` between ticks in the documentation - --> $DIR/doc.rs:126:5 - | -126 | And BarQuz too. - | ^^^^^^ - -error: you should put `be_sure_we_got_to_the_end_of_it` between ticks in the documentation - --> $DIR/doc.rs:127:1 - | -127 | be_sure_we_got_to_the_end_of_it - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error: you should put `be_sure_we_got_to_the_end_of_it` between ticks in the documentation - --> $DIR/doc.rs:138:5 - | -138 | /// be_sure_we_got_to_the_end_of_it +101 | /// be_sure_we_got_to_the_end_of_it | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error: you should put bare URLs between `<`/`>` or make a proper Markdown link - --> $DIR/doc.rs:165:13 +error: you should put `FooBar` between ticks in the documentation + --> $DIR/doc.rs:112:42 | -165 | /// Not ok: http://www.unicode.org - | ^^^^^^^^^^^^^^^^^^^^^^ +112 | /** E.g. serialization of an empty list: FooBar + | ^^^^^^ -error: you should put bare URLs between `<`/`>` or make a proper Markdown link - --> $DIR/doc.rs:166:13 +error: you should put `BarQuz` between ticks in the documentation + --> $DIR/doc.rs:117:5 | -166 | /// Not ok: https://www.unicode.org - | ^^^^^^^^^^^^^^^^^^^^^^^ +117 | And BarQuz too. + | ^^^^^^ + +error: you should put `be_sure_we_got_to_the_end_of_it` between ticks in the documentation + --> $DIR/doc.rs:118:1 + | +118 | be_sure_we_got_to_the_end_of_it + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: you should put `FooBar` between ticks in the documentation + --> $DIR/doc.rs:123:42 + | +123 | /** E.g. serialization of an empty list: FooBar + | ^^^^^^ + +error: you should put `BarQuz` between ticks in the documentation + --> $DIR/doc.rs:128:5 + | +128 | And BarQuz too. + | ^^^^^^ + +error: you should put `be_sure_we_got_to_the_end_of_it` between ticks in the documentation + --> $DIR/doc.rs:129:1 + | +129 | be_sure_we_got_to_the_end_of_it + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: you should put `be_sure_we_got_to_the_end_of_it` between ticks in the documentation + --> $DIR/doc.rs:140:5 + | +140 | /// be_sure_we_got_to_the_end_of_it + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: you should put bare URLs between `<`/`>` or make a proper Markdown link --> $DIR/doc.rs:167:13 | -167 | /// Not ok: http://www.unicode.org/ +167 | /// Not ok: http://www.unicode.org | ^^^^^^^^^^^^^^^^^^^^^^ error: you should put bare URLs between `<`/`>` or make a proper Markdown link --> $DIR/doc.rs:168:13 | -168 | /// Not ok: http://www.unicode.org/reports/tr9/#Reordering_Resolved_Levels +168 | /// Not ok: https://www.unicode.org + | ^^^^^^^^^^^^^^^^^^^^^^^ + +error: you should put bare URLs between `<`/`>` or make a proper Markdown link + --> $DIR/doc.rs:169:13 + | +169 | /// Not ok: http://www.unicode.org/ + | ^^^^^^^^^^^^^^^^^^^^^^ + +error: you should put bare URLs between `<`/`>` or make a proper Markdown link + --> $DIR/doc.rs:170:13 + | +170 | /// Not ok: http://www.unicode.org/reports/tr9/#Reordering_Resolved_Levels | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 30 previous errors diff --git a/tests/ui/double_comparison.stderr b/tests/ui/double_comparison.stderr index 73dd8d028..e6a0e9764 100644 --- a/tests/ui/double_comparison.stderr +++ b/tests/ui/double_comparison.stderr @@ -4,7 +4,7 @@ error: This binary expression can be simplified 4 | if x == y || x < y { | ^^^^^^^^^^^^^^^ help: try: `x <= y` | - = note: `-D double-comparisons` implied by `-D warnings` + = note: `-D clippy::double-comparisons` implied by `-D warnings` error: This binary expression can be simplified --> $DIR/double_comparison.rs:7:8 diff --git a/tests/ui/double_neg.stderr b/tests/ui/double_neg.stderr index fd4da8820..02202dbd6 100644 --- a/tests/ui/double_neg.stderr +++ b/tests/ui/double_neg.stderr @@ -4,7 +4,7 @@ error: `--x` could be misinterpreted as pre-decrement by C programmers, is usual 9 | --x; | ^^^ | - = note: `-D double-neg` implied by `-D warnings` + = note: `-D clippy::double-neg` implied by `-D warnings` error: aborting due to previous error diff --git a/tests/ui/double_parens.stderr b/tests/ui/double_parens.stderr index a77b08528..a6a29eeb0 100644 --- a/tests/ui/double_parens.stderr +++ b/tests/ui/double_parens.stderr @@ -4,7 +4,7 @@ error: Consider removing unnecessary double parentheses 16 | ((0)) | ^^^^^ | - = note: `-D double-parens` implied by `-D warnings` + = note: `-D clippy::double-parens` implied by `-D warnings` error: Consider removing unnecessary double parentheses --> $DIR/double_parens.rs:20:14 diff --git a/tests/ui/drop_forget_copy.stderr b/tests/ui/drop_forget_copy.stderr index 3ea7bf973..043067fe8 100644 --- a/tests/ui/drop_forget_copy.stderr +++ b/tests/ui/drop_forget_copy.stderr @@ -4,7 +4,7 @@ error: calls to `std::mem::drop` with a value that implements Copy. Dropping a c 33 | drop(s1); | ^^^^^^^^ | - = note: `-D drop-copy` implied by `-D warnings` + = note: `-D clippy::drop-copy` implied by `-D warnings` note: argument has type SomeStruct --> $DIR/drop_forget_copy.rs:33:10 | @@ -41,7 +41,7 @@ error: calls to `std::mem::forget` with a value that implements Copy. Forgetting 39 | forget(s1); | ^^^^^^^^^^ | - = note: `-D forget-copy` implied by `-D warnings` + = note: `-D clippy::forget-copy` implied by `-D warnings` note: argument has type SomeStruct --> $DIR/drop_forget_copy.rs:39:12 | diff --git a/tests/ui/drop_forget_ref.stderr b/tests/ui/drop_forget_ref.stderr index 1654fdd28..227918f59 100644 --- a/tests/ui/drop_forget_ref.stderr +++ b/tests/ui/drop_forget_ref.stderr @@ -4,7 +4,7 @@ error: calls to `std::mem::drop` with a reference instead of an owned value. Dro 12 | drop(&SomeStruct); | ^^^^^^^^^^^^^^^^^ | - = note: `-D drop-ref` implied by `-D warnings` + = note: `-D clippy::drop-ref` implied by `-D warnings` note: argument has type &SomeStruct --> $DIR/drop_forget_ref.rs:12:10 | @@ -17,7 +17,7 @@ error: calls to `std::mem::forget` with a reference instead of an owned value. F 13 | forget(&SomeStruct); | ^^^^^^^^^^^^^^^^^^^ | - = note: `-D forget-ref` implied by `-D warnings` + = note: `-D clippy::forget-ref` implied by `-D warnings` note: argument has type &SomeStruct --> $DIR/drop_forget_ref.rs:13:12 | diff --git a/tests/ui/duplicate_underscore_argument.stderr b/tests/ui/duplicate_underscore_argument.stderr index c926f57f1..707145346 100644 --- a/tests/ui/duplicate_underscore_argument.stderr +++ b/tests/ui/duplicate_underscore_argument.stderr @@ -4,7 +4,7 @@ error: `darth` already exists, having another argument having almost the same na 7 | fn join_the_dark_side(darth: i32, _darth: i32) {} | ^^^^^ | - = note: `-D duplicate-underscore-argument` implied by `-D warnings` + = note: `-D clippy::duplicate-underscore-argument` implied by `-D warnings` error: aborting due to previous error diff --git a/tests/ui/duration_subsec.stderr b/tests/ui/duration_subsec.stderr index a1aacec3a..c23b041a8 100644 --- a/tests/ui/duration_subsec.stderr +++ b/tests/ui/duration_subsec.stderr @@ -1,33 +1,33 @@ error: Calling `subsec_millis()` is more concise than this calculation - --> $DIR/duration_subsec.rs:8:24 - | -8 | let bad_millis_1 = dur.subsec_micros() / 1_000; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `dur.subsec_millis()` - | - = note: `-D duration-subsec` implied by `-D warnings` + --> $DIR/duration_subsec.rs:10:24 + | +10 | let bad_millis_1 = dur.subsec_micros() / 1_000; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `dur.subsec_millis()` + | + = note: `-D clippy::duration-subsec` implied by `-D warnings` error: Calling `subsec_millis()` is more concise than this calculation - --> $DIR/duration_subsec.rs:9:24 - | -9 | let bad_millis_2 = dur.subsec_nanos() / 1_000_000; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `dur.subsec_millis()` + --> $DIR/duration_subsec.rs:11:24 + | +11 | let bad_millis_2 = dur.subsec_nanos() / 1_000_000; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `dur.subsec_millis()` error: Calling `subsec_micros()` is more concise than this calculation - --> $DIR/duration_subsec.rs:14:22 + --> $DIR/duration_subsec.rs:16:22 | -14 | let bad_micros = dur.subsec_nanos() / 1_000; +16 | let bad_micros = dur.subsec_nanos() / 1_000; | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `dur.subsec_micros()` error: Calling `subsec_micros()` is more concise than this calculation - --> $DIR/duration_subsec.rs:19:13 + --> $DIR/duration_subsec.rs:21:13 | -19 | let _ = (&dur).subsec_nanos() / 1_000; +21 | let _ = (&dur).subsec_nanos() / 1_000; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `(&dur).subsec_micros()` error: Calling `subsec_micros()` is more concise than this calculation - --> $DIR/duration_subsec.rs:23:13 + --> $DIR/duration_subsec.rs:25:13 | -23 | let _ = dur.subsec_nanos() / NANOS_IN_MICRO; +25 | let _ = dur.subsec_nanos() / NANOS_IN_MICRO; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `dur.subsec_micros()` error: aborting due to 5 previous errors diff --git a/tests/ui/else_if_without_else.stderr b/tests/ui/else_if_without_else.stderr index b8a5031fb..a352546ce 100644 --- a/tests/ui/else_if_without_else.stderr +++ b/tests/ui/else_if_without_else.stderr @@ -1,21 +1,21 @@ error: if expression with an `else if`, but without a final `else` - --> $DIR/else_if_without_else.rs:39:12 + --> $DIR/else_if_without_else.rs:41:12 | -39 | } else if bla2() { //~ ERROR else if without else +41 | } else if bla2() { //~ ERROR else if without else | ____________^ -40 | | println!("else if"); -41 | | } +42 | | println!("else if"); +43 | | } | |_____^ help: add an `else` block here | - = note: `-D else-if-without-else` implied by `-D warnings` + = note: `-D clippy::else-if-without-else` implied by `-D warnings` error: if expression with an `else if`, but without a final `else` - --> $DIR/else_if_without_else.rs:47:12 + --> $DIR/else_if_without_else.rs:49:12 | -47 | } else if bla3() { //~ ERROR else if without else +49 | } else if bla3() { //~ ERROR else if without else | ____________^ -48 | | println!("else if 2"); -49 | | } +50 | | println!("else if 2"); +51 | | } | |_____^ help: add an `else` block here error: aborting due to 2 previous errors diff --git a/tests/ui/empty_enum.stderr b/tests/ui/empty_enum.stderr index ca377cee8..f198793fe 100644 --- a/tests/ui/empty_enum.stderr +++ b/tests/ui/empty_enum.stderr @@ -4,7 +4,7 @@ error: enum with no variants 7 | enum Empty {} | ^^^^^^^^^^^^^ | - = note: `-D empty-enum` implied by `-D warnings` + = note: `-D clippy::empty-enum` implied by `-D warnings` help: consider using the uninhabited type `!` or a wrapper around it --> $DIR/empty_enum.rs:7:1 | diff --git a/tests/ui/empty_line_after_outer_attribute.stderr b/tests/ui/empty_line_after_outer_attribute.stderr index 7c9c7b8f3..7bcec54a6 100644 --- a/tests/ui/empty_line_after_outer_attribute.stderr +++ b/tests/ui/empty_line_after_outer_attribute.stderr @@ -7,7 +7,7 @@ error: Found an empty line after an outer attribute. Perhaps you forgot to add a 8 | | fn with_one_newline_and_comment() { assert!(true) } | |_ | - = note: `-D empty-line-after-outer-attr` implied by `-D warnings` + = note: `-D clippy::empty-line-after-outer-attr` implied by `-D warnings` error: Found an empty line after an outer attribute. Perhaps you forgot to add a '!' to make it an inner attribute? --> $DIR/empty_line_after_outer_attribute.rs:17:1 diff --git a/tests/ui/entry.stderr b/tests/ui/entry.stderr index 09c4a8822..cffe8b232 100644 --- a/tests/ui/entry.stderr +++ b/tests/ui/entry.stderr @@ -4,7 +4,7 @@ error: usage of `contains_key` followed by `insert` on a `HashMap` 13 | if !m.contains_key(&k) { m.insert(k, v); } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `m.entry(k).or_insert(v)` | - = note: `-D map-entry` implied by `-D warnings` + = note: `-D clippy::map-entry` implied by `-D warnings` error: usage of `contains_key` followed by `insert` on a `HashMap` --> $DIR/entry.rs:17:5 diff --git a/tests/ui/enum_glob_use.stderr b/tests/ui/enum_glob_use.stderr index 2d53618c1..bb1d19e41 100644 --- a/tests/ui/enum_glob_use.stderr +++ b/tests/ui/enum_glob_use.stderr @@ -4,7 +4,7 @@ error: don't use glob imports for enum variants 6 | use std::cmp::Ordering::*; | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: `-D enum-glob-use` implied by `-D warnings` + = note: `-D clippy::enum-glob-use` implied by `-D warnings` error: don't use glob imports for enum variants --> $DIR/enum_glob_use.rs:12:1 diff --git a/tests/ui/enum_variants.stderr b/tests/ui/enum_variants.stderr index e33e29ec7..bd083e7e0 100644 --- a/tests/ui/enum_variants.stderr +++ b/tests/ui/enum_variants.stderr @@ -1,100 +1,100 @@ error: Variant name ends with the enum's name - --> $DIR/enum_variants.rs:14:5 + --> $DIR/enum_variants.rs:16:5 | -14 | cFoo, +16 | cFoo, | ^^^^ | - = note: `-D enum-variant-names` implied by `-D warnings` - -error: Variant name starts with the enum's name - --> $DIR/enum_variants.rs:25:5 - | -25 | FoodGood, - | ^^^^^^^^ - -error: Variant name starts with the enum's name - --> $DIR/enum_variants.rs:26:5 - | -26 | FoodMiddle, - | ^^^^^^^^^^ + = note: `-D clippy::enum-variant-names` implied by `-D warnings` error: Variant name starts with the enum's name --> $DIR/enum_variants.rs:27:5 | -27 | FoodBad, +27 | FoodGood, + | ^^^^^^^^ + +error: Variant name starts with the enum's name + --> $DIR/enum_variants.rs:28:5 + | +28 | FoodMiddle, + | ^^^^^^^^^^ + +error: Variant name starts with the enum's name + --> $DIR/enum_variants.rs:29:5 + | +29 | FoodBad, | ^^^^^^^ error: All variants have the same prefix: `Food` - --> $DIR/enum_variants.rs:24:1 + --> $DIR/enum_variants.rs:26:1 | -24 | / enum Food { -25 | | FoodGood, -26 | | FoodMiddle, -27 | | FoodBad, -28 | | } +26 | / enum Food { +27 | | FoodGood, +28 | | FoodMiddle, +29 | | FoodBad, +30 | | } | |_^ | = help: remove the prefixes and use full paths to the variants instead of glob imports error: All variants have the same prefix: `CallType` - --> $DIR/enum_variants.rs:34:1 + --> $DIR/enum_variants.rs:36:1 | -34 | / enum BadCallType { -35 | | CallTypeCall, -36 | | CallTypeCreate, -37 | | CallTypeDestroy, -38 | | } +36 | / enum BadCallType { +37 | | CallTypeCall, +38 | | CallTypeCreate, +39 | | CallTypeDestroy, +40 | | } | |_^ | = help: remove the prefixes and use full paths to the variants instead of glob imports error: All variants have the same prefix: `Constant` - --> $DIR/enum_variants.rs:45:1 + --> $DIR/enum_variants.rs:47:1 | -45 | / enum Consts { -46 | | ConstantInt, -47 | | ConstantCake, -48 | | ConstantLie, -49 | | } +47 | / enum Consts { +48 | | ConstantInt, +49 | | ConstantCake, +50 | | ConstantLie, +51 | | } | |_^ | = help: remove the prefixes and use full paths to the variants instead of glob imports error: All variants have the same prefix: `With` - --> $DIR/enum_variants.rs:78:1 + --> $DIR/enum_variants.rs:80:1 | -78 | / enum Seallll { -79 | | WithOutCake, -80 | | WithOutTea, -81 | | WithOut, -82 | | } +80 | / enum Seallll { +81 | | WithOutCake, +82 | | WithOutTea, +83 | | WithOut, +84 | | } | |_^ | = help: remove the prefixes and use full paths to the variants instead of glob imports error: All variants have the same prefix: `Prefix` - --> $DIR/enum_variants.rs:84:1 + --> $DIR/enum_variants.rs:86:1 | -84 | / enum NonCaps { -85 | | Prefix的, -86 | | PrefixTea, -87 | | PrefixCake, -88 | | } +86 | / enum NonCaps { +87 | | Prefix的, +88 | | PrefixTea, +89 | | PrefixCake, +90 | | } | |_^ | = help: remove the prefixes and use full paths to the variants instead of glob imports error: All variants have the same prefix: `With` - --> $DIR/enum_variants.rs:90:1 + --> $DIR/enum_variants.rs:92:1 | -90 | / pub enum PubSeall { -91 | | WithOutCake, -92 | | WithOutTea, -93 | | WithOut, -94 | | } +92 | / pub enum PubSeall { +93 | | WithOutCake, +94 | | WithOutTea, +95 | | WithOut, +96 | | } | |_^ | - = note: `-D pub-enum-variant-names` implied by `-D warnings` + = note: `-D clippy::pub-enum-variant-names` implied by `-D warnings` = help: remove the prefixes and use full paths to the variants instead of glob imports error: aborting due to 10 previous errors diff --git a/tests/ui/enums_clike.stderr b/tests/ui/enums_clike.stderr index d6a137c6f..cccf4ed03 100644 --- a/tests/ui/enums_clike.stderr +++ b/tests/ui/enums_clike.stderr @@ -1,51 +1,51 @@ error: Clike enum variant discriminant is not portable to 32-bit targets - --> $DIR/enums_clike.rs:10:5 + --> $DIR/enums_clike.rs:12:5 | -10 | X = 0x1_0000_0000, +12 | X = 0x1_0000_0000, | ^^^^^^^^^^^^^^^^^ | - = note: `-D enum-clike-unportable-variant` implied by `-D warnings` + = note: `-D clippy::enum-clike-unportable-variant` implied by `-D warnings` error: Clike enum variant discriminant is not portable to 32-bit targets - --> $DIR/enums_clike.rs:17:5 + --> $DIR/enums_clike.rs:19:5 | -17 | X = 0x1_0000_0000, +19 | X = 0x1_0000_0000, | ^^^^^^^^^^^^^^^^^ error: Clike enum variant discriminant is not portable to 32-bit targets - --> $DIR/enums_clike.rs:20:5 + --> $DIR/enums_clike.rs:22:5 | -20 | A = 0xFFFF_FFFF, +22 | A = 0xFFFF_FFFF, | ^^^^^^^^^^^^^^^ error: Clike enum variant discriminant is not portable to 32-bit targets - --> $DIR/enums_clike.rs:27:5 + --> $DIR/enums_clike.rs:29:5 | -27 | Z = 0xFFFF_FFFF, +29 | Z = 0xFFFF_FFFF, | ^^^^^^^^^^^^^^^ -error: Clike enum variant discriminant is not portable to 32-bit targets - --> $DIR/enums_clike.rs:28:5 - | -28 | A = 0x1_0000_0000, - | ^^^^^^^^^^^^^^^^^ - error: Clike enum variant discriminant is not portable to 32-bit targets --> $DIR/enums_clike.rs:30:5 | -30 | C = (std::i32::MIN as isize) - 1, +30 | A = 0x1_0000_0000, + | ^^^^^^^^^^^^^^^^^ + +error: Clike enum variant discriminant is not portable to 32-bit targets + --> $DIR/enums_clike.rs:32:5 + | +32 | C = (std::i32::MIN as isize) - 1, | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: Clike enum variant discriminant is not portable to 32-bit targets - --> $DIR/enums_clike.rs:36:5 + --> $DIR/enums_clike.rs:38:5 | -36 | Z = 0xFFFF_FFFF, +38 | Z = 0xFFFF_FFFF, | ^^^^^^^^^^^^^^^ error: Clike enum variant discriminant is not portable to 32-bit targets - --> $DIR/enums_clike.rs:37:5 + --> $DIR/enums_clike.rs:39:5 | -37 | A = 0x1_0000_0000, +39 | A = 0x1_0000_0000, | ^^^^^^^^^^^^^^^^^ error: aborting due to 8 previous errors diff --git a/tests/ui/eq_op.stderr b/tests/ui/eq_op.stderr index ccf366062..ad0c8d8ec 100644 --- a/tests/ui/eq_op.stderr +++ b/tests/ui/eq_op.stderr @@ -4,7 +4,7 @@ error: this boolean expression can be simplified 37 | true && true; | ^^^^^^^^^^^^ help: try: `true` | - = note: `-D nonminimal-bool` implied by `-D warnings` + = note: `-D clippy::nonminimal-bool` implied by `-D warnings` error: this boolean expression can be simplified --> $DIR/eq_op.rs:39:5 @@ -42,7 +42,7 @@ error: equal expressions as operands to `==` 10 | 1 == 1; | ^^^^^^ | - = note: `-D eq-op` implied by `-D warnings` + = note: `-D clippy::eq-op` implied by `-D warnings` error: equal expressions as operands to `==` --> $DIR/eq_op.rs:11:5 @@ -202,7 +202,7 @@ error: taken reference of right operand | | | help: use the right value directly: `y` | - = note: `-D op-ref` implied by `-D warnings` + = note: `-D clippy::op-ref` implied by `-D warnings` error: equal expressions as operands to `/` --> $DIR/eq_op.rs:97:20 diff --git a/tests/ui/erasing_op.stderr b/tests/ui/erasing_op.stderr index 310c41c54..18486ab47 100644 --- a/tests/ui/erasing_op.stderr +++ b/tests/ui/erasing_op.stderr @@ -4,7 +4,7 @@ error: this operation will always return zero. This is likely not the intended o 9 | x * 0; | ^^^^^ | - = note: `-D erasing-op` implied by `-D warnings` + = note: `-D clippy::erasing-op` implied by `-D warnings` error: this operation will always return zero. This is likely not the intended outcome --> $DIR/erasing_op.rs:10:5 diff --git a/tests/ui/eta.stderr b/tests/ui/eta.stderr index 5dca265c2..89543d6af 100644 --- a/tests/ui/eta.stderr +++ b/tests/ui/eta.stderr @@ -4,7 +4,7 @@ error: redundant closure found 7 | let a = Some(1u8).map(|a| foo(a)); | ^^^^^^^^^^ help: remove closure as shown: `foo` | - = note: `-D redundant-closure` implied by `-D warnings` + = note: `-D clippy::redundant-closure` implied by `-D warnings` error: redundant closure found --> $DIR/eta.rs:8:10 @@ -24,7 +24,7 @@ error: this expression borrows a reference that is immediately dereferenced by t 11 | all(&[1, 2, 3], &&2, |x, y| below(x, y)); //is adjusted | ^^^ help: change this to: `&2` | - = note: `-D needless-borrow` implied by `-D warnings` + = note: `-D clippy::needless-borrow` implied by `-D warnings` error: redundant closure found --> $DIR/eta.rs:18:27 diff --git a/tests/ui/eval_order_dependence.stderr b/tests/ui/eval_order_dependence.stderr index 2e01a167c..3caba829b 100644 --- a/tests/ui/eval_order_dependence.stderr +++ b/tests/ui/eval_order_dependence.stderr @@ -4,7 +4,7 @@ error: unsequenced read of a variable 8 | let a = { x = 1; 1 } + x; | ^ | - = note: `-D eval-order-dependence` implied by `-D warnings` + = note: `-D clippy::eval-order-dependence` implied by `-D warnings` note: whether read occurs before this write depends on evaluation order --> $DIR/eval_order_dependence.rs:8:15 | diff --git a/tests/ui/excessive_precision.stderr b/tests/ui/excessive_precision.stderr index 295846e9d..bb0546cdc 100644 --- a/tests/ui/excessive_precision.stderr +++ b/tests/ui/excessive_precision.stderr @@ -4,7 +4,7 @@ error: float has excessive precision 15 | const BAD32_1: f32 = 0.123_456_789_f32; | ^^^^^^^^^^^^^^^^^ help: consider changing the type or truncating it to: `0.123_456_79` | - = note: `-D excessive-precision` implied by `-D warnings` + = note: `-D clippy::excessive-precision` implied by `-D warnings` error: float has excessive precision --> $DIR/excessive_precision.rs:16:26 diff --git a/tests/ui/explicit_write.stderr b/tests/ui/explicit_write.stderr index 7a2a0c66f..fb14120b1 100644 --- a/tests/ui/explicit_write.stderr +++ b/tests/ui/explicit_write.stderr @@ -1,39 +1,39 @@ error: use of `write!(stdout(), ...).unwrap()`. Consider using `print!` instead - --> $DIR/explicit_write.rs:16:9 + --> $DIR/explicit_write.rs:18:9 | -16 | write!(std::io::stdout(), "test").unwrap(); +18 | write!(std::io::stdout(), "test").unwrap(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: `-D explicit-write` implied by `-D warnings` + = note: `-D clippy::explicit-write` implied by `-D warnings` error: use of `write!(stderr(), ...).unwrap()`. Consider using `eprint!` instead - --> $DIR/explicit_write.rs:17:9 + --> $DIR/explicit_write.rs:19:9 | -17 | write!(std::io::stderr(), "test").unwrap(); +19 | write!(std::io::stderr(), "test").unwrap(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: use of `writeln!(stdout(), ...).unwrap()`. Consider using `println!` instead - --> $DIR/explicit_write.rs:18:9 + --> $DIR/explicit_write.rs:20:9 | -18 | writeln!(std::io::stdout(), "test").unwrap(); +20 | writeln!(std::io::stdout(), "test").unwrap(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: use of `writeln!(stderr(), ...).unwrap()`. Consider using `eprintln!` instead - --> $DIR/explicit_write.rs:19:9 + --> $DIR/explicit_write.rs:21:9 | -19 | writeln!(std::io::stderr(), "test").unwrap(); +21 | writeln!(std::io::stderr(), "test").unwrap(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: use of `stdout().write_fmt(...).unwrap()`. Consider using `print!` instead - --> $DIR/explicit_write.rs:20:9 + --> $DIR/explicit_write.rs:22:9 | -20 | std::io::stdout().write_fmt(format_args!("test")).unwrap(); +22 | std::io::stdout().write_fmt(format_args!("test")).unwrap(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: use of `stderr().write_fmt(...).unwrap()`. Consider using `eprint!` instead - --> $DIR/explicit_write.rs:21:9 + --> $DIR/explicit_write.rs:23:9 | -21 | std::io::stderr().write_fmt(format_args!("test")).unwrap(); +23 | std::io::stderr().write_fmt(format_args!("test")).unwrap(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 6 previous errors diff --git a/tests/ui/fallible_impl_from.stderr b/tests/ui/fallible_impl_from.stderr index c8af77eca..4dbc7879d 100644 --- a/tests/ui/fallible_impl_from.stderr +++ b/tests/ui/fallible_impl_from.stderr @@ -1,91 +1,91 @@ error: consider implementing `TryFrom` instead - --> $DIR/fallible_impl_from.rs:5:1 - | -5 | / impl From for Foo { -6 | | fn from(s: String) -> Self { -7 | | Foo(s.parse().unwrap()) -8 | | } -9 | | } - | |_^ - | + --> $DIR/fallible_impl_from.rs:7:1 + | +7 | / impl From for Foo { +8 | | fn from(s: String) -> Self { +9 | | Foo(s.parse().unwrap()) +10 | | } +11 | | } + | |_^ + | note: lint level defined here - --> $DIR/fallible_impl_from.rs:1:9 - | -1 | #![deny(fallible_impl_from)] - | ^^^^^^^^^^^^^^^^^^ - = help: `From` is intended for infallible conversions only. Use `TryFrom` if there's a possibility for the conversion to fail. + --> $DIR/fallible_impl_from.rs:3:9 + | +3 | #![deny(clippy::fallible_impl_from)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + = help: `From` is intended for infallible conversions only. Use `TryFrom` if there's a possibility for the conversion to fail. note: potential failure(s) - --> $DIR/fallible_impl_from.rs:7:13 - | -7 | Foo(s.parse().unwrap()) - | ^^^^^^^^^^^^^^^^^^ + --> $DIR/fallible_impl_from.rs:9:13 + | +9 | Foo(s.parse().unwrap()) + | ^^^^^^^^^^^^^^^^^^ error: consider implementing `TryFrom` instead - --> $DIR/fallible_impl_from.rs:28:1 + --> $DIR/fallible_impl_from.rs:30:1 | -28 | / impl From for Invalid { -29 | | fn from(i: usize) -> Invalid { -30 | | if i != 42 { -31 | | panic!(); +30 | / impl From for Invalid { +31 | | fn from(i: usize) -> Invalid { +32 | | if i != 42 { +33 | | panic!(); ... | -34 | | } -35 | | } +36 | | } +37 | | } | |_^ | = help: `From` is intended for infallible conversions only. Use `TryFrom` if there's a possibility for the conversion to fail. note: potential failure(s) - --> $DIR/fallible_impl_from.rs:31:13 + --> $DIR/fallible_impl_from.rs:33:13 | -31 | panic!(); +33 | panic!(); | ^^^^^^^^^ = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) error: consider implementing `TryFrom` instead - --> $DIR/fallible_impl_from.rs:37:1 + --> $DIR/fallible_impl_from.rs:39:1 | -37 | / impl From> for Invalid { -38 | | fn from(s: Option) -> Invalid { -39 | | let s = s.unwrap(); -40 | | if !s.is_empty() { +39 | / impl From> for Invalid { +40 | | fn from(s: Option) -> Invalid { +41 | | let s = s.unwrap(); +42 | | if !s.is_empty() { ... | -46 | | } -47 | | } +48 | | } +49 | | } | |_^ | = help: `From` is intended for infallible conversions only. Use `TryFrom` if there's a possibility for the conversion to fail. note: potential failure(s) - --> $DIR/fallible_impl_from.rs:39:17 + --> $DIR/fallible_impl_from.rs:41:17 | -39 | let s = s.unwrap(); +41 | let s = s.unwrap(); | ^^^^^^^^^^ -40 | if !s.is_empty() { -41 | panic!(42); +42 | if !s.is_empty() { +43 | panic!(42); | ^^^^^^^^^^^ -42 | } else if s.parse::().unwrap() != 42 { +44 | } else if s.parse::().unwrap() != 42 { | ^^^^^^^^^^^^^^^^^^^^^^^^^ -43 | panic!("{:?}", s); +45 | panic!("{:?}", s); | ^^^^^^^^^^^^^^^^^^ = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) error: consider implementing `TryFrom` instead - --> $DIR/fallible_impl_from.rs:55:1 + --> $DIR/fallible_impl_from.rs:57:1 | -55 | / impl<'a> From<&'a mut as ProjStrTrait>::ProjString> for Invalid { -56 | | fn from(s: &'a mut as ProjStrTrait>::ProjString) -> Invalid { -57 | | if s.parse::().ok().unwrap() != 42 { -58 | | panic!("{:?}", s); +57 | / impl<'a> From<&'a mut as ProjStrTrait>::ProjString> for Invalid { +58 | | fn from(s: &'a mut as ProjStrTrait>::ProjString) -> Invalid { +59 | | if s.parse::().ok().unwrap() != 42 { +60 | | panic!("{:?}", s); ... | -61 | | } -62 | | } +63 | | } +64 | | } | |_^ | = help: `From` is intended for infallible conversions only. Use `TryFrom` if there's a possibility for the conversion to fail. note: potential failure(s) - --> $DIR/fallible_impl_from.rs:57:12 + --> $DIR/fallible_impl_from.rs:59:12 | -57 | if s.parse::().ok().unwrap() != 42 { +59 | if s.parse::().ok().unwrap() != 42 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -58 | panic!("{:?}", s); +60 | panic!("{:?}", s); | ^^^^^^^^^^^^^^^^^^ = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) diff --git a/tests/ui/filter_methods.stderr b/tests/ui/filter_methods.stderr index cec03a47b..1fde70601 100644 --- a/tests/ui/filter_methods.stderr +++ b/tests/ui/filter_methods.stderr @@ -7,7 +7,7 @@ error: called `filter(p).map(q)` on an `Iterator`. This is more succinctly expre 10 | | .map(|x| x * 2) | |_____________________________________________^ | - = note: `-D filter-map` implied by `-D warnings` + = note: `-D clippy::filter-map` implied by `-D warnings` error: called `filter(p).flat_map(q)` on an `Iterator`. This is more succinctly expressed by calling `.flat_map(..)` and filtering by returning an empty Iterator. --> $DIR/filter_methods.rs:13:21 diff --git a/tests/ui/float_cmp.stderr b/tests/ui/float_cmp.stderr index df404a1ee..598ebf336 100644 --- a/tests/ui/float_cmp.stderr +++ b/tests/ui/float_cmp.stderr @@ -4,7 +4,7 @@ error: strict comparison of f32 or f64 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: `-D clippy::float-cmp` implied by `-D warnings` note: std::f32::EPSILON and std::f64::EPSILON are available. --> $DIR/float_cmp.rs:49:5 | diff --git a/tests/ui/float_cmp_const.stderr b/tests/ui/float_cmp_const.stderr index 6367ec73c..140839795 100644 --- a/tests/ui/float_cmp_const.stderr +++ b/tests/ui/float_cmp_const.stderr @@ -4,7 +4,7 @@ error: strict comparison of f32 or f64 constant 17 | 1f32 == ONE; | ^^^^^^^^^^^ help: consider comparing them within some error: `(1f32 - ONE).abs() < error` | - = note: `-D float-cmp-const` implied by `-D warnings` + = note: `-D clippy::float-cmp-const` implied by `-D warnings` note: std::f32::EPSILON and std::f64::EPSILON are available. --> $DIR/float_cmp_const.rs:17:5 | diff --git a/tests/ui/for_loop.stderr b/tests/ui/for_loop.stderr index 582ca84b1..732dc2ab4 100644 --- a/tests/ui/for_loop.stderr +++ b/tests/ui/for_loop.stderr @@ -4,7 +4,7 @@ error: for loop over `option`, which is an `Option`. This is more readably writt 17 | for x in option { | ^^^^^^ | - = note: `-D for-loop-over-option` implied by `-D warnings` + = note: `-D clippy::for-loop-over-option` implied by `-D warnings` = 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. @@ -13,7 +13,7 @@ error: for loop over `result`, which is a `Result`. This is more readably writte 22 | for x in result { | ^^^^^^ | - = note: `-D for-loop-over-result` implied by `-D warnings` + = note: `-D clippy::for-loop-over-result` implied by `-D warnings` = 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. @@ -30,7 +30,7 @@ error: you are iterating over `Iterator::next()` which is an Option; this will c 32 | for x in v.iter().next() { | ^^^^^^^^^^^^^^^ | - = note: `-D iter-next-loop` implied by `-D warnings` + = note: `-D clippy::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. --> $DIR/for_loop.rs:37:14 @@ -57,7 +57,7 @@ error: this loop never actually loops 56 | | } | |_____^ | - = note: `-D never-loop` implied by `-D warnings` + = note: `-D clippy::never-loop` implied by `-D warnings` error: this loop never actually loops --> $DIR/for_loop.rs:59:5 @@ -74,7 +74,7 @@ error: the loop variable `i` is only used to index `vec`. 86 | for i in 0..vec.len() { | ^^^^^^^^^^^^ | - = note: `-D needless-range-loop` implied by `-D warnings` + = note: `-D clippy::needless-range-loop` implied by `-D warnings` help: consider using an iterator | 86 | for in &vec { @@ -206,7 +206,7 @@ error: this range is empty so this for loop will never run 148 | for i in 10..0 { | ^^^^^ | - = note: `-D reverse-range-loop` implied by `-D warnings` + = note: `-D clippy::reverse-range-loop` implied by `-D warnings` help: consider using the following if you are attempting to iterate over this range in reverse | 148 | for i in (0..10).rev() { @@ -270,7 +270,7 @@ error: it is more idiomatic to loop over references to containers instead of usi 215 | for _v in vec.iter() {} | ^^^^^^^^^^ help: to write this more concisely, try: `&vec` | - = note: `-D explicit-iter-loop` implied by `-D warnings` + = note: `-D clippy::explicit-iter-loop` implied by `-D warnings` error: it is more idiomatic to loop over references to containers instead of using explicit iteration methods --> $DIR/for_loop.rs:217:15 @@ -284,7 +284,7 @@ error: it is more idiomatic to loop over containers instead of using explicit it 220 | for _v in out_vec.into_iter() {} | ^^^^^^^^^^^^^^^^^^^ help: to write this more concisely, try: `out_vec` | - = note: `-D explicit-into-iter-loop` implied by `-D warnings` + = note: `-D clippy::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 --> $DIR/for_loop.rs:223:15 @@ -358,7 +358,7 @@ error: you are collect()ing an iterator and throwing away the result. Consider u 264 | vec.iter().cloned().map(|x| out.push(x)).collect::>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: `-D unused-collect` implied by `-D warnings` + = note: `-D clippy::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 --> $DIR/for_loop.rs:269:15 @@ -366,7 +366,7 @@ error: the variable `_index` is used as a loop counter. Consider using `for (_in 269 | for _v in &vec { | ^^^^ | - = note: `-D explicit-counter-loop` implied by `-D warnings` + = note: `-D clippy::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 --> $DIR/for_loop.rs:275:15 @@ -380,7 +380,7 @@ error: you seem to want to iterate on a map's values 385 | for (_, v) in &m { | ^^ | - = note: `-D for-kv-map` implied by `-D warnings` + = note: `-D clippy::for-kv-map` implied by `-D warnings` help: use the corresponding method | 385 | for v in m.values() { @@ -432,7 +432,7 @@ error: it looks like you're manually copying between slices 462 | for i in 0..src.len() { | ^^^^^^^^^^^^ help: try replacing the loop by: `dst[..src.len()].clone_from_slice(&src[..])` | - = note: `-D manual-memcpy` implied by `-D warnings` + = note: `-D clippy::manual-memcpy` implied by `-D warnings` error: it looks like you're manually copying between slices --> $DIR/for_loop.rs:467:14 diff --git a/tests/ui/format.stderr b/tests/ui/format.stderr index fa5c740c5..ca6ef9053 100644 --- a/tests/ui/format.stderr +++ b/tests/ui/format.stderr @@ -4,7 +4,7 @@ error: useless use of `format!` 12 | format!("foo"); | ^^^^^^^^^^^^^^^ help: consider using .to_string(): `"foo".to_string()` | - = note: `-D useless-format` implied by `-D warnings` + = note: `-D clippy::useless-format` implied by `-D warnings` error: useless use of `format!` --> $DIR/format.rs:14:5 diff --git a/tests/ui/formatting.stderr b/tests/ui/formatting.stderr index 266de262e..d9fee7366 100644 --- a/tests/ui/formatting.stderr +++ b/tests/ui/formatting.stderr @@ -4,7 +4,7 @@ error: this looks like an `else if` but the `else` is missing 15 | } if foo() { | ^ | - = note: `-D suspicious-else-formatting` implied by `-D warnings` + = note: `-D clippy::suspicious-else-formatting` implied by `-D warnings` = note: to remove this lint, add the missing `else` or add a new line before the second `if` error: this looks like an `else if` but the `else` is missing @@ -50,7 +50,7 @@ error: this looks like you are trying to use `.. -= ..`, but you really are doin 71 | a =- 35; | ^^^^ | - = note: `-D suspicious-assignment-formatting` implied by `-D warnings` + = note: `-D clippy::suspicious-assignment-formatting` implied by `-D warnings` = note: to remove this lint, use either `-=` or `= -` error: this looks like you are trying to use `.. *= ..`, but you really are doing `.. = (* ..)` @@ -75,7 +75,7 @@ error: possibly missing a comma here 84 | -1, -2, -3 // <= no comma here | ^ | - = note: `-D possible-missing-comma` implied by `-D warnings` + = note: `-D clippy::possible-missing-comma` implied by `-D warnings` = note: to remove this lint, add a comma or write the expr in a single line error: possibly missing a comma here diff --git a/tests/ui/functions.stderr b/tests/ui/functions.stderr index 0a9774895..c2f7b76aa 100644 --- a/tests/ui/functions.stderr +++ b/tests/ui/functions.stderr @@ -5,7 +5,7 @@ error: this function has too many arguments (8/7) 12 | | } | |_^ | - = note: `-D too-many-arguments` implied by `-D warnings` + = note: `-D clippy::too-many-arguments` implied by `-D warnings` error: this function has too many arguments (8/7) --> $DIR/functions.rs:19:5 @@ -25,7 +25,7 @@ error: this public function dereferences a raw pointer but is not marked `unsafe 37 | println!("{}", unsafe { *p }); | ^ | - = note: `-D not-unsafe-ptr-arg-deref` implied by `-D warnings` + = note: `-D clippy::not-unsafe-ptr-arg-deref` implied by `-D warnings` error: this public function dereferences a raw pointer but is not marked `unsafe` --> $DIR/functions.rs:38:35 diff --git a/tests/ui/fxhash.stderr b/tests/ui/fxhash.stderr index 5e90f84f1..869a315c9 100644 --- a/tests/ui/fxhash.stderr +++ b/tests/ui/fxhash.stderr @@ -1,39 +1,39 @@ error: Prefer FxHashMap over HashMap, it has better performance and we don't need any collision prevention in clippy - --> $DIR/fxhash.rs:6:24 + --> $DIR/fxhash.rs:8:24 | -6 | use std::collections::{HashMap, HashSet}; +8 | use std::collections::{HashMap, HashSet}; | ^^^^^^^ help: use: `FxHashMap` | - = note: `-D default-hash-types` implied by `-D warnings` + = note: `-D clippy::default-hash-types` implied by `-D warnings` error: Prefer FxHashSet over HashSet, it has better performance and we don't need any collision prevention in clippy - --> $DIR/fxhash.rs:6:33 + --> $DIR/fxhash.rs:8:33 | -6 | use std::collections::{HashMap, HashSet}; +8 | use std::collections::{HashMap, HashSet}; | ^^^^^^^ help: use: `FxHashSet` error: Prefer FxHashMap over HashMap, it has better performance and we don't need any collision prevention in clippy - --> $DIR/fxhash.rs:10:15 + --> $DIR/fxhash.rs:12:15 | -10 | let _map: HashMap = HashMap::default(); +12 | let _map: HashMap = HashMap::default(); | ^^^^^^^ help: use: `FxHashMap` error: Prefer FxHashMap over HashMap, it has better performance and we don't need any collision prevention in clippy - --> $DIR/fxhash.rs:10:41 + --> $DIR/fxhash.rs:12:41 | -10 | let _map: HashMap = HashMap::default(); +12 | let _map: HashMap = HashMap::default(); | ^^^^^^^ help: use: `FxHashMap` error: Prefer FxHashSet over HashSet, it has better performance and we don't need any collision prevention in clippy - --> $DIR/fxhash.rs:11:15 + --> $DIR/fxhash.rs:13:15 | -11 | let _set: HashSet = HashSet::default(); +13 | let _set: HashSet = HashSet::default(); | ^^^^^^^ help: use: `FxHashSet` error: Prefer FxHashSet over HashSet, it has better performance and we don't need any collision prevention in clippy - --> $DIR/fxhash.rs:11:33 + --> $DIR/fxhash.rs:13:33 | -11 | let _set: HashSet = HashSet::default(); +13 | let _set: HashSet = HashSet::default(); | ^^^^^^^ help: use: `FxHashSet` error: aborting due to 6 previous errors diff --git a/tests/ui/get_unwrap.stderr b/tests/ui/get_unwrap.stderr index b5ada8625..63f6603c8 100644 --- a/tests/ui/get_unwrap.stderr +++ b/tests/ui/get_unwrap.stderr @@ -4,7 +4,7 @@ error: called `.get().unwrap()` on a slice. Using `[]` is more clear and more co 27 | let _ = boxed_slice.get(1).unwrap(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `&boxed_slice[1]` | - = note: `-D get-unwrap` implied by `-D warnings` + = note: `-D clippy::get-unwrap` implied by `-D warnings` error: called `.get().unwrap()` on a slice. Using `[]` is more clear and more concise --> $DIR/get_unwrap.rs:28:17 diff --git a/tests/ui/identity_conversion.stderr b/tests/ui/identity_conversion.stderr index 7083b96e1..ffcd3649a 100644 --- a/tests/ui/identity_conversion.stderr +++ b/tests/ui/identity_conversion.stderr @@ -1,61 +1,61 @@ error: identical conversion - --> $DIR/identity_conversion.rs:4:13 + --> $DIR/identity_conversion.rs:6:13 | -4 | let _ = T::from(val); +6 | let _ = T::from(val); | ^^^^^^^^^^^^ help: consider removing `T::from()`: `val` | note: lint level defined here - --> $DIR/identity_conversion.rs:1:9 + --> $DIR/identity_conversion.rs:3:9 | -1 | #![deny(identity_conversion)] - | ^^^^^^^^^^^^^^^^^^^ +3 | #![deny(clippy::identity_conversion)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: identical conversion - --> $DIR/identity_conversion.rs:5:5 + --> $DIR/identity_conversion.rs:7:5 | -5 | val.into() +7 | val.into() | ^^^^^^^^^^ help: consider removing `.into()`: `val` error: identical conversion - --> $DIR/identity_conversion.rs:17:22 + --> $DIR/identity_conversion.rs:19:22 | -17 | let _: i32 = 0i32.into(); +19 | let _: i32 = 0i32.into(); | ^^^^^^^^^^^ help: consider removing `.into()`: `0i32` error: identical conversion - --> $DIR/identity_conversion.rs:38:21 + --> $DIR/identity_conversion.rs:40:21 | -38 | let _: String = "foo".to_string().into(); +40 | let _: String = "foo".to_string().into(); | ^^^^^^^^^^^^^^^^^^^^^^^^ help: consider removing `.into()`: `"foo".to_string()` error: identical conversion - --> $DIR/identity_conversion.rs:39:21 + --> $DIR/identity_conversion.rs:41:21 | -39 | let _: String = From::from("foo".to_string()); +41 | let _: String = From::from("foo".to_string()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider removing `From::from()`: `"foo".to_string()` -error: identical conversion - --> $DIR/identity_conversion.rs:40:13 - | -40 | let _ = String::from("foo".to_string()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider removing `String::from()`: `"foo".to_string()` - -error: identical conversion - --> $DIR/identity_conversion.rs:41:13 - | -41 | let _ = String::from(format!("A: {:04}", 123)); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider removing `String::from()`: `format!("A: {:04}", 123)` - error: identical conversion --> $DIR/identity_conversion.rs:42:13 | -42 | let _ = "".lines().into_iter(); - | ^^^^^^^^^^^^^^^^^^^^^^ help: consider removing `.into_iter()`: `"".lines()` +42 | let _ = String::from("foo".to_string()); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider removing `String::from()`: `"foo".to_string()` error: identical conversion --> $DIR/identity_conversion.rs:43:13 | -43 | let _ = vec![1, 2, 3].into_iter().into_iter(); +43 | let _ = String::from(format!("A: {:04}", 123)); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider removing `String::from()`: `format!("A: {:04}", 123)` + +error: identical conversion + --> $DIR/identity_conversion.rs:44:13 + | +44 | let _ = "".lines().into_iter(); + | ^^^^^^^^^^^^^^^^^^^^^^ help: consider removing `.into_iter()`: `"".lines()` + +error: identical conversion + --> $DIR/identity_conversion.rs:45:13 + | +45 | let _ = vec![1, 2, 3].into_iter().into_iter(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider removing `.into_iter()`: `vec![1, 2, 3].into_iter()` error: aborting due to 9 previous errors diff --git a/tests/ui/identity_op.stderr b/tests/ui/identity_op.stderr index 45f579ce8..e494250c0 100644 --- a/tests/ui/identity_op.stderr +++ b/tests/ui/identity_op.stderr @@ -4,7 +4,7 @@ error: the operation is ineffective. Consider reducing it to `x` 13 | x + 0; | ^^^^^ | - = note: `-D identity-op` implied by `-D warnings` + = note: `-D clippy::identity-op` implied by `-D warnings` error: the operation is ineffective. Consider reducing it to `x` --> $DIR/identity_op.rs:14:5 diff --git a/tests/ui/if_let_redundant_pattern_matching.stderr b/tests/ui/if_let_redundant_pattern_matching.stderr index e7bfd0275..904662585 100644 --- a/tests/ui/if_let_redundant_pattern_matching.stderr +++ b/tests/ui/if_let_redundant_pattern_matching.stderr @@ -4,7 +4,7 @@ error: redundant pattern matching, consider using `is_ok()` 9 | if let Ok(_) = Ok::(42) {} | -------^^^^^--------------------- help: try this: `if Ok::(42).is_ok()` | - = note: `-D if-let-redundant-pattern-matching` implied by `-D warnings` + = note: `-D clippy::if-let-redundant-pattern-matching` implied by `-D warnings` error: redundant pattern matching, consider using `is_err()` --> $DIR/if_let_redundant_pattern_matching.rs:11:12 diff --git a/tests/ui/if_not_else.stderr b/tests/ui/if_not_else.stderr index b920ef3b6..9682f6dc1 100644 --- a/tests/ui/if_not_else.stderr +++ b/tests/ui/if_not_else.stderr @@ -8,7 +8,7 @@ error: Unnecessary boolean `not` operation 13 | | } | |_____^ | - = note: `-D if-not-else` implied by `-D warnings` + = note: `-D clippy::if-not-else` implied by `-D warnings` = help: remove the `!` and swap the blocks of the if/else error: Unnecessary `!=` operation diff --git a/tests/ui/impl.stderr b/tests/ui/impl.stderr index 95e627cd5..13d4a7655 100644 --- a/tests/ui/impl.stderr +++ b/tests/ui/impl.stderr @@ -1,34 +1,34 @@ error: Multiple implementations of this structure - --> $DIR/impl.rs:10:1 + --> $DIR/impl.rs:12:1 | -10 | / impl MyStruct { -11 | | fn second() {} -12 | | } +12 | / impl MyStruct { +13 | | fn second() {} +14 | | } | |_^ | - = note: `-D multiple-inherent-impl` implied by `-D warnings` + = note: `-D clippy::multiple-inherent-impl` implied by `-D warnings` note: First implementation here - --> $DIR/impl.rs:6:1 + --> $DIR/impl.rs:8:1 | -6 | / impl MyStruct { -7 | | fn first() {} -8 | | } +8 | / impl MyStruct { +9 | | fn first() {} +10 | | } | |_^ error: Multiple implementations of this structure - --> $DIR/impl.rs:24:5 + --> $DIR/impl.rs:26:5 | -24 | / impl super::MyStruct { -25 | | fn third() {} -26 | | } +26 | / impl super::MyStruct { +27 | | fn third() {} +28 | | } | |_____^ | note: First implementation here - --> $DIR/impl.rs:6:1 + --> $DIR/impl.rs:8:1 | -6 | / impl MyStruct { -7 | | fn first() {} -8 | | } +8 | / impl MyStruct { +9 | | fn first() {} +10 | | } | |_^ error: aborting due to 2 previous errors diff --git a/tests/ui/implicit_hasher.stderr b/tests/ui/implicit_hasher.stderr index f41ce4051..5bb6f11b2 100644 --- a/tests/ui/implicit_hasher.stderr +++ b/tests/ui/implicit_hasher.stderr @@ -4,7 +4,7 @@ error: impl for `HashMap` should be generalized over different hashers 11 | impl Foo for HashMap { | ^^^^^^^^^^^^^ | - = note: `-D implicit-hasher` implied by `-D warnings` + = note: `-D clippy::implicit-hasher` implied by `-D warnings` help: consider adding a type parameter | 11 | impl Foo for HashMap { diff --git a/tests/ui/inconsistent_digit_grouping.stderr b/tests/ui/inconsistent_digit_grouping.stderr index 4d30529d8..51eeca2b8 100644 --- a/tests/ui/inconsistent_digit_grouping.stderr +++ b/tests/ui/inconsistent_digit_grouping.stderr @@ -4,7 +4,7 @@ error: digits grouped inconsistently by underscores 7 | let bad = (1_23_456, 1_234_5678, 1234_567, 1_234.5678_f32, 1.234_5678_f32); | ^^^^^^^^ help: consider: `123_456` | - = note: `-D inconsistent-digit-grouping` implied by `-D warnings` + = note: `-D clippy::inconsistent-digit-grouping` implied by `-D warnings` error: digits grouped inconsistently by underscores --> $DIR/inconsistent_digit_grouping.rs:7:26 diff --git a/tests/ui/indexing_slicing.stderr b/tests/ui/indexing_slicing.stderr index ee11dce6d..3f09a6516 100644 --- a/tests/ui/indexing_slicing.stderr +++ b/tests/ui/indexing_slicing.stderr @@ -1,268 +1,268 @@ error: indexing may panic. - --> $DIR/indexing_slicing.rs:11:5 + --> $DIR/indexing_slicing.rs:13:5 | -11 | x[index]; +13 | x[index]; | ^^^^^^^^ | - = note: `-D indexing-slicing` implied by `-D warnings` + = note: `-D clippy::indexing-slicing` implied by `-D warnings` = help: Consider using `.get(n)` or `.get_mut(n)` instead error: slicing may panic. - --> $DIR/indexing_slicing.rs:12:6 + --> $DIR/indexing_slicing.rs:14:6 | -12 | &x[index..]; +14 | &x[index..]; | ^^^^^^^^^^ | = help: Consider using `.get(n..)` or .get_mut(n..)` instead error: slicing may panic. - --> $DIR/indexing_slicing.rs:13:6 + --> $DIR/indexing_slicing.rs:15:6 | -13 | &x[..index]; +15 | &x[..index]; | ^^^^^^^^^^ | = help: Consider using `.get(..n)`or `.get_mut(..n)` instead error: slicing may panic. - --> $DIR/indexing_slicing.rs:14:6 + --> $DIR/indexing_slicing.rs:16:6 | -14 | &x[index_from..index_to]; +16 | &x[index_from..index_to]; | ^^^^^^^^^^^^^^^^^^^^^^^ | = help: Consider using `.get(n..m)` or `.get_mut(n..m)` instead error: slicing may panic. - --> $DIR/indexing_slicing.rs:15:6 + --> $DIR/indexing_slicing.rs:17:6 | -15 | &x[index_from..][..index_to]; // Two lint reports, one for [index_from..] and another for [..index_to]. +17 | &x[index_from..][..index_to]; // Two lint reports, one for [index_from..] and another for [..index_to]. | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: Consider using `.get(..n)`or `.get_mut(..n)` instead error: slicing may panic. - --> $DIR/indexing_slicing.rs:15:6 + --> $DIR/indexing_slicing.rs:17:6 | -15 | &x[index_from..][..index_to]; // Two lint reports, one for [index_from..] and another for [..index_to]. +17 | &x[index_from..][..index_to]; // Two lint reports, one for [index_from..] and another for [..index_to]. | ^^^^^^^^^^^^^^^ | = help: Consider using `.get(n..)` or .get_mut(n..)` instead error: range is out of bounds - --> $DIR/indexing_slicing.rs:18:6 + --> $DIR/indexing_slicing.rs:20:6 | -18 | &x[..=4]; +20 | &x[..=4]; | ^^^^^^^ | - = note: `-D out-of-bounds-indexing` implied by `-D warnings` + = note: `-D clippy::out-of-bounds-indexing` implied by `-D warnings` error: range is out of bounds - --> $DIR/indexing_slicing.rs:19:6 + --> $DIR/indexing_slicing.rs:21:6 | -19 | &x[1..5]; +21 | &x[1..5]; | ^^^^^^^ error: slicing may panic. - --> $DIR/indexing_slicing.rs:20:6 + --> $DIR/indexing_slicing.rs:22:6 | -20 | &x[5..][..10]; // Two lint reports, one for [5..] and another for [..10]. +22 | &x[5..][..10]; // Two lint reports, one for [5..] and another for [..10]. | ^^^^^^^^^^^^ | = help: Consider using `.get(..n)`or `.get_mut(..n)` instead -error: range is out of bounds - --> $DIR/indexing_slicing.rs:20:6 - | -20 | &x[5..][..10]; // Two lint reports, one for [5..] and another for [..10]. - | ^^^^^^ - -error: range is out of bounds - --> $DIR/indexing_slicing.rs:21:6 - | -21 | &x[5..]; - | ^^^^^^ - error: range is out of bounds --> $DIR/indexing_slicing.rs:22:6 | -22 | &x[..5]; +22 | &x[5..][..10]; // Two lint reports, one for [5..] and another for [..10]. | ^^^^^^ error: range is out of bounds --> $DIR/indexing_slicing.rs:23:6 | -23 | &x[5..].iter().map(|x| 2 * x).collect::>(); +23 | &x[5..]; | ^^^^^^ error: range is out of bounds --> $DIR/indexing_slicing.rs:24:6 | -24 | &x[0..=4]; +24 | &x[..5]; + | ^^^^^^ + +error: range is out of bounds + --> $DIR/indexing_slicing.rs:25:6 + | +25 | &x[5..].iter().map(|x| 2 * x).collect::>(); + | ^^^^^^ + +error: range is out of bounds + --> $DIR/indexing_slicing.rs:26:6 + | +26 | &x[0..=4]; | ^^^^^^^^ error: slicing may panic. - --> $DIR/indexing_slicing.rs:25:6 + --> $DIR/indexing_slicing.rs:27:6 | -25 | &x[0..][..3]; +27 | &x[0..][..3]; | ^^^^^^^^^^^ | = help: Consider using `.get(..n)`or `.get_mut(..n)` instead error: slicing may panic. - --> $DIR/indexing_slicing.rs:26:6 + --> $DIR/indexing_slicing.rs:28:6 | -26 | &x[1..][..5]; +28 | &x[1..][..5]; | ^^^^^^^^^^^ | = help: Consider using `.get(..n)`or `.get_mut(..n)` instead error: indexing may panic. - --> $DIR/indexing_slicing.rs:39:5 + --> $DIR/indexing_slicing.rs:41:5 | -39 | y[0]; +41 | y[0]; | ^^^^ | = help: Consider using `.get(n)` or `.get_mut(n)` instead error: slicing may panic. - --> $DIR/indexing_slicing.rs:40:6 + --> $DIR/indexing_slicing.rs:42:6 | -40 | &y[1..2]; +42 | &y[1..2]; | ^^^^^^^ | = help: Consider using `.get(n..m)` or `.get_mut(n..m)` instead error: slicing may panic. - --> $DIR/indexing_slicing.rs:41:6 + --> $DIR/indexing_slicing.rs:43:6 | -41 | &y[0..=4]; +43 | &y[0..=4]; | ^^^^^^^^ | = help: Consider using `.get(n..m)` or `.get_mut(n..m)` instead error: slicing may panic. - --> $DIR/indexing_slicing.rs:42:6 + --> $DIR/indexing_slicing.rs:44:6 | -42 | &y[..=4]; +44 | &y[..=4]; | ^^^^^^^ | = help: Consider using `.get(..n)`or `.get_mut(..n)` instead -error: range is out of bounds - --> $DIR/indexing_slicing.rs:48:6 - | -48 | &empty[1..5]; - | ^^^^^^^^^^^ - -error: range is out of bounds - --> $DIR/indexing_slicing.rs:49:6 - | -49 | &empty[0..=4]; - | ^^^^^^^^^^^^ - error: range is out of bounds --> $DIR/indexing_slicing.rs:50:6 | -50 | &empty[..=4]; +50 | &empty[1..5]; | ^^^^^^^^^^^ error: range is out of bounds --> $DIR/indexing_slicing.rs:51:6 | -51 | &empty[1..]; - | ^^^^^^^^^^ +51 | &empty[0..=4]; + | ^^^^^^^^^^^^ error: range is out of bounds --> $DIR/indexing_slicing.rs:52:6 | -52 | &empty[..4]; - | ^^^^^^^^^^ +52 | &empty[..=4]; + | ^^^^^^^^^^^ error: range is out of bounds --> $DIR/indexing_slicing.rs:53:6 | -53 | &empty[0..=0]; - | ^^^^^^^^^^^^ +53 | &empty[1..]; + | ^^^^^^^^^^ error: range is out of bounds --> $DIR/indexing_slicing.rs:54:6 | -54 | &empty[..=0]; +54 | &empty[..4]; + | ^^^^^^^^^^ + +error: range is out of bounds + --> $DIR/indexing_slicing.rs:55:6 + | +55 | &empty[0..=0]; + | ^^^^^^^^^^^^ + +error: range is out of bounds + --> $DIR/indexing_slicing.rs:56:6 + | +56 | &empty[..=0]; | ^^^^^^^^^^^ error: indexing may panic. - --> $DIR/indexing_slicing.rs:62:5 + --> $DIR/indexing_slicing.rs:64:5 | -62 | v[0]; +64 | v[0]; | ^^^^ | = help: Consider using `.get(n)` or `.get_mut(n)` instead error: indexing may panic. - --> $DIR/indexing_slicing.rs:63:5 + --> $DIR/indexing_slicing.rs:65:5 | -63 | v[10]; +65 | v[10]; | ^^^^^ | = help: Consider using `.get(n)` or `.get_mut(n)` instead error: indexing may panic. - --> $DIR/indexing_slicing.rs:64:5 + --> $DIR/indexing_slicing.rs:66:5 | -64 | v[1 << 3]; +66 | v[1 << 3]; | ^^^^^^^^^ | = help: Consider using `.get(n)` or `.get_mut(n)` instead error: slicing may panic. - --> $DIR/indexing_slicing.rs:65:6 + --> $DIR/indexing_slicing.rs:67:6 | -65 | &v[10..100]; +67 | &v[10..100]; | ^^^^^^^^^^ | = help: Consider using `.get(n..m)` or `.get_mut(n..m)` instead error: slicing may panic. - --> $DIR/indexing_slicing.rs:66:6 + --> $DIR/indexing_slicing.rs:68:6 | -66 | &x[10..][..100]; // Two lint reports, one for [10..] and another for [..100]. +68 | &x[10..][..100]; // Two lint reports, one for [10..] and another for [..100]. | ^^^^^^^^^^^^^^ | = help: Consider using `.get(..n)`or `.get_mut(..n)` instead error: range is out of bounds - --> $DIR/indexing_slicing.rs:66:6 + --> $DIR/indexing_slicing.rs:68:6 | -66 | &x[10..][..100]; // Two lint reports, one for [10..] and another for [..100]. +68 | &x[10..][..100]; // Two lint reports, one for [10..] and another for [..100]. | ^^^^^^^ error: slicing may panic. - --> $DIR/indexing_slicing.rs:67:6 + --> $DIR/indexing_slicing.rs:69:6 | -67 | &v[10..]; +69 | &v[10..]; | ^^^^^^^ | = help: Consider using `.get(n..)` or .get_mut(n..)` instead error: slicing may panic. - --> $DIR/indexing_slicing.rs:68:6 + --> $DIR/indexing_slicing.rs:70:6 | -68 | &v[..100]; +70 | &v[..100]; | ^^^^^^^^ | = help: Consider using `.get(..n)`or `.get_mut(..n)` instead error: indexing may panic. - --> $DIR/indexing_slicing.rs:80:5 + --> $DIR/indexing_slicing.rs:82:5 | -80 | v[N]; +82 | v[N]; | ^^^^ | = help: Consider using `.get(n)` or `.get_mut(n)` instead error: indexing may panic. - --> $DIR/indexing_slicing.rs:81:5 + --> $DIR/indexing_slicing.rs:83:5 | -81 | v[M]; +83 | v[M]; | ^^^^ | = help: Consider using `.get(n)` or `.get_mut(n)` instead diff --git a/tests/ui/infallible_destructuring_match.stderr b/tests/ui/infallible_destructuring_match.stderr index 8ee73bbfd..6e26741fc 100644 --- a/tests/ui/infallible_destructuring_match.stderr +++ b/tests/ui/infallible_destructuring_match.stderr @@ -1,27 +1,27 @@ error: you seem to be trying to use match to destructure a single infallible pattern. Consider using `let` - --> $DIR/infallible_destructuring_match.rs:16:5 + --> $DIR/infallible_destructuring_match.rs:18:5 | -16 | / let data = match wrapper { -17 | | SingleVariantEnum::Variant(i) => i, -18 | | }; +18 | / let data = match wrapper { +19 | | SingleVariantEnum::Variant(i) => i, +20 | | }; | |______^ help: try this: `let SingleVariantEnum::Variant(data) = wrapper;` | - = note: `-D infallible-destructuring-match` implied by `-D warnings` + = note: `-D clippy::infallible-destructuring-match` implied by `-D warnings` error: you seem to be trying to use match to destructure a single infallible pattern. Consider using `let` - --> $DIR/infallible_destructuring_match.rs:37:5 + --> $DIR/infallible_destructuring_match.rs:39:5 | -37 | / let data = match wrapper { -38 | | TupleStruct(i) => i, -39 | | }; +39 | / let data = match wrapper { +40 | | TupleStruct(i) => i, +41 | | }; | |______^ help: try this: `let TupleStruct(data) = wrapper;` error: you seem to be trying to use match to destructure a single infallible pattern. Consider using `let` - --> $DIR/infallible_destructuring_match.rs:58:5 + --> $DIR/infallible_destructuring_match.rs:60:5 | -58 | / let data = match wrapper { -59 | | Ok(i) => i, -60 | | }; +60 | / let data = match wrapper { +61 | | Ok(i) => i, +62 | | }; | |______^ help: try this: `let Ok(data) = wrapper;` error: aborting due to 3 previous errors diff --git a/tests/ui/infinite_iter.stderr b/tests/ui/infinite_iter.stderr index f79db7784..c3d67bdfd 100644 --- a/tests/ui/infinite_iter.stderr +++ b/tests/ui/infinite_iter.stderr @@ -4,7 +4,7 @@ error: you are collect()ing an iterator and throwing away the result. Consider u 10 | repeat(0_u8).collect::>(); // infinite iter | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: `-D unused-collect` implied by `-D warnings` + = note: `-D clippy::unused-collect` implied by `-D warnings` error: infinite iteration detected --> $DIR/infinite_iter.rs:10:5 @@ -15,8 +15,8 @@ error: infinite iteration detected note: lint level defined here --> $DIR/infinite_iter.rs:8:8 | -8 | #[deny(infinite_iter)] - | ^^^^^^^^^^^^^ +8 | #[deny(clippy::infinite_iter)] + | ^^^^^^^^^^^^^^^^^^^^^ error: infinite iteration detected --> $DIR/infinite_iter.rs:11:5 @@ -57,8 +57,8 @@ error: possible infinite iteration detected note: lint level defined here --> $DIR/infinite_iter.rs:22:8 | -22 | #[deny(maybe_infinite_iter)] - | ^^^^^^^^^^^^^^^^^^^ +22 | #[deny(clippy::maybe_infinite_iter)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: possible infinite iteration detected --> $DIR/infinite_iter.rs:25:5 diff --git a/tests/ui/infinite_loop.stderr b/tests/ui/infinite_loop.stderr index 26ec9582f..edbe49374 100644 --- a/tests/ui/infinite_loop.stderr +++ b/tests/ui/infinite_loop.stderr @@ -1,57 +1,57 @@ error: Variable in the condition are not mutated in the loop body. This either leads to an infinite or to a never running loop. - --> $DIR/infinite_loop.rs:14:11 + --> $DIR/infinite_loop.rs:16:11 | -14 | while y < 10 { +16 | while y < 10 { | ^^^^^^ | - = note: #[deny(while_immutable_condition)] on by default + = note: #[deny(clippy::while_immutable_condition)] on by default error: Variable in the condition are not mutated in the loop body. This either leads to an infinite or to a never running loop. - --> $DIR/infinite_loop.rs:19:11 + --> $DIR/infinite_loop.rs:21:11 | -19 | while y < 10 && x < 3 { +21 | while y < 10 && x < 3 { | ^^^^^^^^^^^^^^^ error: Variable in the condition are not mutated in the loop body. This either leads to an infinite or to a never running loop. - --> $DIR/infinite_loop.rs:26:11 + --> $DIR/infinite_loop.rs:28:11 | -26 | while !cond { +28 | while !cond { | ^^^^^ error: Variable in the condition are not mutated in the loop body. This either leads to an infinite or to a never running loop. - --> $DIR/infinite_loop.rs:70:11 + --> $DIR/infinite_loop.rs:72:11 | -70 | while i < 3 { +72 | while i < 3 { | ^^^^^ error: Variable in the condition are not mutated in the loop body. This either leads to an infinite or to a never running loop. - --> $DIR/infinite_loop.rs:75:11 + --> $DIR/infinite_loop.rs:77:11 | -75 | while i < 3 && j > 0 { +77 | while i < 3 && j > 0 { | ^^^^^^^^^^^^^^ error: Variable in the condition are not mutated in the loop body. This either leads to an infinite or to a never running loop. - --> $DIR/infinite_loop.rs:79:11 + --> $DIR/infinite_loop.rs:81:11 | -79 | while i < 3 { +81 | while i < 3 { | ^^^^^ error: Variable in the condition are not mutated in the loop body. This either leads to an infinite or to a never running loop. - --> $DIR/infinite_loop.rs:94:11 + --> $DIR/infinite_loop.rs:96:11 | -94 | while i < 3 { +96 | while i < 3 { | ^^^^^ error: Variable in the condition are not mutated in the loop body. This either leads to an infinite or to a never running loop. - --> $DIR/infinite_loop.rs:99:11 - | -99 | while i < 3 { - | ^^^^^ - -error: Variable in the condition are not mutated in the loop body. This either leads to an infinite or to a never running loop. - --> $DIR/infinite_loop.rs:162:15 + --> $DIR/infinite_loop.rs:101:11 | -162 | while self.count < n { +101 | while i < 3 { + | ^^^^^ + +error: Variable in the condition are not mutated in the loop body. This either leads to an infinite or to a never running loop. + --> $DIR/infinite_loop.rs:164:15 + | +164 | while self.count < n { | ^^^^^^^^^^^^^^ error: aborting due to 9 previous errors diff --git a/tests/ui/inline_fn_without_body.stderr b/tests/ui/inline_fn_without_body.stderr index 2b466b686..a9a52b190 100644 --- a/tests/ui/inline_fn_without_body.stderr +++ b/tests/ui/inline_fn_without_body.stderr @@ -6,7 +6,7 @@ error: use of `#[inline]` on trait method `default_inline` which has no body 9 | | fn default_inline(); | |____- help: remove | - = note: `-D inline-fn-without-body` implied by `-D warnings` + = note: `-D clippy::inline-fn-without-body` implied by `-D warnings` error: use of `#[inline]` on trait method `always_inline` which has no body --> $DIR/inline_fn_without_body.rs:11:5 diff --git a/tests/ui/int_plus_one.stderr b/tests/ui/int_plus_one.stderr index deecaffa1..12d7000dc 100644 --- a/tests/ui/int_plus_one.stderr +++ b/tests/ui/int_plus_one.stderr @@ -4,7 +4,7 @@ error: Unnecessary `>= y + 1` or `x - 1 >=` 10 | x >= y + 1; | ^^^^^^^^^^ | - = note: `-D int-plus-one` implied by `-D warnings` + = note: `-D clippy::int-plus-one` implied by `-D warnings` help: change `>= y + 1` to `> y` as shown | 10 | x > y; diff --git a/tests/ui/invalid_ref.stderr b/tests/ui/invalid_ref.stderr index f84207385..1ca825dd9 100644 --- a/tests/ui/invalid_ref.stderr +++ b/tests/ui/invalid_ref.stderr @@ -4,7 +4,7 @@ error: reference to zeroed memory 27 | let ref_zero: &T = std::mem::zeroed(); // warning | ^^^^^^^^^^^^^^^^^^ | - = note: #[deny(invalid_ref)] on by default + = note: #[deny(clippy::invalid_ref)] on by default = help: Creation of a null reference is undefined behavior; see https://doc.rust-lang.org/reference/behavior-considered-undefined.html error: reference to zeroed memory diff --git a/tests/ui/invalid_upcast_comparisons.stderr b/tests/ui/invalid_upcast_comparisons.stderr index eb4680289..ce6d1dfa1 100644 --- a/tests/ui/invalid_upcast_comparisons.stderr +++ b/tests/ui/invalid_upcast_comparisons.stderr @@ -4,7 +4,7 @@ error: because of the numeric bounds on `u8` prior to casting, this expression i 16 | (u8 as u32) > 300; | ^^^^^^^^^^^^^^^^^ | - = note: `-D invalid-upcast-comparisons` implied by `-D warnings` + = note: `-D clippy::invalid-upcast-comparisons` implied by `-D warnings` error: because of the numeric bounds on `u8` prior to casting, this expression is always false --> $DIR/invalid_upcast_comparisons.rs:17:5 diff --git a/tests/ui/issue_2356.stderr b/tests/ui/issue_2356.stderr index 4b82a0a75..fe2d9d45b 100644 --- a/tests/ui/issue_2356.stderr +++ b/tests/ui/issue_2356.stderr @@ -1,14 +1,14 @@ error: this loop could be written as a `for` loop - --> $DIR/issue_2356.rs:15:29 + --> $DIR/issue_2356.rs:17:29 | -15 | while let Some(e) = it.next() { +17 | while let Some(e) = it.next() { | ^^^^^^^^^ help: try: `for e in it { .. }` | note: lint level defined here - --> $DIR/issue_2356.rs:1:9 + --> $DIR/issue_2356.rs:3:9 | -1 | #![deny(while_let_on_iterator)] - | ^^^^^^^^^^^^^^^^^^^^^ +3 | #![deny(clippy::while_let_on_iterator)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/tests/ui/item_after_statement.stderr b/tests/ui/item_after_statement.stderr index ec1296caf..6d20899b5 100644 --- a/tests/ui/item_after_statement.stderr +++ b/tests/ui/item_after_statement.stderr @@ -4,7 +4,7 @@ error: adding items after statements is confusing, since items exist from the st 12 | fn foo() { println!("foo"); } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: `-D items-after-statements` implied by `-D warnings` + = note: `-D clippy::items-after-statements` implied by `-D warnings` error: adding items after statements is confusing, since items exist from the start of the scope --> $DIR/item_after_statement.rs:17:5 diff --git a/tests/ui/large_digit_groups.stderr b/tests/ui/large_digit_groups.stderr index f2e6a62d1..b322ded9c 100644 --- a/tests/ui/large_digit_groups.stderr +++ b/tests/ui/large_digit_groups.stderr @@ -4,7 +4,7 @@ error: digit groups should be smaller 7 | let bad = (0b1_10110_i64, 0x1_23456_78901_usize, 1_23456_f32, 1_23456.12_f32, 1_23456.12345_f32, 1_23456.12345_6_f32); | ^^^^^^^^^^^^^ help: consider: `0b11_0110_i64` | - = note: `-D large-digit-groups` implied by `-D warnings` + = note: `-D clippy::large-digit-groups` implied by `-D warnings` error: digit groups should be smaller --> $DIR/large_digit_groups.rs:7:31 diff --git a/tests/ui/large_enum_variant.stderr b/tests/ui/large_enum_variant.stderr index 5e938337b..af42f9054 100644 --- a/tests/ui/large_enum_variant.stderr +++ b/tests/ui/large_enum_variant.stderr @@ -4,7 +4,7 @@ error: large size difference between variants 10 | B([i32; 8000]), | ^^^^^^^^^^^^^^ | - = note: `-D large-enum-variant` implied by `-D warnings` + = note: `-D clippy::large-enum-variant` implied by `-D warnings` help: consider boxing the large fields to reduce the total size of the enum | 10 | B(Box<[i32; 8000]>), diff --git a/tests/ui/len_zero.stderr b/tests/ui/len_zero.stderr index a04185bc6..49e365e6c 100644 --- a/tests/ui/len_zero.stderr +++ b/tests/ui/len_zero.stderr @@ -1,139 +1,139 @@ error: item `PubOne` has a public `len` method but no corresponding `is_empty` method - --> $DIR/len_zero.rs:6:1 + --> $DIR/len_zero.rs:8:1 | -6 | / impl PubOne { -7 | | pub fn len(self: &Self) -> isize { -8 | | 1 -9 | | } -10 | | } +8 | / impl PubOne { +9 | | pub fn len(self: &Self) -> isize { +10 | | 1 +11 | | } +12 | | } | |_^ | - = note: `-D len-without-is-empty` implied by `-D warnings` + = note: `-D clippy::len-without-is-empty` implied by `-D warnings` error: trait `PubTraitsToo` has a `len` method but no (possibly inherited) `is_empty` method - --> $DIR/len_zero.rs:55:1 + --> $DIR/len_zero.rs:57:1 | -55 | / pub trait PubTraitsToo { -56 | | fn len(self: &Self) -> isize; -57 | | } +57 | / pub trait PubTraitsToo { +58 | | fn len(self: &Self) -> isize; +59 | | } | |_^ error: item `HasIsEmpty` has a public `len` method but a private `is_empty` method - --> $DIR/len_zero.rs:89:1 + --> $DIR/len_zero.rs:91:1 | -89 | / impl HasIsEmpty { -90 | | pub fn len(self: &Self) -> isize { -91 | | 1 -92 | | } +91 | / impl HasIsEmpty { +92 | | pub fn len(self: &Self) -> isize { +93 | | 1 +94 | | } ... | -96 | | } -97 | | } +98 | | } +99 | | } | |_^ error: item `HasWrongIsEmpty` has a public `len` method but no corresponding `is_empty` method - --> $DIR/len_zero.rs:118:1 + --> $DIR/len_zero.rs:120:1 | -118 | / impl HasWrongIsEmpty { -119 | | pub fn len(self: &Self) -> isize { -120 | | 1 -121 | | } +120 | / impl HasWrongIsEmpty { +121 | | pub fn len(self: &Self) -> isize { +122 | | 1 +123 | | } ... | -125 | | } -126 | | } +127 | | } +128 | | } | |_^ error: length comparison to zero - --> $DIR/len_zero.rs:139:8 + --> $DIR/len_zero.rs:141:8 | -139 | if x.len() == 0 { +141 | if x.len() == 0 { | ^^^^^^^^^^^^ help: using `is_empty` is more concise: `x.is_empty()` | - = note: `-D len-zero` implied by `-D warnings` + = note: `-D clippy::len-zero` implied by `-D warnings` error: length comparison to zero - --> $DIR/len_zero.rs:143:8 + --> $DIR/len_zero.rs:145:8 | -143 | if "".len() == 0 {} +145 | if "".len() == 0 {} | ^^^^^^^^^^^^^ help: using `is_empty` is more concise: `"".is_empty()` error: length comparison to zero - --> $DIR/len_zero.rs:158:8 + --> $DIR/len_zero.rs:160:8 | -158 | if has_is_empty.len() == 0 { +160 | if has_is_empty.len() == 0 { | ^^^^^^^^^^^^^^^^^^^^^^^ help: using `is_empty` is more concise: `has_is_empty.is_empty()` error: length comparison to zero - --> $DIR/len_zero.rs:161:8 + --> $DIR/len_zero.rs:163:8 | -161 | if has_is_empty.len() != 0 { +163 | if has_is_empty.len() != 0 { | ^^^^^^^^^^^^^^^^^^^^^^^ help: using `is_empty` is more concise: `!has_is_empty.is_empty()` error: length comparison to zero - --> $DIR/len_zero.rs:164:8 + --> $DIR/len_zero.rs:166:8 | -164 | if has_is_empty.len() > 0 { +166 | if has_is_empty.len() > 0 { | ^^^^^^^^^^^^^^^^^^^^^^ help: using `is_empty` is more concise: `!has_is_empty.is_empty()` error: length comparison to one - --> $DIR/len_zero.rs:167:8 + --> $DIR/len_zero.rs:169:8 | -167 | if has_is_empty.len() < 1 { +169 | if has_is_empty.len() < 1 { | ^^^^^^^^^^^^^^^^^^^^^^ help: using `is_empty` is more concise: `has_is_empty.is_empty()` error: length comparison to one - --> $DIR/len_zero.rs:170:8 + --> $DIR/len_zero.rs:172:8 | -170 | if has_is_empty.len() >= 1 { +172 | if has_is_empty.len() >= 1 { | ^^^^^^^^^^^^^^^^^^^^^^^ help: using `is_empty` is more concise: `!has_is_empty.is_empty()` error: length comparison to zero - --> $DIR/len_zero.rs:181:8 + --> $DIR/len_zero.rs:183:8 | -181 | if 0 == has_is_empty.len() { +183 | if 0 == has_is_empty.len() { | ^^^^^^^^^^^^^^^^^^^^^^^ help: using `is_empty` is more concise: `has_is_empty.is_empty()` error: length comparison to zero - --> $DIR/len_zero.rs:184:8 + --> $DIR/len_zero.rs:186:8 | -184 | if 0 != has_is_empty.len() { +186 | if 0 != has_is_empty.len() { | ^^^^^^^^^^^^^^^^^^^^^^^ help: using `is_empty` is more concise: `!has_is_empty.is_empty()` error: length comparison to zero - --> $DIR/len_zero.rs:187:8 + --> $DIR/len_zero.rs:189:8 | -187 | if 0 < has_is_empty.len() { +189 | if 0 < has_is_empty.len() { | ^^^^^^^^^^^^^^^^^^^^^^ help: using `is_empty` is more concise: `!has_is_empty.is_empty()` error: length comparison to one - --> $DIR/len_zero.rs:190:8 + --> $DIR/len_zero.rs:192:8 | -190 | if 1 <= has_is_empty.len() { +192 | if 1 <= has_is_empty.len() { | ^^^^^^^^^^^^^^^^^^^^^^^ help: using `is_empty` is more concise: `!has_is_empty.is_empty()` error: length comparison to one - --> $DIR/len_zero.rs:193:8 + --> $DIR/len_zero.rs:195:8 | -193 | if 1 > has_is_empty.len() { +195 | if 1 > has_is_empty.len() { | ^^^^^^^^^^^^^^^^^^^^^^ help: using `is_empty` is more concise: `has_is_empty.is_empty()` error: length comparison to zero - --> $DIR/len_zero.rs:207:8 + --> $DIR/len_zero.rs:209:8 | -207 | if with_is_empty.len() == 0 { +209 | if with_is_empty.len() == 0 { | ^^^^^^^^^^^^^^^^^^^^^^^^ help: using `is_empty` is more concise: `with_is_empty.is_empty()` error: length comparison to zero - --> $DIR/len_zero.rs:220:8 + --> $DIR/len_zero.rs:222:8 | -220 | if b.len() != 0 {} +222 | if b.len() != 0 {} | ^^^^^^^^^^^^ help: using `is_empty` is more concise: `!b.is_empty()` error: trait `DependsOnFoo` has a `len` method but no (possibly inherited) `is_empty` method - --> $DIR/len_zero.rs:226:1 + --> $DIR/len_zero.rs:228:1 | -226 | / pub trait DependsOnFoo: Foo { -227 | | fn len(&mut self) -> usize; -228 | | } +228 | / pub trait DependsOnFoo: Foo { +229 | | fn len(&mut self) -> usize; +230 | | } | |_^ error: aborting due to 19 previous errors diff --git a/tests/ui/let_if_seq.stderr b/tests/ui/let_if_seq.stderr index b912373f9..7b4c78003 100644 --- a/tests/ui/let_if_seq.stderr +++ b/tests/ui/let_if_seq.stderr @@ -7,7 +7,7 @@ error: `if _ { .. } else { .. }` is an expression 60 | | } | |_____^ help: it is more idiomatic to write: `let foo = if f() { 42 } else { 0 };` | - = note: `-D useless-let-if-seq` implied by `-D warnings` + = note: `-D clippy::useless-let-if-seq` implied by `-D warnings` = note: you might not need `mut` at all error: `if _ { .. } else { .. }` is an expression diff --git a/tests/ui/let_return.stderr b/tests/ui/let_return.stderr index 459b2eafa..dad628bc9 100644 --- a/tests/ui/let_return.stderr +++ b/tests/ui/let_return.stderr @@ -4,7 +4,7 @@ error: returning the result of a let binding from a block. Consider returning th 10 | x | ^ | - = note: `-D let-and-return` implied by `-D warnings` + = note: `-D clippy::let-and-return` implied by `-D warnings` note: this expression can be directly returned --> $DIR/let_return.rs:9:13 | diff --git a/tests/ui/let_unit.stderr b/tests/ui/let_unit.stderr index da579ec80..f6f5d3f7d 100644 --- a/tests/ui/let_unit.stderr +++ b/tests/ui/let_unit.stderr @@ -4,7 +4,7 @@ error: this let-binding has unit value. Consider omitting `let _x =` 14 | let _x = println!("x"); | ^^^^^^^^^^^^^^^^^^^^^^^ | - = note: `-D let-unit-value` implied by `-D warnings` + = note: `-D clippy::let-unit-value` implied by `-D warnings` error: this let-binding has unit value. Consider omitting `let _a =` --> $DIR/let_unit.rs:18:9 diff --git a/tests/ui/lifetimes.stderr b/tests/ui/lifetimes.stderr index b69438af9..42fb01b75 100644 --- a/tests/ui/lifetimes.stderr +++ b/tests/ui/lifetimes.stderr @@ -4,7 +4,7 @@ error: explicit lifetimes given in parameter types where they could be elided 7 | fn distinct_lifetimes<'a, 'b>(_x: &'a u8, _y: &'b u8, _z: u8) { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: `-D needless-lifetimes` implied by `-D warnings` + = note: `-D clippy::needless-lifetimes` implied by `-D warnings` error: explicit lifetimes given in parameter types where they could be elided --> $DIR/lifetimes.rs:9:1 diff --git a/tests/ui/literals.stderr b/tests/ui/literals.stderr index 6f6ea75df..40399e498 100644 --- a/tests/ui/literals.stderr +++ b/tests/ui/literals.stderr @@ -1,124 +1,124 @@ -error: inconsistent casing in hexadecimal literal - --> $DIR/literals.rs:12:17 - | -12 | let fail1 = 0xabCD; - | ^^^^^^ - | - = note: `-D mixed-case-hex-literals` implied by `-D warnings` - -error: inconsistent casing in hexadecimal literal - --> $DIR/literals.rs:13:17 - | -13 | let fail2 = 0xabCD_u32; - | ^^^^^^^^^^ - error: inconsistent casing in hexadecimal literal --> $DIR/literals.rs:14:17 | -14 | let fail2 = 0xabCD_isize; +14 | let fail1 = 0xabCD; + | ^^^^^^ + | + = note: `-D clippy::mixed-case-hex-literals` implied by `-D warnings` + +error: inconsistent casing in hexadecimal literal + --> $DIR/literals.rs:15:17 + | +15 | let fail2 = 0xabCD_u32; + | ^^^^^^^^^^ + +error: inconsistent casing in hexadecimal literal + --> $DIR/literals.rs:16:17 + | +16 | let fail2 = 0xabCD_isize; | ^^^^^^^^^^^^ error: integer type suffix should be separated by an underscore - --> $DIR/literals.rs:15:27 + --> $DIR/literals.rs:17:27 | -15 | let fail_multi_zero = 000_123usize; +17 | let fail_multi_zero = 000_123usize; | ^^^^^^^^^^^^ | - = note: `-D unseparated-literal-suffix` implied by `-D warnings` + = note: `-D clippy::unseparated-literal-suffix` implied by `-D warnings` error: this is a decimal constant - --> $DIR/literals.rs:15:27 + --> $DIR/literals.rs:17:27 | -15 | let fail_multi_zero = 000_123usize; +17 | let fail_multi_zero = 000_123usize; | ^^^^^^^^^^^^ | - = note: `-D zero-prefixed-literal` implied by `-D warnings` + = note: `-D clippy::zero-prefixed-literal` implied by `-D warnings` help: if you mean to use a decimal constant, remove the `0` to remove confusion | -15 | let fail_multi_zero = 123usize; +17 | let fail_multi_zero = 123usize; | ^^^^^^^^ help: if you mean to use an octal constant, use `0o` | -15 | let fail_multi_zero = 0o123usize; +17 | let fail_multi_zero = 0o123usize; | ^^^^^^^^^^ -error: integer type suffix should be separated by an underscore - --> $DIR/literals.rs:20:17 - | -20 | let fail3 = 1234i32; - | ^^^^^^^ - -error: integer type suffix should be separated by an underscore - --> $DIR/literals.rs:21:17 - | -21 | let fail4 = 1234u32; - | ^^^^^^^ - error: integer type suffix should be separated by an underscore --> $DIR/literals.rs:22:17 | -22 | let fail5 = 1234isize; - | ^^^^^^^^^ +22 | let fail3 = 1234i32; + | ^^^^^^^ error: integer type suffix should be separated by an underscore --> $DIR/literals.rs:23:17 | -23 | let fail6 = 1234usize; +23 | let fail4 = 1234u32; + | ^^^^^^^ + +error: integer type suffix should be separated by an underscore + --> $DIR/literals.rs:24:17 + | +24 | let fail5 = 1234isize; + | ^^^^^^^^^ + +error: integer type suffix should be separated by an underscore + --> $DIR/literals.rs:25:17 + | +25 | let fail6 = 1234usize; | ^^^^^^^^^ error: float type suffix should be separated by an underscore - --> $DIR/literals.rs:24:17 + --> $DIR/literals.rs:26:17 | -24 | let fail7 = 1.5f32; +26 | let fail7 = 1.5f32; | ^^^^^^ error: this is a decimal constant - --> $DIR/literals.rs:28:17 + --> $DIR/literals.rs:30:17 | -28 | let fail8 = 0123; +30 | let fail8 = 0123; | ^^^^ help: if you mean to use a decimal constant, remove the `0` to remove confusion | -28 | let fail8 = 123; +30 | let fail8 = 123; | ^^^ help: if you mean to use an octal constant, use `0o` | -28 | let fail8 = 0o123; +30 | let fail8 = 0o123; | ^^^^^ error: long literal lacking separators - --> $DIR/literals.rs:39:17 + --> $DIR/literals.rs:41:17 | -39 | let fail9 = 0xabcdef; +41 | let fail9 = 0xabcdef; | ^^^^^^^^ help: consider: `0x00ab_cdef` | - = note: `-D unreadable-literal` implied by `-D warnings` - -error: long literal lacking separators - --> $DIR/literals.rs:40:18 - | -40 | let fail10 = 0xBAFEBAFE; - | ^^^^^^^^^^ help: consider: `0xBAFE_BAFE` - -error: long literal lacking separators - --> $DIR/literals.rs:41:18 - | -41 | let fail11 = 0xabcdeff; - | ^^^^^^^^^ help: consider: `0x0abc_deff` + = note: `-D clippy::unreadable-literal` implied by `-D warnings` error: long literal lacking separators --> $DIR/literals.rs:42:18 | -42 | let fail12 = 0xabcabcabcabcabcabc; +42 | let fail10 = 0xBAFEBAFE; + | ^^^^^^^^^^ help: consider: `0xBAFE_BAFE` + +error: long literal lacking separators + --> $DIR/literals.rs:43:18 + | +43 | let fail11 = 0xabcdeff; + | ^^^^^^^^^ help: consider: `0x0abc_deff` + +error: long literal lacking separators + --> $DIR/literals.rs:44:18 + | +44 | let fail12 = 0xabcabcabcabcabcabc; | ^^^^^^^^^^^^^^^^^^^^ help: consider: `0x00ab_cabc_abca_bcab_cabc` error: digit groups should be smaller - --> $DIR/literals.rs:43:18 + --> $DIR/literals.rs:45:18 | -43 | let fail13 = 0x1_23456_78901_usize; +45 | let fail13 = 0x1_23456_78901_usize; | ^^^^^^^^^^^^^^^^^^^^^ help: consider: `0x0123_4567_8901_usize` | - = note: `-D large-digit-groups` implied by `-D warnings` + = note: `-D clippy::large-digit-groups` implied by `-D warnings` error: aborting due to 16 previous errors diff --git a/tests/ui/map_clone.stderr b/tests/ui/map_clone.stderr index c29f37918..afad65b00 100644 --- a/tests/ui/map_clone.stderr +++ b/tests/ui/map_clone.stderr @@ -4,7 +4,7 @@ error: you seem to be using .map() to clone the contents of an iterator, conside 12 | x.iter().map(|y| y.clone()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: `-D map-clone` implied by `-D warnings` + = note: `-D clippy::map-clone` implied by `-D warnings` = help: try x.iter().cloned() diff --git a/tests/ui/match_bool.stderr b/tests/ui/match_bool.stderr index 89378f438..7ef6f714f 100644 --- a/tests/ui/match_bool.stderr +++ b/tests/ui/match_bool.stderr @@ -4,7 +4,7 @@ error: this boolean expression can be simplified 25 | match test && test { | ^^^^^^^^^^^^ help: try: `test` | - = note: `-D nonminimal-bool` implied by `-D warnings` + = note: `-D clippy::nonminimal-bool` implied by `-D warnings` error: you seem to be trying to match on a boolean expression --> $DIR/match_bool.rs:4:5 @@ -15,7 +15,7 @@ error: you seem to be trying to match on a boolean expression 7 | | }; | |_____^ help: consider using an if/else expression: `if test { 0 } else { 42 }` | - = note: `-D match-bool` implied by `-D warnings` + = note: `-D clippy::match-bool` implied by `-D warnings` error: you seem to be trying to match on a boolean expression --> $DIR/match_bool.rs:10:5 @@ -59,7 +59,7 @@ error: equal expressions as operands to `&&` 25 | match test && test { | ^^^^^^^^^^^^ | - = note: #[deny(eq_op)] on by default + = note: #[deny(clippy::eq_op)] on by default error: you seem to be trying to match on a boolean expression --> $DIR/match_bool.rs:30:5 diff --git a/tests/ui/matches.stderr b/tests/ui/matches.stderr index 61c13056c..6f1a06738 100644 --- a/tests/ui/matches.stderr +++ b/tests/ui/matches.stderr @@ -7,7 +7,7 @@ error: you seem to be trying to use match for destructuring a single pattern. Co 24 | | } | |_____^ help: try this: `if let ExprNode::ExprAddrOf = ExprNode::Butterflies { Some(&NODE) } else { let x = 5; None }` | - = note: `-D single-match-else` implied by `-D warnings` + = note: `-D clippy::single-match-else` implied by `-D warnings` error: you don't need to add `&` to all patterns --> $DIR/matches.rs:30:9 @@ -18,7 +18,7 @@ error: you don't need to add `&` to all patterns 33 | | } | |_________^ | - = note: `-D match-ref-pats` implied by `-D warnings` + = note: `-D clippy::match-ref-pats` implied by `-D warnings` help: instead of prefixing all patterns with `&`, you can dereference the expression | 30 | match *v { @@ -94,7 +94,7 @@ error: some ranges overlap 71 | 0 ... 10 => println!("0 ... 10"), | ^^^^^^^^ | - = note: `-D match-overlapping-arm` implied by `-D warnings` + = note: `-D clippy::match-overlapping-arm` implied by `-D warnings` note: overlaps with this --> $DIR/matches.rs:72:9 | @@ -155,7 +155,7 @@ error: Err(_) will match all errors, maybe not a good idea 132 | Err(_) => panic!("err") | ^^^^^^ | - = note: `-D match-wild-err-arm` implied by `-D warnings` + = note: `-D clippy::match-wild-err-arm` implied by `-D warnings` = note: to remove this warning, match each error separately or use unreachable macro error: this `match` has identical arm bodies @@ -164,7 +164,7 @@ error: this `match` has identical arm bodies 131 | Ok(_) => println!("ok"), | ^^^^^^^^^^^^^^ | - = note: `-D match-same-arms` implied by `-D warnings` + = note: `-D clippy::match-same-arms` implied by `-D warnings` note: same as this --> $DIR/matches.rs:130:18 | @@ -347,7 +347,7 @@ error: use as_ref() instead 215 | | }; | |_____^ help: try this: `owned.as_ref()` | - = note: `-D match-as-ref` implied by `-D warnings` + = note: `-D clippy::match-as-ref` implied by `-D warnings` error: use as_mut() instead --> $DIR/matches.rs:218:39 diff --git a/tests/ui/mem_forget.stderr b/tests/ui/mem_forget.stderr index 6e7a44694..1f43d9f36 100644 --- a/tests/ui/mem_forget.stderr +++ b/tests/ui/mem_forget.stderr @@ -4,7 +4,7 @@ error: usage of mem::forget on Drop type 18 | memstuff::forget(six); | ^^^^^^^^^^^^^^^^^^^^^ | - = note: `-D mem-forget` implied by `-D warnings` + = note: `-D clippy::mem-forget` implied by `-D warnings` error: usage of mem::forget on Drop type --> $DIR/mem_forget.rs:21:5 diff --git a/tests/ui/methods.stderr b/tests/ui/methods.stderr index bf529ce94..3189f3756 100644 --- a/tests/ui/methods.stderr +++ b/tests/ui/methods.stderr @@ -4,7 +4,7 @@ error: defining a method called `add` on this type; consider implementing the `s 21 | pub fn add(self, other: T) -> T { self } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: `-D should-implement-trait` implied by `-D warnings` + = note: `-D clippy::should-implement-trait` implied by `-D warnings` error: methods called `into_*` usually take self by value; consider choosing a less ambiguous name --> $DIR/methods.rs:32:17 @@ -12,7 +12,7 @@ error: methods called `into_*` usually take self by value; consider choosing a l 32 | fn into_u16(&self) -> u16 { 0 } | ^^^^^ | - = note: `-D wrong-self-convention` implied by `-D warnings` + = note: `-D clippy::wrong-self-convention` implied by `-D warnings` error: methods called `to_*` usually take self by reference; consider choosing a less ambiguous name --> $DIR/methods.rs:34:21 @@ -32,7 +32,7 @@ error: methods called `new` usually return `Self` 36 | fn new(self) {} | ^^^^^^^^^^^^^^^ | - = note: `-D new-ret-no-self` implied by `-D warnings` + = note: `-D clippy::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 --> $DIR/methods.rs:104:13 @@ -43,7 +43,7 @@ error: called `map(f).unwrap_or(a)` on an Option value. This can be done more di 106 | | .unwrap_or(0); // should lint even though this call is on a separate line | |____________________________^ | - = note: `-D option-map-unwrap-or` implied by `-D warnings` + = note: `-D clippy::option-map-unwrap-or` implied by `-D warnings` = 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 @@ -104,7 +104,7 @@ error: called `map(f).unwrap_or_else(g)` on an Option value. This can be done mo 133 | | .unwrap_or_else(|| 0); // should lint even though this call is on a separate line | |____________________________________^ | - = note: `-D option-map-unwrap-or-else` implied by `-D warnings` + = note: `-D clippy::option-map-unwrap-or-else` implied by `-D warnings` = 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 @@ -133,7 +133,7 @@ error: called `map_or(None, f)` on an Option value. This can be done more direct 148 | let _ = opt.map_or(None, |x| Some(x + 1)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using and_then instead: `opt.and_then(|x| Some(x + 1))` | - = note: `-D option-map-or-none` implied by `-D warnings` + = note: `-D clippy::option-map-or-none` implied by `-D warnings` error: called `map_or(None, f)` on an Option value. This can be done more directly by calling `and_then(f)` instead --> $DIR/methods.rs:150:13 @@ -160,7 +160,7 @@ error: called `map(f).unwrap_or_else(g)` on a Result value. This can be done mor 165 | | .unwrap_or_else(|e| 0); // should lint even though this call is on a separate line | |_____________________________________^ | - = note: `-D result-map-unwrap-or-else` implied by `-D warnings` + = note: `-D clippy::result-map-unwrap-or-else` implied by `-D warnings` = note: replace `map(|x| x + 1).unwrap_or_else(|e| 0)` with `ok().map_or_else(|e| 0, |x| x + 1)` error: called `map(f).unwrap_or_else(g)` on a Result value. This can be done more directly by calling `ok().map_or_else(g, f)` instead @@ -189,7 +189,7 @@ error: called `filter(p).next()` on an `Iterator`. This is more succinctly expre 234 | let _ = v.iter().filter(|&x| *x < 0).next(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: `-D filter-next` implied by `-D warnings` + = note: `-D clippy::filter-next` implied by `-D warnings` = 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. @@ -208,7 +208,7 @@ error: called `is_some()` after searching an `Iterator` with find. This is more 252 | let _ = v.iter().find(|&x| *x < 0).is_some(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: `-D search-is-some` implied by `-D warnings` + = note: `-D clippy::search-is-some` implied by `-D warnings` = 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()`. @@ -263,7 +263,7 @@ error: use of `unwrap_or` followed by a function call 308 | with_constructor.unwrap_or(make()); | ^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(make)` | - = note: `-D or-fun-call` implied by `-D warnings` + = note: `-D clippy::or-fun-call` implied by `-D warnings` error: use of `unwrap_or` followed by a call to `new` --> $DIR/methods.rs:311:5 @@ -337,7 +337,7 @@ error: `error_code` is shadowed by `123_i32` 377 | let error_code = 123_i32; | ^^^^^^^^^^ | - = note: `-D shadow-unrelated` implied by `-D warnings` + = note: `-D clippy::shadow-unrelated` implied by `-D warnings` note: initialization happens here --> $DIR/methods.rs:377:22 | @@ -355,7 +355,7 @@ error: use of `expect` followed by a function call 366 | with_none_and_format.expect(&format!("Error {}: fake error", error_code)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(|| panic!("Error {}: fake error", error_code))` | - = note: `-D expect-fun-call` implied by `-D warnings` + = note: `-D clippy::expect-fun-call` implied by `-D warnings` error: use of `expect` followed by a function call --> $DIR/methods.rs:369:26 @@ -381,7 +381,7 @@ error: called `.iter().nth()` on a Vec. Calling `.get()` is both faster and more 406 | let bad_vec = some_vec.iter().nth(3); | ^^^^^^^^^^^^^^^^^^^^^^ | - = note: `-D iter-nth` implied by `-D warnings` + = note: `-D clippy::iter-nth` implied by `-D warnings` error: called `.iter().nth()` on a slice. Calling `.get()` is both faster and more readable --> $DIR/methods.rs:407:26 @@ -425,7 +425,7 @@ error: called `skip(x).next()` on an iterator. This is more succinctly expressed 432 | let _ = some_vec.iter().skip(42).next(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: `-D iter-skip-next` implied by `-D warnings` + = note: `-D clippy::iter-skip-next` implied by `-D warnings` error: called `skip(x).next()` on an iterator. This is more succinctly expressed by calling `nth(x)` --> $DIR/methods.rs:433:13 @@ -451,7 +451,7 @@ error: used unwrap() on an Option value. If you don't want to handle the None ca 444 | let _ = opt.unwrap(); | ^^^^^^^^^^^^ | - = note: `-D option-unwrap-used` implied by `-D warnings` + = note: `-D clippy::option-unwrap-used` implied by `-D warnings` error: aborting due to 56 previous errors diff --git a/tests/ui/min_max.stderr b/tests/ui/min_max.stderr index b8ea183fc..e89542a2d 100644 --- a/tests/ui/min_max.stderr +++ b/tests/ui/min_max.stderr @@ -4,7 +4,7 @@ error: this min/max combination leads to constant result 15 | min(1, max(3, x)); | ^^^^^^^^^^^^^^^^^ | - = note: `-D min-max` implied by `-D warnings` + = note: `-D clippy::min-max` implied by `-D warnings` error: this min/max combination leads to constant result --> $DIR/min_max.rs:16:5 diff --git a/tests/ui/missing-doc.stderr b/tests/ui/missing-doc.stderr index 54834f902..ebc4c5aca 100644 --- a/tests/ui/missing-doc.stderr +++ b/tests/ui/missing-doc.stderr @@ -1,267 +1,267 @@ error: missing documentation for a type alias - --> $DIR/missing-doc.rs:26:1 + --> $DIR/missing-doc.rs:28:1 | -26 | type Typedef = String; +28 | type Typedef = String; | ^^^^^^^^^^^^^^^^^^^^^^ | - = note: `-D missing-docs-in-private-items` implied by `-D warnings` + = note: `-D clippy::missing-docs-in-private-items` implied by `-D warnings` error: missing documentation for a type alias - --> $DIR/missing-doc.rs:27:1 + --> $DIR/missing-doc.rs:29:1 | -27 | pub type PubTypedef = String; +29 | pub type PubTypedef = String; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: missing documentation for a struct - --> $DIR/missing-doc.rs:29:1 + --> $DIR/missing-doc.rs:31:1 | -29 | / struct Foo { -30 | | a: isize, -31 | | b: isize, -32 | | } +31 | / struct Foo { +32 | | a: isize, +33 | | b: isize, +34 | | } | |_^ error: missing documentation for a struct field - --> $DIR/missing-doc.rs:30:5 + --> $DIR/missing-doc.rs:32:5 | -30 | a: isize, +32 | a: isize, | ^^^^^^^^ error: missing documentation for a struct field - --> $DIR/missing-doc.rs:31:5 + --> $DIR/missing-doc.rs:33:5 | -31 | b: isize, +33 | b: isize, | ^^^^^^^^ error: missing documentation for a struct - --> $DIR/missing-doc.rs:34:1 + --> $DIR/missing-doc.rs:36:1 | -34 | / pub struct PubFoo { -35 | | pub a: isize, -36 | | b: isize, -37 | | } +36 | / pub struct PubFoo { +37 | | pub a: isize, +38 | | b: isize, +39 | | } | |_^ error: missing documentation for a struct field - --> $DIR/missing-doc.rs:35:5 + --> $DIR/missing-doc.rs:37:5 | -35 | pub a: isize, +37 | pub a: isize, | ^^^^^^^^^^^^ error: missing documentation for a struct field - --> $DIR/missing-doc.rs:36:5 + --> $DIR/missing-doc.rs:38:5 | -36 | b: isize, +38 | b: isize, | ^^^^^^^^ error: missing documentation for a module - --> $DIR/missing-doc.rs:45:1 + --> $DIR/missing-doc.rs:47:1 | -45 | mod module_no_dox {} +47 | mod module_no_dox {} | ^^^^^^^^^^^^^^^^^^^^ error: missing documentation for a module - --> $DIR/missing-doc.rs:46:1 + --> $DIR/missing-doc.rs:48:1 | -46 | pub mod pub_module_no_dox {} +48 | pub mod pub_module_no_dox {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: missing documentation for a function - --> $DIR/missing-doc.rs:50:1 + --> $DIR/missing-doc.rs:52:1 | -50 | pub fn foo2() {} +52 | pub fn foo2() {} | ^^^^^^^^^^^^^^^^ error: missing documentation for a function - --> $DIR/missing-doc.rs:51:1 + --> $DIR/missing-doc.rs:53:1 | -51 | fn foo3() {} +53 | fn foo3() {} | ^^^^^^^^^^^^ error: missing documentation for a trait - --> $DIR/missing-doc.rs:68:1 + --> $DIR/missing-doc.rs:70:1 | -68 | / pub trait C { -69 | | fn foo(&self); -70 | | fn foo_with_impl(&self) {} -71 | | } +70 | / pub trait C { +71 | | fn foo(&self); +72 | | fn foo_with_impl(&self) {} +73 | | } | |_^ error: missing documentation for a trait method - --> $DIR/missing-doc.rs:69:5 + --> $DIR/missing-doc.rs:71:5 | -69 | fn foo(&self); +71 | fn foo(&self); | ^^^^^^^^^^^^^^ error: missing documentation for a trait method - --> $DIR/missing-doc.rs:70:5 + --> $DIR/missing-doc.rs:72:5 | -70 | fn foo_with_impl(&self) {} +72 | fn foo_with_impl(&self) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^ error: missing documentation for an associated type - --> $DIR/missing-doc.rs:80:5 + --> $DIR/missing-doc.rs:82:5 | -80 | type AssociatedType; +82 | type AssociatedType; | ^^^^^^^^^^^^^^^^^^^^ error: missing documentation for an associated type - --> $DIR/missing-doc.rs:81:5 + --> $DIR/missing-doc.rs:83:5 | -81 | type AssociatedTypeDef = Self; +83 | type AssociatedTypeDef = Self; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: missing documentation for a method - --> $DIR/missing-doc.rs:92:5 + --> $DIR/missing-doc.rs:94:5 | -92 | pub fn foo() {} +94 | pub fn foo() {} | ^^^^^^^^^^^^^^^ error: missing documentation for a method - --> $DIR/missing-doc.rs:93:5 + --> $DIR/missing-doc.rs:95:5 | -93 | fn bar() {} +95 | fn bar() {} | ^^^^^^^^^^^ error: missing documentation for a method - --> $DIR/missing-doc.rs:97:5 + --> $DIR/missing-doc.rs:99:5 | -97 | pub fn foo() {} +99 | pub fn foo() {} | ^^^^^^^^^^^^^^^ error: missing documentation for a method - --> $DIR/missing-doc.rs:100:5 + --> $DIR/missing-doc.rs:102:5 | -100 | fn foo2() {} +102 | fn foo2() {} | ^^^^^^^^^^^^ error: missing documentation for an enum - --> $DIR/missing-doc.rs:126:1 + --> $DIR/missing-doc.rs:128:1 | -126 | / enum Baz { -127 | | BazA { -128 | | a: isize, -129 | | b: isize -130 | | }, -131 | | BarB -132 | | } +128 | / enum Baz { +129 | | BazA { +130 | | a: isize, +131 | | b: isize +132 | | }, +133 | | BarB +134 | | } | |_^ error: missing documentation for a variant - --> $DIR/missing-doc.rs:127:5 + --> $DIR/missing-doc.rs:129:5 | -127 | / BazA { -128 | | a: isize, -129 | | b: isize -130 | | }, +129 | / BazA { +130 | | a: isize, +131 | | b: isize +132 | | }, | |_____^ error: missing documentation for a struct field - --> $DIR/missing-doc.rs:128:9 + --> $DIR/missing-doc.rs:130:9 | -128 | a: isize, +130 | a: isize, | ^^^^^^^^ error: missing documentation for a struct field - --> $DIR/missing-doc.rs:129:9 + --> $DIR/missing-doc.rs:131:9 | -129 | b: isize +131 | b: isize | ^^^^^^^^ error: missing documentation for a variant - --> $DIR/missing-doc.rs:131:5 + --> $DIR/missing-doc.rs:133:5 | -131 | BarB +133 | BarB | ^^^^ error: missing documentation for an enum - --> $DIR/missing-doc.rs:134:1 + --> $DIR/missing-doc.rs:136:1 | -134 | / pub enum PubBaz { -135 | | PubBazA { -136 | | a: isize, -137 | | }, -138 | | } +136 | / pub enum PubBaz { +137 | | PubBazA { +138 | | a: isize, +139 | | }, +140 | | } | |_^ error: missing documentation for a variant - --> $DIR/missing-doc.rs:135:5 + --> $DIR/missing-doc.rs:137:5 | -135 | / PubBazA { -136 | | a: isize, -137 | | }, +137 | / PubBazA { +138 | | a: isize, +139 | | }, | |_____^ error: missing documentation for a struct field - --> $DIR/missing-doc.rs:136:9 + --> $DIR/missing-doc.rs:138:9 | -136 | a: isize, +138 | a: isize, | ^^^^^^^^ error: missing documentation for a constant - --> $DIR/missing-doc.rs:160:1 + --> $DIR/missing-doc.rs:162:1 | -160 | const FOO: u32 = 0; +162 | const FOO: u32 = 0; | ^^^^^^^^^^^^^^^^^^^ error: missing documentation for a constant - --> $DIR/missing-doc.rs:167:1 + --> $DIR/missing-doc.rs:169:1 | -167 | pub const FOO4: u32 = 0; +169 | pub const FOO4: u32 = 0; | ^^^^^^^^^^^^^^^^^^^^^^^^ error: missing documentation for a static - --> $DIR/missing-doc.rs:170:1 + --> $DIR/missing-doc.rs:172:1 | -170 | static BAR: u32 = 0; +172 | static BAR: u32 = 0; | ^^^^^^^^^^^^^^^^^^^^ error: missing documentation for a static - --> $DIR/missing-doc.rs:177:1 + --> $DIR/missing-doc.rs:179:1 | -177 | pub static BAR4: u32 = 0; +179 | pub static BAR4: u32 = 0; | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: missing documentation for a module - --> $DIR/missing-doc.rs:180:1 + --> $DIR/missing-doc.rs:182:1 | -180 | / mod internal_impl { -181 | | /// dox -182 | | pub fn documented() {} -183 | | pub fn undocumented1() {} +182 | / mod internal_impl { +183 | | /// dox +184 | | pub fn documented() {} +185 | | pub fn undocumented1() {} ... | -192 | | } -193 | | } +194 | | } +195 | | } | |_^ -error: missing documentation for a function - --> $DIR/missing-doc.rs:183:5 - | -183 | pub fn undocumented1() {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^ - -error: missing documentation for a function - --> $DIR/missing-doc.rs:184:5 - | -184 | pub fn undocumented2() {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^ - error: missing documentation for a function --> $DIR/missing-doc.rs:185:5 | -185 | fn undocumented3() {} +185 | pub fn undocumented1() {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: missing documentation for a function + --> $DIR/missing-doc.rs:186:5 + | +186 | pub fn undocumented2() {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: missing documentation for a function + --> $DIR/missing-doc.rs:187:5 + | +187 | fn undocumented3() {} | ^^^^^^^^^^^^^^^^^^^^^ error: missing documentation for a function - --> $DIR/missing-doc.rs:190:9 + --> $DIR/missing-doc.rs:192:9 | -190 | pub fn also_undocumented1() {} +192 | pub fn also_undocumented1() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: missing documentation for a function - --> $DIR/missing-doc.rs:191:9 + --> $DIR/missing-doc.rs:193:9 | -191 | fn also_undocumented2() {} +193 | fn also_undocumented2() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 39 previous errors diff --git a/tests/ui/missing_inline.stderr b/tests/ui/missing_inline.stderr index fe3437427..3609c9101 100644 --- a/tests/ui/missing_inline.stderr +++ b/tests/ui/missing_inline.stderr @@ -1,39 +1,39 @@ error: missing `#[inline]` for a function - --> $DIR/missing_inline.rs:31:1 + --> $DIR/missing_inline.rs:33:1 | -31 | pub fn pub_foo() {} // missing #[inline] +33 | pub fn pub_foo() {} // missing #[inline] | ^^^^^^^^^^^^^^^^^^^ | - = note: `-D missing-inline-in-public-items` implied by `-D warnings` + = note: `-D clippy::missing-inline-in-public-items` implied by `-D warnings` error: missing `#[inline]` for a default trait method - --> $DIR/missing_inline.rs:46:5 + --> $DIR/missing_inline.rs:48:5 | -46 | fn PubBar_b() {} // missing #[inline] - | ^^^^^^^^^^^^^^^^ - -error: missing `#[inline]` for a method - --> $DIR/missing_inline.rs:59:5 - | -59 | fn PubBar_a() {} // missing #[inline] - | ^^^^^^^^^^^^^^^^ - -error: missing `#[inline]` for a method - --> $DIR/missing_inline.rs:60:5 - | -60 | fn PubBar_b() {} // missing #[inline] +48 | fn PubBar_b() {} // missing #[inline] | ^^^^^^^^^^^^^^^^ error: missing `#[inline]` for a method --> $DIR/missing_inline.rs:61:5 | -61 | fn PubBar_c() {} // missing #[inline] +61 | fn PubBar_a() {} // missing #[inline] | ^^^^^^^^^^^^^^^^ error: missing `#[inline]` for a method - --> $DIR/missing_inline.rs:71:5 + --> $DIR/missing_inline.rs:62:5 | -71 | pub fn PubFooImpl() {} // missing #[inline] +62 | fn PubBar_b() {} // missing #[inline] + | ^^^^^^^^^^^^^^^^ + +error: missing `#[inline]` for a method + --> $DIR/missing_inline.rs:63:5 + | +63 | fn PubBar_c() {} // missing #[inline] + | ^^^^^^^^^^^^^^^^ + +error: missing `#[inline]` for a method + --> $DIR/missing_inline.rs:73:5 + | +73 | pub fn PubFooImpl() {} // missing #[inline] | ^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 6 previous errors diff --git a/tests/ui/module_inception.stderr b/tests/ui/module_inception.stderr index c9d3319db..43f9666f7 100644 --- a/tests/ui/module_inception.stderr +++ b/tests/ui/module_inception.stderr @@ -6,7 +6,7 @@ error: module has the same name as its containing module 9 | | } | |_________^ | - = note: `-D module-inception` implied by `-D warnings` + = note: `-D clippy::module-inception` implied by `-D warnings` error: module has the same name as its containing module --> $DIR/module_inception.rs:12:5 diff --git a/tests/ui/modulo_one.stderr b/tests/ui/modulo_one.stderr index ccfca7154..5d42c3e0a 100644 --- a/tests/ui/modulo_one.stderr +++ b/tests/ui/modulo_one.stderr @@ -4,7 +4,7 @@ error: any number modulo 1 will be 0 7 | 10 % 1; | ^^^^^^ | - = note: `-D modulo-one` implied by `-D warnings` + = note: `-D clippy::modulo-one` implied by `-D warnings` error: aborting due to previous error diff --git a/tests/ui/mut_from_ref.stderr b/tests/ui/mut_from_ref.stderr index a7cbc0b7a..0f5baa2d2 100644 --- a/tests/ui/mut_from_ref.stderr +++ b/tests/ui/mut_from_ref.stderr @@ -4,7 +4,7 @@ error: mutable borrow from immutable input(s) 9 | fn this_wont_hurt_a_bit(&self) -> &mut Foo { | ^^^^^^^^ | - = note: `-D mut-from-ref` implied by `-D warnings` + = note: `-D clippy::mut-from-ref` implied by `-D warnings` note: immutable borrow here --> $DIR/mut_from_ref.rs:9:29 | diff --git a/tests/ui/mut_mut.stderr b/tests/ui/mut_mut.stderr index d1f05ea80..88bd2f729 100644 --- a/tests/ui/mut_mut.stderr +++ b/tests/ui/mut_mut.stderr @@ -4,7 +4,7 @@ error: generally you want to avoid `&mut &mut _` if possible 10 | fn fun(x : &mut &mut u32) -> bool { | ^^^^^^^^^^^^^ | - = note: `-D mut-mut` implied by `-D warnings` + = note: `-D clippy::mut-mut` implied by `-D warnings` error: generally you want to avoid `&mut &mut _` if possible --> $DIR/mut_mut.rs:24:17 diff --git a/tests/ui/mut_range_bound.stderr b/tests/ui/mut_range_bound.stderr index d7be7ae1e..fece96106 100644 --- a/tests/ui/mut_range_bound.stderr +++ b/tests/ui/mut_range_bound.stderr @@ -4,7 +4,7 @@ error: attempt to mutate range bound within loop; note that the range of the loo 18 | for i in 0..m { m = 5; } // warning | ^^^^^ | - = note: `-D mut-range-bound` implied by `-D warnings` + = note: `-D clippy::mut-range-bound` implied by `-D warnings` error: attempt to mutate range bound within loop; note that the range of the loop is unchanged --> $DIR/mut_range_bound.rs:23:22 diff --git a/tests/ui/mut_reference.stderr b/tests/ui/mut_reference.stderr index 73df19bf1..ee62e2647 100644 --- a/tests/ui/mut_reference.stderr +++ b/tests/ui/mut_reference.stderr @@ -4,7 +4,7 @@ error: The function/method `takes_an_immutable_reference` doesn't need a mutable 22 | takes_an_immutable_reference(&mut 42); | ^^^^^^^ | - = note: `-D unnecessary-mut-passed` implied by `-D warnings` + = note: `-D clippy::unnecessary-mut-passed` implied by `-D warnings` error: The function/method `as_ptr` doesn't need a mutable reference --> $DIR/mut_reference.rs:24:12 diff --git a/tests/ui/mutex_atomic.stderr b/tests/ui/mutex_atomic.stderr index 354f9891c..2df58889a 100644 --- a/tests/ui/mutex_atomic.stderr +++ b/tests/ui/mutex_atomic.stderr @@ -4,7 +4,7 @@ error: Consider using an AtomicBool instead of a Mutex here. If you just want th 9 | Mutex::new(true); | ^^^^^^^^^^^^^^^^ | - = note: `-D mutex-atomic` implied by `-D warnings` + = note: `-D clippy::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<()>. --> $DIR/mutex_atomic.rs:10:5 @@ -36,7 +36,7 @@ error: Consider using an AtomicUsize instead of a Mutex here. If you just want t 15 | Mutex::new(0u32); | ^^^^^^^^^^^^^^^^ | - = note: `-D mutex-integer` implied by `-D warnings` + = note: `-D clippy::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<()>. --> $DIR/mutex_atomic.rs:16:5 diff --git a/tests/ui/needless_bool.stderr b/tests/ui/needless_bool.stderr index 63e063244..dd132bc67 100644 --- a/tests/ui/needless_bool.stderr +++ b/tests/ui/needless_bool.stderr @@ -4,7 +4,7 @@ error: this if-then-else expression will always return true 9 | if x { true } else { true }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: `-D needless-bool` implied by `-D warnings` + = note: `-D clippy::needless-bool` implied by `-D warnings` error: this if-then-else expression will always return false --> $DIR/needless_bool.rs:10:5 diff --git a/tests/ui/needless_borrow.stderr b/tests/ui/needless_borrow.stderr index fde38508b..c720dff5d 100644 --- a/tests/ui/needless_borrow.stderr +++ b/tests/ui/needless_borrow.stderr @@ -1,41 +1,41 @@ error: this expression borrows a reference that is immediately dereferenced by the compiler - --> $DIR/needless_borrow.rs:13:15 + --> $DIR/needless_borrow.rs:15:15 | -13 | let c = x(&&a); +15 | let c = x(&&a); | ^^^ help: change this to: `&a` | - = note: `-D needless-borrow` implied by `-D warnings` + = note: `-D clippy::needless-borrow` implied by `-D warnings` error: this pattern creates a reference to a reference - --> $DIR/needless_borrow.rs:20:17 + --> $DIR/needless_borrow.rs:22:17 | -20 | if let Some(ref cake) = Some(&5) {} +22 | if let Some(ref cake) = Some(&5) {} | ^^^^^^^^ help: change this to: `cake` error: this expression borrows a reference that is immediately dereferenced by the compiler - --> $DIR/needless_borrow.rs:27:15 + --> $DIR/needless_borrow.rs:29:15 | -27 | 46 => &&a, +29 | 46 => &&a, | ^^^ help: change this to: `&a` error: this pattern takes a reference on something that is being de-referenced - --> $DIR/needless_borrow.rs:49:34 + --> $DIR/needless_borrow.rs:51:34 | -49 | let _ = v.iter_mut().filter(|&ref a| a.is_empty()); +51 | let _ = v.iter_mut().filter(|&ref a| a.is_empty()); | ^^^^^^ help: try removing the `&ref` part and just keep: `a` | - = note: `-D needless-borrowed-reference` implied by `-D warnings` + = note: `-D clippy::needless-borrowed-reference` implied by `-D warnings` error: this pattern takes a reference on something that is being de-referenced - --> $DIR/needless_borrow.rs:50:30 + --> $DIR/needless_borrow.rs:52:30 | -50 | let _ = v.iter().filter(|&ref a| a.is_empty()); +52 | let _ = v.iter().filter(|&ref a| a.is_empty()); | ^^^^^^ help: try removing the `&ref` part and just keep: `a` error: this pattern creates a reference to a reference - --> $DIR/needless_borrow.rs:50:31 + --> $DIR/needless_borrow.rs:52:31 | -50 | let _ = v.iter().filter(|&ref a| a.is_empty()); +52 | let _ = v.iter().filter(|&ref a| a.is_empty()); | ^^^^^ help: change this to: `a` error: aborting due to 6 previous errors diff --git a/tests/ui/needless_borrowed_ref.stderr b/tests/ui/needless_borrowed_ref.stderr index 2a8cf4348..3113b887b 100644 --- a/tests/ui/needless_borrowed_ref.stderr +++ b/tests/ui/needless_borrowed_ref.stderr @@ -4,7 +4,7 @@ error: this pattern takes a reference on something that is being de-referenced 8 | let _ = v.iter_mut().filter(|&ref a| a.is_empty()); | ^^^^^^ help: try removing the `&ref` part and just keep: `a` | - = note: `-D needless-borrowed-reference` implied by `-D warnings` + = note: `-D clippy::needless-borrowed-reference` implied by `-D warnings` error: this pattern takes a reference on something that is being de-referenced --> $DIR/needless_borrowed_ref.rs:13:17 diff --git a/tests/ui/needless_continue.stderr b/tests/ui/needless_continue.stderr index 3e0368892..7cfaf89d6 100644 --- a/tests/ui/needless_continue.stderr +++ b/tests/ui/needless_continue.stderr @@ -8,7 +8,7 @@ error: This else block is redundant. 28 | | } | |_________^ | - = note: `-D needless-continue` implied by `-D warnings` + = note: `-D clippy::needless-continue` implied by `-D warnings` = help: Consider dropping the else clause and merging the code that follows (in the loop) with the if block, like so: if i % 2 == 0 && i % 3 == 0 { println!("{}", i); diff --git a/tests/ui/needless_pass_by_value.stderr b/tests/ui/needless_pass_by_value.stderr index 2fef0595c..9cb5e6e48 100644 --- a/tests/ui/needless_pass_by_value.stderr +++ b/tests/ui/needless_pass_by_value.stderr @@ -1,187 +1,187 @@ error: this argument is passed by value, but not consumed in the function body - --> $DIR/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]` - | - = note: `-D needless-pass-by-value` implied by `-D warnings` + --> $DIR/needless_pass_by_value.rs:11:23 + | +11 | fn foo(v: Vec, w: Vec, mut x: Vec, y: Vec) -> Vec { + | ^^^^^^ help: consider changing the type to: `&[T]` + | + = note: `-D clippy::needless-pass-by-value` implied by `-D warnings` error: this argument is passed by value, but not consumed in the function body - --> $DIR/needless_pass_by_value.rs:23:11 + --> $DIR/needless_pass_by_value.rs:25:11 | -23 | fn bar(x: String, y: Wrapper) { +25 | fn bar(x: String, y: Wrapper) { | ^^^^^^ help: consider changing the type to: `&str` error: this argument is passed by value, but not consumed in the function body - --> $DIR/needless_pass_by_value.rs:23:22 + --> $DIR/needless_pass_by_value.rs:25:22 | -23 | fn bar(x: String, y: Wrapper) { +25 | fn bar(x: String, y: Wrapper) { | ^^^^^^^ help: consider taking a reference instead: `&Wrapper` error: this argument is passed by value, but not consumed in the function body - --> $DIR/needless_pass_by_value.rs:29:71 + --> $DIR/needless_pass_by_value.rs:31:71 | -29 | fn test_borrow_trait, U: AsRef, V>(t: T, u: U, v: V) { +31 | fn test_borrow_trait, U: AsRef, V>(t: T, u: U, v: V) { | ^ help: consider taking a reference instead: `&V` error: this argument is passed by value, but not consumed in the function body - --> $DIR/needless_pass_by_value.rs:41:18 + --> $DIR/needless_pass_by_value.rs:43:18 | -41 | fn test_match(x: Option>, y: Option>) { +43 | fn test_match(x: Option>, y: Option>) { | ^^^^^^^^^^^^^^^^^^^^^^ help: consider taking a reference instead | -41 | fn test_match(x: &Option>, y: Option>) { -42 | match *x { +43 | fn test_match(x: &Option>, y: Option>) { +44 | match *x { | error: this argument is passed by value, but not consumed in the function body - --> $DIR/needless_pass_by_value.rs:54:24 + --> $DIR/needless_pass_by_value.rs:56:24 | -54 | fn test_destructure(x: Wrapper, y: Wrapper, z: Wrapper) { +56 | fn test_destructure(x: Wrapper, y: Wrapper, z: Wrapper) { | ^^^^^^^ help: consider taking a reference instead: `&Wrapper` error: this argument is passed by value, but not consumed in the function body - --> $DIR/needless_pass_by_value.rs:54:36 + --> $DIR/needless_pass_by_value.rs:56:36 | -54 | fn test_destructure(x: Wrapper, y: Wrapper, z: Wrapper) { +56 | fn test_destructure(x: Wrapper, y: Wrapper, z: Wrapper) { | ^^^^^^^ help: consider taking a reference instead | -54 | fn test_destructure(x: Wrapper, y: &Wrapper, z: Wrapper) { -55 | let Wrapper(s) = z; // moved -56 | let Wrapper(ref t) = *y; // not moved -57 | let Wrapper(_) = *y; // still not moved +56 | fn test_destructure(x: Wrapper, y: &Wrapper, z: Wrapper) { +57 | let Wrapper(s) = z; // moved +58 | let Wrapper(ref t) = *y; // not moved +59 | let Wrapper(_) = *y; // still not moved | error: this argument is passed by value, but not consumed in the function body - --> $DIR/needless_pass_by_value.rs:70:49 + --> $DIR/needless_pass_by_value.rs:72:49 | -70 | fn test_blanket_ref(_foo: T, _serializable: S) {} +72 | fn test_blanket_ref(_foo: T, _serializable: S) {} | ^ help: consider taking a reference instead: `&T` error: this argument is passed by value, but not consumed in the function body - --> $DIR/needless_pass_by_value.rs:72:18 + --> $DIR/needless_pass_by_value.rs:74:18 | -72 | fn issue_2114(s: String, t: String, u: Vec, v: Vec) { +74 | fn issue_2114(s: String, t: String, u: Vec, v: Vec) { | ^^^^^^ help: consider taking a reference instead: `&String` error: this argument is passed by value, but not consumed in the function body - --> $DIR/needless_pass_by_value.rs:72:29 + --> $DIR/needless_pass_by_value.rs:74:29 | -72 | fn issue_2114(s: String, t: String, u: Vec, v: Vec) { +74 | fn issue_2114(s: String, t: String, u: Vec, v: Vec) { | ^^^^^^ help: consider changing the type to | -72 | fn issue_2114(s: String, t: &str, u: Vec, v: Vec) { +74 | fn issue_2114(s: String, t: &str, u: Vec, v: Vec) { | ^^^^ help: change `t.clone()` to | -74 | let _ = t.to_string(); +76 | let _ = t.to_string(); | ^^^^^^^^^^^^^ error: this argument is passed by value, but not consumed in the function body - --> $DIR/needless_pass_by_value.rs:72:40 + --> $DIR/needless_pass_by_value.rs:74:40 | -72 | fn issue_2114(s: String, t: String, u: Vec, v: Vec) { +74 | fn issue_2114(s: String, t: String, u: Vec, v: Vec) { | ^^^^^^^^ help: consider taking a reference instead: `&Vec` error: this argument is passed by value, but not consumed in the function body - --> $DIR/needless_pass_by_value.rs:72:53 + --> $DIR/needless_pass_by_value.rs:74:53 | -72 | fn issue_2114(s: String, t: String, u: Vec, v: Vec) { +74 | fn issue_2114(s: String, t: String, u: Vec, v: Vec) { | ^^^^^^^^ help: consider changing the type to | -72 | fn issue_2114(s: String, t: String, u: Vec, v: &[i32]) { +74 | fn issue_2114(s: String, t: String, u: Vec, v: &[i32]) { | ^^^^^^ help: change `v.clone()` to | -76 | let _ = v.to_owned(); +78 | let _ = v.to_owned(); | ^^^^^^^^^^^^ error: this argument is passed by value, but not consumed in the function body - --> $DIR/needless_pass_by_value.rs:84:12 + --> $DIR/needless_pass_by_value.rs:86:12 | -84 | s: String, +86 | s: String, | ^^^^^^ help: consider changing the type to: `&str` error: this argument is passed by value, but not consumed in the function body - --> $DIR/needless_pass_by_value.rs:85:12 + --> $DIR/needless_pass_by_value.rs:87:12 | -85 | t: String, +87 | t: String, | ^^^^^^ help: consider taking a reference instead: `&String` error: this argument is passed by value, but not consumed in the function body - --> $DIR/needless_pass_by_value.rs:97:13 + --> $DIR/needless_pass_by_value.rs:99:13 | -97 | _u: U, +99 | _u: U, | ^ help: consider taking a reference instead: `&U` error: this argument is passed by value, but not consumed in the function body - --> $DIR/needless_pass_by_value.rs:98:13 - | -98 | _s: Self, - | ^^^^ help: consider taking a reference instead: `&Self` + --> $DIR/needless_pass_by_value.rs:100:13 + | +100 | _s: Self, + | ^^^^ help: consider taking a reference instead: `&Self` error: this argument is passed by value, but not consumed in the function body - --> $DIR/needless_pass_by_value.rs:120:24 + --> $DIR/needless_pass_by_value.rs:122:24 | -120 | fn bar_copy(x: u32, y: CopyWrapper) { +122 | fn bar_copy(x: u32, y: CopyWrapper) { | ^^^^^^^^^^^ help: consider taking a reference instead: `&CopyWrapper` | help: consider marking this type as Copy - --> $DIR/needless_pass_by_value.rs:118:1 + --> $DIR/needless_pass_by_value.rs:120:1 | -118 | struct CopyWrapper(u32); +120 | struct CopyWrapper(u32); | ^^^^^^^^^^^^^^^^^^^^^^^^ error: this argument is passed by value, but not consumed in the function body - --> $DIR/needless_pass_by_value.rs:126:29 + --> $DIR/needless_pass_by_value.rs:128:29 | -126 | fn test_destructure_copy(x: CopyWrapper, y: CopyWrapper, z: CopyWrapper) { +128 | fn test_destructure_copy(x: CopyWrapper, y: CopyWrapper, z: CopyWrapper) { | ^^^^^^^^^^^ help: consider taking a reference instead: `&CopyWrapper` | help: consider marking this type as Copy - --> $DIR/needless_pass_by_value.rs:118:1 + --> $DIR/needless_pass_by_value.rs:120:1 | -118 | struct CopyWrapper(u32); +120 | struct CopyWrapper(u32); | ^^^^^^^^^^^^^^^^^^^^^^^^ error: this argument is passed by value, but not consumed in the function body - --> $DIR/needless_pass_by_value.rs:126:45 + --> $DIR/needless_pass_by_value.rs:128:45 | -126 | fn test_destructure_copy(x: CopyWrapper, y: CopyWrapper, z: CopyWrapper) { +128 | fn test_destructure_copy(x: CopyWrapper, y: CopyWrapper, z: CopyWrapper) { | ^^^^^^^^^^^ | help: consider marking this type as Copy - --> $DIR/needless_pass_by_value.rs:118:1 + --> $DIR/needless_pass_by_value.rs:120:1 | -118 | struct CopyWrapper(u32); +120 | struct CopyWrapper(u32); | ^^^^^^^^^^^^^^^^^^^^^^^^ help: consider taking a reference instead | -126 | fn test_destructure_copy(x: CopyWrapper, y: &CopyWrapper, z: CopyWrapper) { -127 | let CopyWrapper(s) = z; // moved -128 | let CopyWrapper(ref t) = *y; // not moved -129 | let CopyWrapper(_) = *y; // still not moved +128 | fn test_destructure_copy(x: CopyWrapper, y: &CopyWrapper, z: CopyWrapper) { +129 | let CopyWrapper(s) = z; // moved +130 | let CopyWrapper(ref t) = *y; // not moved +131 | let CopyWrapper(_) = *y; // still not moved | error: this argument is passed by value, but not consumed in the function body - --> $DIR/needless_pass_by_value.rs:126:61 + --> $DIR/needless_pass_by_value.rs:128:61 | -126 | fn test_destructure_copy(x: CopyWrapper, y: CopyWrapper, z: CopyWrapper) { +128 | fn test_destructure_copy(x: CopyWrapper, y: CopyWrapper, z: CopyWrapper) { | ^^^^^^^^^^^ | help: consider marking this type as Copy - --> $DIR/needless_pass_by_value.rs:118:1 + --> $DIR/needless_pass_by_value.rs:120:1 | -118 | struct CopyWrapper(u32); +120 | struct CopyWrapper(u32); | ^^^^^^^^^^^^^^^^^^^^^^^^ help: consider taking a reference instead | -126 | fn test_destructure_copy(x: CopyWrapper, y: CopyWrapper, z: &CopyWrapper) { -127 | let CopyWrapper(s) = *z; // moved +128 | fn test_destructure_copy(x: CopyWrapper, y: CopyWrapper, z: &CopyWrapper) { +129 | let CopyWrapper(s) = *z; // moved | error: aborting due to 20 previous errors diff --git a/tests/ui/needless_range_loop.stderr b/tests/ui/needless_range_loop.stderr index c394469c1..1954a8240 100644 --- a/tests/ui/needless_range_loop.stderr +++ b/tests/ui/needless_range_loop.stderr @@ -4,7 +4,7 @@ error: the loop variable `i` is only used to index `ns`. 8 | for i in 3..10 { | ^^^^^ | - = note: `-D needless-range-loop` implied by `-D warnings` + = note: `-D clippy::needless-range-loop` implied by `-D warnings` help: consider using an iterator | 8 | for in ns.iter().take(10).skip(3) { diff --git a/tests/ui/needless_return.stderr b/tests/ui/needless_return.stderr index 42dc6e659..094fe3642 100644 --- a/tests/ui/needless_return.stderr +++ b/tests/ui/needless_return.stderr @@ -4,7 +4,7 @@ error: unneeded return statement 11 | return true; | ^^^^^^^^^^^^ help: remove `return` as shown: `true` | - = note: `-D needless-return` implied by `-D warnings` + = note: `-D clippy::needless-return` implied by `-D warnings` error: unneeded return statement --> $DIR/needless_return.rs:15:5 diff --git a/tests/ui/needless_update.stderr b/tests/ui/needless_update.stderr index 3e509870d..acc511984 100644 --- a/tests/ui/needless_update.stderr +++ b/tests/ui/needless_update.stderr @@ -4,7 +4,7 @@ error: struct update has no effect, all the fields in the struct have already be 16 | S { a: 1, b: 1, ..base }; | ^^^^ | - = note: `-D needless-update` implied by `-D warnings` + = note: `-D clippy::needless-update` implied by `-D warnings` error: aborting due to previous error diff --git a/tests/ui/neg_cmp_op_on_partial_ord.stderr b/tests/ui/neg_cmp_op_on_partial_ord.stderr index ccd305611..5fd4ab9ba 100644 --- a/tests/ui/neg_cmp_op_on_partial_ord.stderr +++ b/tests/ui/neg_cmp_op_on_partial_ord.stderr @@ -1,27 +1,27 @@ error: The use of negated comparison operators on partially ordered types produces code that is hard to read and refactor. Please consider using the `partial_cmp` method instead, to make it clear that the two values could be incomparable. - --> $DIR/neg_cmp_op_on_partial_ord.rs:17:21 + --> $DIR/neg_cmp_op_on_partial_ord.rs:19:21 | -17 | let _not_less = !(a_value < another_value); +19 | let _not_less = !(a_value < another_value); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: `-D neg-cmp-op-on-partial-ord` implied by `-D warnings` + = note: `-D clippy::neg-cmp-op-on-partial-ord` implied by `-D warnings` error: The use of negated comparison operators on partially ordered types produces code that is hard to read and refactor. Please consider using the `partial_cmp` method instead, to make it clear that the two values could be incomparable. - --> $DIR/neg_cmp_op_on_partial_ord.rs:20:30 + --> $DIR/neg_cmp_op_on_partial_ord.rs:22:30 | -20 | let _not_less_or_equal = !(a_value <= another_value); +22 | let _not_less_or_equal = !(a_value <= another_value); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: The use of negated comparison operators on partially ordered types produces code that is hard to read and refactor. Please consider using the `partial_cmp` method instead, to make it clear that the two values could be incomparable. - --> $DIR/neg_cmp_op_on_partial_ord.rs:23:24 + --> $DIR/neg_cmp_op_on_partial_ord.rs:25:24 | -23 | let _not_greater = !(a_value > another_value); +25 | let _not_greater = !(a_value > another_value); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ error: The use of negated comparison operators on partially ordered types produces code that is hard to read and refactor. Please consider using the `partial_cmp` method instead, to make it clear that the two values could be incomparable. - --> $DIR/neg_cmp_op_on_partial_ord.rs:26:33 + --> $DIR/neg_cmp_op_on_partial_ord.rs:28:33 | -26 | let _not_greater_or_equal = !(a_value >= another_value); +28 | let _not_greater_or_equal = !(a_value >= another_value); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 4 previous errors diff --git a/tests/ui/neg_multiply.stderr b/tests/ui/neg_multiply.stderr index 1d52ba16e..ba59fdb89 100644 --- a/tests/ui/neg_multiply.stderr +++ b/tests/ui/neg_multiply.stderr @@ -4,7 +4,7 @@ error: Negation by multiplying with -1 30 | x * -1; | ^^^^^^ | - = note: `-D neg-multiply` implied by `-D warnings` + = note: `-D clippy::neg-multiply` implied by `-D warnings` error: Negation by multiplying with -1 --> $DIR/neg_multiply.rs:32:5 diff --git a/tests/ui/never_loop.stderr b/tests/ui/never_loop.stderr index 664be379e..3d1235964 100644 --- a/tests/ui/never_loop.stderr +++ b/tests/ui/never_loop.stderr @@ -1,7 +1,7 @@ error: this loop never actually loops --> $DIR/never_loop.rs:7:5 | -7 | / loop { // never_loop +7 | / loop { // clippy::never_loop 8 | | x += 1; 9 | | if x == 1 { 10 | | return @@ -10,7 +10,7 @@ error: this loop never actually loops 13 | | } | |_____^ | - = note: #[deny(never_loop)] on by default + = note: #[deny(clippy::never_loop)] on by default error: this loop never actually loops --> $DIR/never_loop.rs:28:5 diff --git a/tests/ui/new_without_default.stderr b/tests/ui/new_without_default.stderr index 335e60404..11ece5e87 100644 --- a/tests/ui/new_without_default.stderr +++ b/tests/ui/new_without_default.stderr @@ -1,39 +1,39 @@ error: you should consider deriving a `Default` implementation for `Foo` - --> $DIR/new_without_default.rs:10:5 + --> $DIR/new_without_default.rs:12:5 | -10 | pub fn new() -> Foo { Foo } +12 | pub fn new() -> Foo { Foo } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: `-D new-without-default-derive` implied by `-D warnings` + = note: `-D clippy::new-without-default-derive` implied by `-D warnings` help: try this | -7 | #[derive(Default)] +9 | #[derive(Default)] | error: you should consider deriving a `Default` implementation for `Bar` - --> $DIR/new_without_default.rs:16:5 + --> $DIR/new_without_default.rs:18:5 | -16 | pub fn new() -> Self { Bar } +18 | pub fn new() -> Self { Bar } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this | -13 | #[derive(Default)] +15 | #[derive(Default)] | error: you should consider adding a `Default` implementation for `LtKo<'c>` - --> $DIR/new_without_default.rs:64:5 + --> $DIR/new_without_default.rs:66:5 | -64 | pub fn new() -> LtKo<'c> { unimplemented!() } +66 | pub fn new() -> LtKo<'c> { unimplemented!() } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: `-D new-without-default` implied by `-D warnings` + = note: `-D clippy::new-without-default` implied by `-D warnings` help: try this | -63 | impl Default for LtKo<'c> { -64 | fn default() -> Self { -65 | Self::new() -66 | } -67 | } +65 | impl Default for LtKo<'c> { +66 | fn default() -> Self { +67 | Self::new() +68 | } +69 | } | error: aborting due to 3 previous errors diff --git a/tests/ui/no_effect.stderr b/tests/ui/no_effect.stderr index 7ff0425eb..2429d934c 100644 --- a/tests/ui/no_effect.stderr +++ b/tests/ui/no_effect.stderr @@ -1,275 +1,275 @@ -error: statement with no effect - --> $DIR/no_effect.rs:59:5 - | -59 | 0; - | ^^ - | - = note: `-D no-effect` implied by `-D warnings` - -error: statement with no effect - --> $DIR/no_effect.rs:60:5 - | -60 | s2; - | ^^^ - error: statement with no effect --> $DIR/no_effect.rs:61:5 | -61 | Unit; - | ^^^^^ +61 | 0; + | ^^ + | + = note: `-D clippy::no-effect` implied by `-D warnings` error: statement with no effect --> $DIR/no_effect.rs:62:5 | -62 | Tuple(0); - | ^^^^^^^^^ +62 | s2; + | ^^^ error: statement with no effect --> $DIR/no_effect.rs:63:5 | -63 | Struct { field: 0 }; - | ^^^^^^^^^^^^^^^^^^^^ +63 | Unit; + | ^^^^^ error: statement with no effect --> $DIR/no_effect.rs:64:5 | -64 | Struct { ..s }; - | ^^^^^^^^^^^^^^^ +64 | Tuple(0); + | ^^^^^^^^^ error: statement with no effect --> $DIR/no_effect.rs:65:5 | -65 | Union { a: 0 }; - | ^^^^^^^^^^^^^^^ +65 | Struct { field: 0 }; + | ^^^^^^^^^^^^^^^^^^^^ error: statement with no effect --> $DIR/no_effect.rs:66:5 | -66 | Enum::Tuple(0); +66 | Struct { ..s }; | ^^^^^^^^^^^^^^^ error: statement with no effect --> $DIR/no_effect.rs:67:5 | -67 | Enum::Struct { field: 0 }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ +67 | Union { a: 0 }; + | ^^^^^^^^^^^^^^^ error: statement with no effect --> $DIR/no_effect.rs:68:5 | -68 | 5 + 6; - | ^^^^^^ +68 | Enum::Tuple(0); + | ^^^^^^^^^^^^^^^ error: statement with no effect --> $DIR/no_effect.rs:69:5 | -69 | *&42; - | ^^^^^ +69 | Enum::Struct { field: 0 }; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ error: statement with no effect --> $DIR/no_effect.rs:70:5 | -70 | &6; - | ^^^ +70 | 5 + 6; + | ^^^^^^ error: statement with no effect --> $DIR/no_effect.rs:71:5 | -71 | (5, 6, 7); - | ^^^^^^^^^^ +71 | *&42; + | ^^^^^ error: statement with no effect --> $DIR/no_effect.rs:72:5 | -72 | box 42; - | ^^^^^^^ +72 | &6; + | ^^^ error: statement with no effect --> $DIR/no_effect.rs:73:5 | -73 | ..; - | ^^^ +73 | (5, 6, 7); + | ^^^^^^^^^^ error: statement with no effect --> $DIR/no_effect.rs:74:5 | -74 | 5..; - | ^^^^ +74 | box 42; + | ^^^^^^^ error: statement with no effect --> $DIR/no_effect.rs:75:5 | -75 | ..5; - | ^^^^ +75 | ..; + | ^^^ error: statement with no effect --> $DIR/no_effect.rs:76:5 | -76 | 5..6; - | ^^^^^ +76 | 5..; + | ^^^^ + +error: statement with no effect + --> $DIR/no_effect.rs:77:5 + | +77 | ..5; + | ^^^^ error: statement with no effect --> $DIR/no_effect.rs:78:5 | -78 | [42, 55]; - | ^^^^^^^^^ - -error: statement with no effect - --> $DIR/no_effect.rs:79:5 - | -79 | [42, 55][1]; - | ^^^^^^^^^^^^ +78 | 5..6; + | ^^^^^ error: statement with no effect --> $DIR/no_effect.rs:80:5 | -80 | (42, 55).1; - | ^^^^^^^^^^^ +80 | [42, 55]; + | ^^^^^^^^^ error: statement with no effect --> $DIR/no_effect.rs:81:5 | -81 | [42; 55]; - | ^^^^^^^^^ +81 | [42, 55][1]; + | ^^^^^^^^^^^^ error: statement with no effect --> $DIR/no_effect.rs:82:5 | -82 | [42; 55][13]; - | ^^^^^^^^^^^^^ +82 | (42, 55).1; + | ^^^^^^^^^^^ + +error: statement with no effect + --> $DIR/no_effect.rs:83:5 + | +83 | [42; 55]; + | ^^^^^^^^^ error: statement with no effect --> $DIR/no_effect.rs:84:5 | -84 | || x += 5; - | ^^^^^^^^^^ +84 | [42; 55][13]; + | ^^^^^^^^^^^^^ error: statement with no effect --> $DIR/no_effect.rs:86:5 | -86 | FooString { s: s }; +86 | || x += 5; + | ^^^^^^^^^^ + +error: statement with no effect + --> $DIR/no_effect.rs:88:5 + | +88 | FooString { s: s }; | ^^^^^^^^^^^^^^^^^^^ -error: statement can be reduced - --> $DIR/no_effect.rs:97:5 - | -97 | Tuple(get_number()); - | ^^^^^^^^^^^^^^^^^^^^ help: replace it with: `get_number();` - | - = note: `-D unnecessary-operation` implied by `-D warnings` - -error: statement can be reduced - --> $DIR/no_effect.rs:98:5 - | -98 | Struct { field: get_number() }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `get_number();` - error: statement can be reduced --> $DIR/no_effect.rs:99:5 | -99 | Struct { ..get_struct() }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `get_struct();` +99 | Tuple(get_number()); + | ^^^^^^^^^^^^^^^^^^^^ help: replace it with: `get_number();` + | + = note: `-D clippy::unnecessary-operation` implied by `-D warnings` error: statement can be reduced --> $DIR/no_effect.rs:100:5 | -100 | Enum::Tuple(get_number()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `get_number();` +100 | Struct { field: get_number() }; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `get_number();` error: statement can be reduced --> $DIR/no_effect.rs:101:5 | -101 | Enum::Struct { field: get_number() }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `get_number();` +101 | Struct { ..get_struct() }; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `get_struct();` error: statement can be reduced --> $DIR/no_effect.rs:102:5 | -102 | 5 + get_number(); - | ^^^^^^^^^^^^^^^^^ help: replace it with: `5;get_number();` +102 | Enum::Tuple(get_number()); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `get_number();` error: statement can be reduced --> $DIR/no_effect.rs:103:5 | -103 | *&get_number(); - | ^^^^^^^^^^^^^^^ help: replace it with: `get_number();` +103 | Enum::Struct { field: get_number() }; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `get_number();` error: statement can be reduced --> $DIR/no_effect.rs:104:5 | -104 | &get_number(); - | ^^^^^^^^^^^^^^ help: replace it with: `get_number();` +104 | 5 + get_number(); + | ^^^^^^^^^^^^^^^^^ help: replace it with: `5;get_number();` error: statement can be reduced --> $DIR/no_effect.rs:105:5 | -105 | (5, 6, get_number()); - | ^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `5;6;get_number();` +105 | *&get_number(); + | ^^^^^^^^^^^^^^^ help: replace it with: `get_number();` error: statement can be reduced --> $DIR/no_effect.rs:106:5 | -106 | box get_number(); - | ^^^^^^^^^^^^^^^^^ help: replace it with: `get_number();` +106 | &get_number(); + | ^^^^^^^^^^^^^^ help: replace it with: `get_number();` error: statement can be reduced --> $DIR/no_effect.rs:107:5 | -107 | get_number()..; - | ^^^^^^^^^^^^^^^ help: replace it with: `get_number();` +107 | (5, 6, get_number()); + | ^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `5;6;get_number();` error: statement can be reduced --> $DIR/no_effect.rs:108:5 | -108 | ..get_number(); - | ^^^^^^^^^^^^^^^ help: replace it with: `get_number();` +108 | box get_number(); + | ^^^^^^^^^^^^^^^^^ help: replace it with: `get_number();` error: statement can be reduced --> $DIR/no_effect.rs:109:5 | -109 | 5..get_number(); - | ^^^^^^^^^^^^^^^^ help: replace it with: `5;get_number();` +109 | get_number()..; + | ^^^^^^^^^^^^^^^ help: replace it with: `get_number();` error: statement can be reduced --> $DIR/no_effect.rs:110:5 | -110 | [42, get_number()]; - | ^^^^^^^^^^^^^^^^^^^ help: replace it with: `42;get_number();` +110 | ..get_number(); + | ^^^^^^^^^^^^^^^ help: replace it with: `get_number();` error: statement can be reduced --> $DIR/no_effect.rs:111:5 | -111 | [42, 55][get_number() as usize]; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `[42, 55];get_number() as usize;` +111 | 5..get_number(); + | ^^^^^^^^^^^^^^^^ help: replace it with: `5;get_number();` error: statement can be reduced --> $DIR/no_effect.rs:112:5 | -112 | (42, get_number()).1; - | ^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `42;get_number();` +112 | [42, get_number()]; + | ^^^^^^^^^^^^^^^^^^^ help: replace it with: `42;get_number();` error: statement can be reduced --> $DIR/no_effect.rs:113:5 | -113 | [get_number(); 55]; - | ^^^^^^^^^^^^^^^^^^^ help: replace it with: `get_number();` +113 | [42, 55][get_number() as usize]; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `[42, 55];get_number() as usize;` error: statement can be reduced --> $DIR/no_effect.rs:114:5 | -114 | [42; 55][get_number() as usize]; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `[42; 55];get_number() as usize;` +114 | (42, get_number()).1; + | ^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `42;get_number();` error: statement can be reduced --> $DIR/no_effect.rs:115:5 | -115 | {get_number()}; - | ^^^^^^^^^^^^^^^ help: replace it with: `get_number();` +115 | [get_number(); 55]; + | ^^^^^^^^^^^^^^^^^^^ help: replace it with: `get_number();` error: statement can be reduced --> $DIR/no_effect.rs:116:5 | -116 | FooString { s: String::from("blah"), }; +116 | [42; 55][get_number() as usize]; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `[42; 55];get_number() as usize;` + +error: statement can be reduced + --> $DIR/no_effect.rs:117:5 + | +117 | {get_number()}; + | ^^^^^^^^^^^^^^^ help: replace it with: `get_number();` + +error: statement can be reduced + --> $DIR/no_effect.rs:118:5 + | +118 | FooString { s: String::from("blah"), }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `String::from("blah");` error: aborting due to 45 previous errors diff --git a/tests/ui/non_copy_const.stderr b/tests/ui/non_copy_const.stderr index 388c7faba..7f164595b 100644 --- a/tests/ui/non_copy_const.stderr +++ b/tests/ui/non_copy_const.stderr @@ -1,272 +1,272 @@ error: a const item should never be interior mutable - --> $DIR/non_copy_const.rs:10:1 + --> $DIR/non_copy_const.rs:12:1 | -10 | const ATOMIC: AtomicUsize = AtomicUsize::new(5); //~ ERROR interior mutable +12 | const ATOMIC: AtomicUsize = AtomicUsize::new(5); //~ ERROR interior mutable | -----^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | | help: make this a static item: `static` | - = note: #[deny(declare_interior_mutable_const)] on by default + = note: #[deny(clippy::declare_interior_mutable_const)] on by default error: a const item should never be interior mutable - --> $DIR/non_copy_const.rs:11:1 + --> $DIR/non_copy_const.rs:13:1 | -11 | const CELL: Cell = Cell::new(6); //~ ERROR interior mutable +13 | const CELL: Cell = Cell::new(6); //~ ERROR interior mutable | -----^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | | help: make this a static item: `static` error: a const item should never be interior mutable - --> $DIR/non_copy_const.rs:12:1 + --> $DIR/non_copy_const.rs:14:1 | -12 | const ATOMIC_TUPLE: ([AtomicUsize; 1], Vec, u8) = ([ATOMIC], Vec::new(), 7); +14 | const ATOMIC_TUPLE: ([AtomicUsize; 1], Vec, u8) = ([ATOMIC], Vec::new(), 7); | -----^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | | help: make this a static item: `static` error: a const item should never be interior mutable - --> $DIR/non_copy_const.rs:16:42 + --> $DIR/non_copy_const.rs:18:42 | -16 | ($name:ident: $ty:ty = $e:expr) => { const $name: $ty = $e; }; +18 | ($name:ident: $ty:ty = $e:expr) => { const $name: $ty = $e; }; | ^^^^^^^^^^^^^^^^^^^^^^ -17 | } -18 | declare_const!(_ONCE: Once = Once::new()); //~ ERROR interior mutable +19 | } +20 | declare_const!(_ONCE: Once = Once::new()); //~ ERROR interior mutable | ------------------------------------------ in this macro invocation error: a const item should never be interior mutable - --> $DIR/non_copy_const.rs:39:5 + --> $DIR/non_copy_const.rs:41:5 | -39 | const ATOMIC: AtomicUsize; //~ ERROR interior mutable +41 | const ATOMIC: AtomicUsize; //~ ERROR interior mutable | ^^^^^^^^^^^^^^^^^^^^^^^^^^ error: a const item should never be interior mutable - --> $DIR/non_copy_const.rs:43:5 + --> $DIR/non_copy_const.rs:45:5 | -43 | const INPUT: T; +45 | const INPUT: T; | ^^^^^^^^^^^^^^^ | help: consider requiring `T` to be `Copy` - --> $DIR/non_copy_const.rs:43:18 + --> $DIR/non_copy_const.rs:45:18 | -43 | const INPUT: T; +45 | const INPUT: T; | ^ error: a const item should never be interior mutable - --> $DIR/non_copy_const.rs:46:5 + --> $DIR/non_copy_const.rs:48:5 | -46 | const ASSOC: Self::NonCopyType; +48 | const ASSOC: Self::NonCopyType; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | help: consider requiring `>::NonCopyType` to be `Copy` - --> $DIR/non_copy_const.rs:46:18 + --> $DIR/non_copy_const.rs:48:18 | -46 | const ASSOC: Self::NonCopyType; +48 | const ASSOC: Self::NonCopyType; | ^^^^^^^^^^^^^^^^^ error: a const item should never be interior mutable - --> $DIR/non_copy_const.rs:50:5 + --> $DIR/non_copy_const.rs:52:5 | -50 | const AN_INPUT: T = Self::INPUT; +52 | const AN_INPUT: T = Self::INPUT; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | help: consider requiring `T` to be `Copy` - --> $DIR/non_copy_const.rs:50:21 + --> $DIR/non_copy_const.rs:52:21 | -50 | const AN_INPUT: T = Self::INPUT; +52 | const AN_INPUT: T = Self::INPUT; | ^ error: a const item should never be interior mutable - --> $DIR/non_copy_const.rs:16:42 + --> $DIR/non_copy_const.rs:18:42 | -16 | ($name:ident: $ty:ty = $e:expr) => { const $name: $ty = $e; }; +18 | ($name:ident: $ty:ty = $e:expr) => { const $name: $ty = $e; }; | ^^^^^^^^^^^^^^^^^^^^^^ ... -53 | declare_const!(ANOTHER_INPUT: T = Self::INPUT); //~ ERROR interior mutable +55 | declare_const!(ANOTHER_INPUT: T = Self::INPUT); //~ ERROR interior mutable | ----------------------------------------------- in this macro invocation error: a const item should never be interior mutable - --> $DIR/non_copy_const.rs:59:5 + --> $DIR/non_copy_const.rs:61:5 | -59 | const SELF_2: Self; +61 | const SELF_2: Self; | ^^^^^^^^^^^^^^^^^^^ | help: consider requiring `Self` to be `Copy` - --> $DIR/non_copy_const.rs:59:19 + --> $DIR/non_copy_const.rs:61:19 | -59 | const SELF_2: Self; +61 | const SELF_2: Self; | ^^^^ error: a const item should never be interior mutable - --> $DIR/non_copy_const.rs:80:5 + --> $DIR/non_copy_const.rs:82:5 | -80 | const ASSOC_3: AtomicUsize = AtomicUsize::new(14); //~ ERROR interior mutable +82 | const ASSOC_3: AtomicUsize = AtomicUsize::new(14); //~ ERROR interior mutable | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: a const item should never be interior mutable - --> $DIR/non_copy_const.rs:83:5 + --> $DIR/non_copy_const.rs:85:5 | -83 | const U_SELF: U = U::SELF_2; +85 | const U_SELF: U = U::SELF_2; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | help: consider requiring `U` to be `Copy` - --> $DIR/non_copy_const.rs:83:19 + --> $DIR/non_copy_const.rs:85:19 | -83 | const U_SELF: U = U::SELF_2; +85 | const U_SELF: U = U::SELF_2; | ^ error: a const item should never be interior mutable - --> $DIR/non_copy_const.rs:86:5 + --> $DIR/non_copy_const.rs:88:5 | -86 | const T_ASSOC: T::NonCopyType = T::ASSOC; +88 | const T_ASSOC: T::NonCopyType = T::ASSOC; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | help: consider requiring `>::NonCopyType` to be `Copy` - --> $DIR/non_copy_const.rs:86:20 + --> $DIR/non_copy_const.rs:88:20 | -86 | const T_ASSOC: T::NonCopyType = T::ASSOC; +88 | const T_ASSOC: T::NonCopyType = T::ASSOC; | ^^^^^^^^^^^^^^ error: a const item with interior mutability should not be borrowed - --> $DIR/non_copy_const.rs:93:5 + --> $DIR/non_copy_const.rs:95:5 | -93 | ATOMIC.store(1, Ordering::SeqCst); //~ ERROR interior mutability +95 | ATOMIC.store(1, Ordering::SeqCst); //~ ERROR interior mutability | ^^^^^^ | - = note: #[deny(borrow_interior_mutable_const)] on by default + = note: #[deny(clippy::borrow_interior_mutable_const)] on by default = help: assign this const to a local or static variable, and use the variable here error: a const item with interior mutability should not be borrowed - --> $DIR/non_copy_const.rs:94:16 + --> $DIR/non_copy_const.rs:96:16 | -94 | assert_eq!(ATOMIC.load(Ordering::SeqCst), 5); //~ ERROR interior mutability +96 | assert_eq!(ATOMIC.load(Ordering::SeqCst), 5); //~ ERROR interior mutability | ^^^^^^ | = help: assign this const to a local or static variable, and use the variable here error: a const item with interior mutability should not be borrowed - --> $DIR/non_copy_const.rs:96:5 + --> $DIR/non_copy_const.rs:98:5 | -96 | ATOMIC_USIZE_INIT.store(2, Ordering::SeqCst); //~ ERROR interior mutability +98 | ATOMIC_USIZE_INIT.store(2, Ordering::SeqCst); //~ ERROR interior mutability | ^^^^^^^^^^^^^^^^^ | = help: assign this const to a local or static variable, and use the variable here error: a const item with interior mutability should not be borrowed - --> $DIR/non_copy_const.rs:97:16 + --> $DIR/non_copy_const.rs:99:16 | -97 | assert_eq!(ATOMIC_USIZE_INIT.load(Ordering::SeqCst), 0); //~ ERROR interior mutability +99 | assert_eq!(ATOMIC_USIZE_INIT.load(Ordering::SeqCst), 0); //~ ERROR interior mutability | ^^^^^^^^^^^^^^^^^ | = help: assign this const to a local or static variable, and use the variable here error: a const item with interior mutability should not be borrowed - --> $DIR/non_copy_const.rs:100:22 + --> $DIR/non_copy_const.rs:102:22 | -100 | let _once_ref = &ONCE_INIT; //~ ERROR interior mutability +102 | let _once_ref = &ONCE_INIT; //~ ERROR interior mutability | ^^^^^^^^^ | = help: assign this const to a local or static variable, and use the variable here error: a const item with interior mutability should not be borrowed - --> $DIR/non_copy_const.rs:101:25 + --> $DIR/non_copy_const.rs:103:25 | -101 | let _once_ref_2 = &&ONCE_INIT; //~ ERROR interior mutability +103 | let _once_ref_2 = &&ONCE_INIT; //~ ERROR interior mutability | ^^^^^^^^^ | = help: assign this const to a local or static variable, and use the variable here error: a const item with interior mutability should not be borrowed - --> $DIR/non_copy_const.rs:102:27 + --> $DIR/non_copy_const.rs:104:27 | -102 | let _once_ref_4 = &&&&ONCE_INIT; //~ ERROR interior mutability +104 | let _once_ref_4 = &&&&ONCE_INIT; //~ ERROR interior mutability | ^^^^^^^^^ | = help: assign this const to a local or static variable, and use the variable here error: a const item with interior mutability should not be borrowed - --> $DIR/non_copy_const.rs:103:26 + --> $DIR/non_copy_const.rs:105:26 | -103 | let _once_mut = &mut ONCE_INIT; //~ ERROR interior mutability +105 | let _once_mut = &mut ONCE_INIT; //~ ERROR interior mutability | ^^^^^^^^^ | = help: assign this const to a local or static variable, and use the variable here error: a const item with interior mutability should not be borrowed - --> $DIR/non_copy_const.rs:114:14 + --> $DIR/non_copy_const.rs:116:14 | -114 | let _ = &ATOMIC_TUPLE; //~ ERROR interior mutability +116 | let _ = &ATOMIC_TUPLE; //~ ERROR interior mutability | ^^^^^^^^^^^^ | = help: assign this const to a local or static variable, and use the variable here -error: a const item with interior mutability should not be borrowed - --> $DIR/non_copy_const.rs:115:14 - | -115 | let _ = &ATOMIC_TUPLE.0; //~ ERROR interior mutability - | ^^^^^^^^^^^^ - | - = help: assign this const to a local or static variable, and use the variable here - -error: a const item with interior mutability should not be borrowed - --> $DIR/non_copy_const.rs:116:19 - | -116 | let _ = &(&&&&ATOMIC_TUPLE).0; //~ ERROR interior mutability - | ^^^^^^^^^^^^ - | - = help: assign this const to a local or static variable, and use the variable here - error: a const item with interior mutability should not be borrowed --> $DIR/non_copy_const.rs:117:14 | -117 | let _ = &ATOMIC_TUPLE.0[0]; //~ ERROR interior mutability +117 | let _ = &ATOMIC_TUPLE.0; //~ ERROR interior mutability | ^^^^^^^^^^^^ | = help: assign this const to a local or static variable, and use the variable here error: a const item with interior mutability should not be borrowed - --> $DIR/non_copy_const.rs:118:13 + --> $DIR/non_copy_const.rs:118:19 | -118 | let _ = ATOMIC_TUPLE.0[0].load(Ordering::SeqCst); //~ ERROR interior mutability +118 | let _ = &(&&&&ATOMIC_TUPLE).0; //~ ERROR interior mutability + | ^^^^^^^^^^^^ + | + = help: assign this const to a local or static variable, and use the variable here + +error: a const item with interior mutability should not be borrowed + --> $DIR/non_copy_const.rs:119:14 + | +119 | let _ = &ATOMIC_TUPLE.0[0]; //~ ERROR interior mutability + | ^^^^^^^^^^^^ + | + = help: assign this const to a local or static variable, and use the variable here + +error: a const item with interior mutability should not be borrowed + --> $DIR/non_copy_const.rs:120:13 + | +120 | let _ = ATOMIC_TUPLE.0[0].load(Ordering::SeqCst); //~ ERROR interior mutability | ^^^^^^^^^^^^ | = help: assign this const to a local or static variable, and use the variable here error: a const item with interior mutability should not be borrowed - --> $DIR/non_copy_const.rs:124:13 + --> $DIR/non_copy_const.rs:126:13 | -124 | let _ = ATOMIC_TUPLE.0[0]; //~ ERROR interior mutability +126 | let _ = ATOMIC_TUPLE.0[0]; //~ ERROR interior mutability | ^^^^^^^^^^^^ | = help: assign this const to a local or static variable, and use the variable here error: a const item with interior mutability should not be borrowed - --> $DIR/non_copy_const.rs:129:5 + --> $DIR/non_copy_const.rs:131:5 | -129 | CELL.set(2); //~ ERROR interior mutability +131 | CELL.set(2); //~ ERROR interior mutability | ^^^^ | = help: assign this const to a local or static variable, and use the variable here error: a const item with interior mutability should not be borrowed - --> $DIR/non_copy_const.rs:130:16 + --> $DIR/non_copy_const.rs:132:16 | -130 | assert_eq!(CELL.get(), 6); //~ ERROR interior mutability +132 | assert_eq!(CELL.get(), 6); //~ ERROR interior mutability | ^^^^ | = help: assign this const to a local or static variable, and use the variable here error: a const item with interior mutability should not be borrowed - --> $DIR/non_copy_const.rs:143:5 + --> $DIR/non_copy_const.rs:145:5 | -143 | u64::ATOMIC.store(5, Ordering::SeqCst); //~ ERROR interior mutability +145 | u64::ATOMIC.store(5, Ordering::SeqCst); //~ ERROR interior mutability | ^^^^^^^^^^^ | = help: assign this const to a local or static variable, and use the variable here error: a const item with interior mutability should not be borrowed - --> $DIR/non_copy_const.rs:144:16 + --> $DIR/non_copy_const.rs:146:16 | -144 | assert_eq!(u64::ATOMIC.load(Ordering::SeqCst), 9); //~ ERROR interior mutability +146 | assert_eq!(u64::ATOMIC.load(Ordering::SeqCst), 9); //~ ERROR interior mutability | ^^^^^^^^^^^ | = help: assign this const to a local or static variable, and use the variable here diff --git a/tests/ui/non_expressive_names.stderr b/tests/ui/non_expressive_names.stderr index b4927e69e..b1dd62ed8 100644 --- a/tests/ui/non_expressive_names.stderr +++ b/tests/ui/non_expressive_names.stderr @@ -4,7 +4,7 @@ error: binding's name is too similar to existing binding 18 | let bpple: i32; | ^^^^^ | - = note: `-D similar-names` implied by `-D warnings` + = note: `-D clippy::similar-names` implied by `-D warnings` note: existing binding defined here --> $DIR/non_expressive_names.rs:16:9 | @@ -109,7 +109,7 @@ error: 5th binding whose name is just one char 120 | let e: i32; | ^ | - = note: `-D many-single-char-names` implied by `-D warnings` + = note: `-D clippy::many-single-char-names` implied by `-D warnings` error: 5th binding whose name is just one char --> $DIR/non_expressive_names.rs:123:17 @@ -135,7 +135,7 @@ error: consider choosing a more descriptive name 139 | let _1 = 1; //~ERROR Consider a more descriptive name | ^^ | - = note: `-D just-underscores-and-digits` implied by `-D warnings` + = note: `-D clippy::just-underscores-and-digits` implied by `-D warnings` error: consider choosing a more descriptive name --> $DIR/non_expressive_names.rs:140:9 diff --git a/tests/ui/ok_expect.stderr b/tests/ui/ok_expect.stderr index da2d3b950..7c158b520 100644 --- a/tests/ui/ok_expect.stderr +++ b/tests/ui/ok_expect.stderr @@ -4,7 +4,7 @@ error: called `ok().expect()` on a Result value. You can call `expect` directly 14 | res.ok().expect("disaster!"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: `-D ok-expect` implied by `-D warnings` + = note: `-D clippy::ok-expect` implied by `-D warnings` error: called `ok().expect()` on a Result value. You can call `expect` directly on the `Result` --> $DIR/ok_expect.rs:20:5 diff --git a/tests/ui/ok_if_let.stderr b/tests/ui/ok_if_let.stderr index e1371d924..eac49032e 100644 --- a/tests/ui/ok_if_let.stderr +++ b/tests/ui/ok_if_let.stderr @@ -8,7 +8,7 @@ error: Matching on `Some` with `ok()` is redundant 11 | | } | |_____^ | - = note: `-D if-let-some-result` implied by `-D warnings` + = note: `-D clippy::if-let-some-result` implied by `-D warnings` = help: Consider matching on `Ok(y)` and removing the call to `ok` instead error: aborting due to previous error diff --git a/tests/ui/op_ref.stderr b/tests/ui/op_ref.stderr index 4a6ff6fe6..398e3a6e9 100644 --- a/tests/ui/op_ref.stderr +++ b/tests/ui/op_ref.stderr @@ -4,7 +4,7 @@ error: needlessly taken reference of both operands 13 | let foo = &5 - &6; | ^^^^^^^ | - = note: `-D op-ref` implied by `-D warnings` + = note: `-D clippy::op-ref` implied by `-D warnings` help: use the values directly | 13 | let foo = 5 - 6; diff --git a/tests/ui/open_options.stderr b/tests/ui/open_options.stderr index f0d419041..64ad667a4 100644 --- a/tests/ui/open_options.stderr +++ b/tests/ui/open_options.stderr @@ -4,7 +4,7 @@ error: file opened with "truncate" and "read" 8 | OpenOptions::new().read(true).truncate(true).open("foo.txt"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: `-D nonsensical-open-options` implied by `-D warnings` + = note: `-D clippy::nonsensical-open-options` implied by `-D warnings` error: file opened with "append" and "truncate" --> $DIR/open_options.rs:9:5 diff --git a/tests/ui/option_map_unit_fn.stderr b/tests/ui/option_map_unit_fn.stderr index 3ca57a65b..77fe24d26 100644 --- a/tests/ui/option_map_unit_fn.stderr +++ b/tests/ui/option_map_unit_fn.stderr @@ -1,13 +1,3 @@ -error: called `map(f)` on an Option value where `f` is a unit function - --> $DIR/option_map_unit_fn.rs:32:5 - | -32 | x.field.map(do_nothing); - | ^^^^^^^^^^^^^^^^^^^^^^^- - | | - | help: try this: `if let Some(x_field) = x.field { do_nothing(...) }` - | - = note: `-D option-map-unit-fn` implied by `-D warnings` - error: called `map(f)` on an Option value where `f` is a unit function --> $DIR/option_map_unit_fn.rs:34:5 | @@ -15,193 +5,203 @@ error: called `map(f)` on an Option value where `f` is a unit function | ^^^^^^^^^^^^^^^^^^^^^^^- | | | help: try this: `if let Some(x_field) = x.field { do_nothing(...) }` + | + = note: `-D clippy::option-map-unit-fn` implied by `-D warnings` error: called `map(f)` on an Option value where `f` is a unit function --> $DIR/option_map_unit_fn.rs:36:5 | -36 | x.field.map(diverge); +36 | x.field.map(do_nothing); + | ^^^^^^^^^^^^^^^^^^^^^^^- + | | + | help: try this: `if let Some(x_field) = x.field { do_nothing(...) }` + +error: called `map(f)` on an Option value where `f` is a unit function + --> $DIR/option_map_unit_fn.rs:38:5 + | +38 | x.field.map(diverge); | ^^^^^^^^^^^^^^^^^^^^- | | | help: try this: `if let Some(x_field) = x.field { diverge(...) }` error: called `map(f)` on an Option value where `f` is a unit closure - --> $DIR/option_map_unit_fn.rs:42:5 + --> $DIR/option_map_unit_fn.rs:44:5 | -42 | x.field.map(|value| x.do_option_nothing(value + captured)); +44 | x.field.map(|value| x.do_option_nothing(value + captured)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- | | | help: try this: `if let Some(value) = x.field { x.do_option_nothing(value + captured) }` error: called `map(f)` on an Option value where `f` is a unit closure - --> $DIR/option_map_unit_fn.rs:44:5 + --> $DIR/option_map_unit_fn.rs:46:5 | -44 | x.field.map(|value| { x.do_option_plus_one(value + captured); }); +46 | x.field.map(|value| { x.do_option_plus_one(value + captured); }); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- | | | help: try this: `if let Some(value) = x.field { x.do_option_plus_one(value + captured); }` -error: called `map(f)` on an Option value where `f` is a unit closure - --> $DIR/option_map_unit_fn.rs:47:5 - | -47 | x.field.map(|value| do_nothing(value + captured)); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- - | | - | help: try this: `if let Some(value) = x.field { do_nothing(value + captured) }` - error: called `map(f)` on an Option value where `f` is a unit closure --> $DIR/option_map_unit_fn.rs:49:5 | -49 | x.field.map(|value| { do_nothing(value + captured) }); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- +49 | x.field.map(|value| do_nothing(value + captured)); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- | | | help: try this: `if let Some(value) = x.field { do_nothing(value + captured) }` error: called `map(f)` on an Option value where `f` is a unit closure --> $DIR/option_map_unit_fn.rs:51:5 | -51 | x.field.map(|value| { do_nothing(value + captured); }); +51 | x.field.map(|value| { do_nothing(value + captured) }); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- + | | + | help: try this: `if let Some(value) = x.field { do_nothing(value + captured) }` + +error: called `map(f)` on an Option value where `f` is a unit closure + --> $DIR/option_map_unit_fn.rs:53:5 + | +53 | x.field.map(|value| { do_nothing(value + captured); }); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- | | | help: try this: `if let Some(value) = x.field { do_nothing(value + captured); }` error: called `map(f)` on an Option value where `f` is a unit closure - --> $DIR/option_map_unit_fn.rs:53:5 + --> $DIR/option_map_unit_fn.rs:55:5 | -53 | x.field.map(|value| { { do_nothing(value + captured); } }); +55 | x.field.map(|value| { { do_nothing(value + captured); } }); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- | | | help: try this: `if let Some(value) = x.field { do_nothing(value + captured); }` -error: called `map(f)` on an Option value where `f` is a unit closure - --> $DIR/option_map_unit_fn.rs:56:5 - | -56 | x.field.map(|value| diverge(value + captured)); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- - | | - | help: try this: `if let Some(value) = x.field { diverge(value + captured) }` - error: called `map(f)` on an Option value where `f` is a unit closure --> $DIR/option_map_unit_fn.rs:58:5 | -58 | x.field.map(|value| { diverge(value + captured) }); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- +58 | x.field.map(|value| diverge(value + captured)); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- | | | help: try this: `if let Some(value) = x.field { diverge(value + captured) }` error: called `map(f)` on an Option value where `f` is a unit closure --> $DIR/option_map_unit_fn.rs:60:5 | -60 | x.field.map(|value| { diverge(value + captured); }); +60 | x.field.map(|value| { diverge(value + captured) }); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- + | | + | help: try this: `if let Some(value) = x.field { diverge(value + captured) }` + +error: called `map(f)` on an Option value where `f` is a unit closure + --> $DIR/option_map_unit_fn.rs:62:5 + | +62 | x.field.map(|value| { diverge(value + captured); }); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- | | | help: try this: `if let Some(value) = x.field { diverge(value + captured); }` error: called `map(f)` on an Option value where `f` is a unit closure - --> $DIR/option_map_unit_fn.rs:62:5 + --> $DIR/option_map_unit_fn.rs:64:5 | -62 | x.field.map(|value| { { diverge(value + captured); } }); +64 | x.field.map(|value| { { diverge(value + captured); } }); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- | | | help: try this: `if let Some(value) = x.field { diverge(value + captured); }` error: called `map(f)` on an Option value where `f` is a unit closure - --> $DIR/option_map_unit_fn.rs:67:5 + --> $DIR/option_map_unit_fn.rs:69:5 | -67 | x.field.map(|value| { let y = plus_one(value + captured); }); +69 | x.field.map(|value| { let y = plus_one(value + captured); }); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- | | | help: try this: `if let Some(value) = x.field { let y = plus_one(value + captured); }` error: called `map(f)` on an Option value where `f` is a unit closure - --> $DIR/option_map_unit_fn.rs:69:5 + --> $DIR/option_map_unit_fn.rs:71:5 | -69 | x.field.map(|value| { plus_one(value + captured); }); +71 | x.field.map(|value| { plus_one(value + captured); }); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- | | | help: try this: `if let Some(value) = x.field { plus_one(value + captured); }` error: called `map(f)` on an Option value where `f` is a unit closure - --> $DIR/option_map_unit_fn.rs:71:5 + --> $DIR/option_map_unit_fn.rs:73:5 | -71 | x.field.map(|value| { { plus_one(value + captured); } }); +73 | x.field.map(|value| { { plus_one(value + captured); } }); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- | | | help: try this: `if let Some(value) = x.field { plus_one(value + captured); }` error: called `map(f)` on an Option value where `f` is a unit closure - --> $DIR/option_map_unit_fn.rs:74:5 + --> $DIR/option_map_unit_fn.rs:76:5 | -74 | x.field.map(|ref value| { do_nothing(value + captured) }); +76 | x.field.map(|ref value| { do_nothing(value + captured) }); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- | | | help: try this: `if let Some(ref value) = x.field { do_nothing(value + captured) }` error: called `map(f)` on an Option value where `f` is a unit closure - --> $DIR/option_map_unit_fn.rs:77:5 + --> $DIR/option_map_unit_fn.rs:79:5 | -77 | x.field.map(|value| { do_nothing(value); do_nothing(value) }); +79 | x.field.map(|value| { do_nothing(value); do_nothing(value) }); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- | | | help: try this: `if let Some(value) = x.field { ... }` error: called `map(f)` on an Option value where `f` is a unit closure - --> $DIR/option_map_unit_fn.rs:79:5 + --> $DIR/option_map_unit_fn.rs:81:5 | -79 | x.field.map(|value| if value > 0 { do_nothing(value); do_nothing(value) }); +81 | x.field.map(|value| if value > 0 { do_nothing(value); do_nothing(value) }); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- | | | help: try this: `if let Some(value) = x.field { ... }` error: called `map(f)` on an Option value where `f` is a unit closure - --> $DIR/option_map_unit_fn.rs:83:5 + --> $DIR/option_map_unit_fn.rs:85:5 | -83 | x.field.map(|value| { +85 | x.field.map(|value| { | _____^ | |_____| | || -84 | || do_nothing(value); -85 | || do_nothing(value) -86 | || }); +86 | || do_nothing(value); +87 | || do_nothing(value) +88 | || }); | ||______^- help: try this: `if let Some(value) = x.field { ... }` | |_______| | error: called `map(f)` on an Option value where `f` is a unit closure - --> $DIR/option_map_unit_fn.rs:87:5 + --> $DIR/option_map_unit_fn.rs:89:5 | -87 | x.field.map(|value| { do_nothing(value); do_nothing(value); }); +89 | x.field.map(|value| { do_nothing(value); do_nothing(value); }); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- | | | help: try this: `if let Some(value) = x.field { ... }` error: called `map(f)` on an Option value where `f` is a unit function - --> $DIR/option_map_unit_fn.rs:90:5 + --> $DIR/option_map_unit_fn.rs:92:5 | -90 | Some(42).map(diverge); +92 | Some(42).map(diverge); | ^^^^^^^^^^^^^^^^^^^^^- | | | help: try this: `if let Some(_) = Some(42) { diverge(...) }` error: called `map(f)` on an Option value where `f` is a unit function - --> $DIR/option_map_unit_fn.rs:91:5 + --> $DIR/option_map_unit_fn.rs:93:5 | -91 | "12".parse::().ok().map(diverge); +93 | "12".parse::().ok().map(diverge); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- | | | help: try this: `if let Some(_) = "12".parse::().ok() { diverge(...) }` error: called `map(f)` on an Option value where `f` is a unit function - --> $DIR/option_map_unit_fn.rs:92:5 + --> $DIR/option_map_unit_fn.rs:94:5 | -92 | Some(plus_one(1)).map(do_nothing); +94 | Some(plus_one(1)).map(do_nothing); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- | | | help: try this: `if let Some(_) = Some(plus_one(1)) { do_nothing(...) }` error: called `map(f)` on an Option value where `f` is a unit function - --> $DIR/option_map_unit_fn.rs:96:5 + --> $DIR/option_map_unit_fn.rs:98:5 | -96 | y.map(do_nothing); +98 | y.map(do_nothing); | ^^^^^^^^^^^^^^^^^- | | | help: try this: `if let Some(_y) = y { do_nothing(...) }` diff --git a/tests/ui/option_option.stderr b/tests/ui/option_option.stderr index 19e00efae..4341857cc 100644 --- a/tests/ui/option_option.stderr +++ b/tests/ui/option_option.stderr @@ -4,7 +4,7 @@ error: consider using `Option` instead of `Option>` or a custom enu 1 | fn input(_: Option>) { | ^^^^^^^^^^^^^^^^^^ | - = note: `-D option-option` implied by `-D warnings` + = note: `-D clippy::option-option` implied by `-D warnings` error: consider using `Option` instead of `Option>` or a custom enum if you need to distinguish all 3 cases --> $DIR/option_option.rs:4:16 diff --git a/tests/ui/overflow_check_conditional.stderr b/tests/ui/overflow_check_conditional.stderr index adf353a1c..9659e352a 100644 --- a/tests/ui/overflow_check_conditional.stderr +++ b/tests/ui/overflow_check_conditional.stderr @@ -4,7 +4,7 @@ error: You are trying to use classic C overflow conditions that will fail in Rus 11 | if a + b < a { | ^^^^^^^^^ | - = note: `-D overflow-check-conditional` implied by `-D warnings` + = note: `-D clippy::overflow-check-conditional` implied by `-D warnings` error: You are trying to use classic C overflow conditions that will fail in Rust. --> $DIR/overflow_check_conditional.rs:14:5 diff --git a/tests/ui/panic_unimplemented.stderr b/tests/ui/panic_unimplemented.stderr index 3bf5589c4..c5ce42f4c 100644 --- a/tests/ui/panic_unimplemented.stderr +++ b/tests/ui/panic_unimplemented.stderr @@ -4,7 +4,7 @@ error: you probably are missing some parameter in your format string 8 | panic!("{}"); | ^^^^ | - = note: `-D panic-params` implied by `-D warnings` + = note: `-D clippy::panic-params` implied by `-D warnings` error: you probably are missing some parameter in your format string --> $DIR/panic_unimplemented.rs:10:16 @@ -30,7 +30,7 @@ error: `unimplemented` should not be present in production code 58 | unimplemented!(); | ^^^^^^^^^^^^^^^^^ | - = note: `-D unimplemented` implied by `-D warnings` + = note: `-D clippy::unimplemented` implied by `-D warnings` error: aborting due to 5 previous errors diff --git a/tests/ui/partialeq_ne_impl.stderr b/tests/ui/partialeq_ne_impl.stderr index 5e536cc51..773bed8fd 100644 --- a/tests/ui/partialeq_ne_impl.stderr +++ b/tests/ui/partialeq_ne_impl.stderr @@ -4,7 +4,7 @@ error: re-implementing `PartialEq::ne` is unnecessary 10 | fn ne(&self, _: &Foo) -> bool { false } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: `-D partialeq-ne-impl` implied by `-D warnings` + = note: `-D clippy::partialeq-ne-impl` implied by `-D warnings` error: aborting due to previous error diff --git a/tests/ui/patterns.stderr b/tests/ui/patterns.stderr index 59bce3a9a..ce8aab7e6 100644 --- a/tests/ui/patterns.stderr +++ b/tests/ui/patterns.stderr @@ -4,7 +4,7 @@ error: the `y @ _` pattern can be written as just `y` 10 | y @ _ => (), | ^^^^^ | - = note: `-D redundant-pattern` implied by `-D warnings` + = note: `-D clippy::redundant-pattern` implied by `-D warnings` error: aborting due to previous error diff --git a/tests/ui/precedence.stderr b/tests/ui/precedence.stderr index 92c136474..5ec1732ee 100644 --- a/tests/ui/precedence.stderr +++ b/tests/ui/precedence.stderr @@ -4,7 +4,7 @@ error: operator precedence can trip the unwary 18 | 1 << 2 + 3; | ^^^^^^^^^^ help: consider parenthesizing your expression: `1 << (2 + 3)` | - = note: `-D precedence` implied by `-D warnings` + = note: `-D clippy::precedence` implied by `-D warnings` error: operator precedence can trip the unwary --> $DIR/precedence.rs:19:5 diff --git a/tests/ui/print.stderr b/tests/ui/print.stderr index f2d2afd9b..92a2f2f96 100644 --- a/tests/ui/print.stderr +++ b/tests/ui/print.stderr @@ -4,7 +4,7 @@ error: use of `Debug`-based formatting 13 | write!(f, "{:?}", 43.1415) | ^^^^^^ | - = note: `-D use-debug` implied by `-D warnings` + = note: `-D clippy::use-debug` implied by `-D warnings` error: use of `Debug`-based formatting --> $DIR/print.rs:20:19 @@ -18,7 +18,7 @@ error: use of `println!` 25 | println!("Hello"); | ^^^^^^^^^^^^^^^^^ | - = note: `-D print-stdout` implied by `-D warnings` + = note: `-D clippy::print-stdout` implied by `-D warnings` error: use of `print!` --> $DIR/print.rs:26:5 diff --git a/tests/ui/print_literal.stderr b/tests/ui/print_literal.stderr index cada26c61..bd13f5d17 100644 --- a/tests/ui/print_literal.stderr +++ b/tests/ui/print_literal.stderr @@ -4,7 +4,7 @@ error: literal with an empty format string 24 | println!("{} of {:b} people know binary, the other half doesn't", 1, 2); | ^ | - = note: `-D print-literal` implied by `-D warnings` + = note: `-D clippy::print-literal` implied by `-D warnings` error: literal with an empty format string --> $DIR/print_literal.rs:25:24 diff --git a/tests/ui/print_with_newline.stderr b/tests/ui/print_with_newline.stderr index 58413a9b4..12c4ecb2f 100644 --- a/tests/ui/print_with_newline.stderr +++ b/tests/ui/print_with_newline.stderr @@ -4,7 +4,7 @@ error: using `print!()` with a format string that ends in a single newline, cons 7 | print!("Hello/n"); | ^^^^^^^^^^^^^^^^^ | - = note: `-D print-with-newline` implied by `-D warnings` + = note: `-D clippy::print-with-newline` implied by `-D warnings` error: using `print!()` with a format string that ends in a single newline, consider using `println!()` instead --> $DIR/print_with_newline.rs:8:5 diff --git a/tests/ui/println_empty_string.stderr b/tests/ui/println_empty_string.stderr index cff3f9880..96d158384 100644 --- a/tests/ui/println_empty_string.stderr +++ b/tests/ui/println_empty_string.stderr @@ -4,7 +4,7 @@ error: using `println!("")` 3 | println!(""); | ^^^^^^^^^^^^ help: replace it with: `println!()` | - = note: `-D println-empty-string` implied by `-D warnings` + = note: `-D clippy::println-empty-string` implied by `-D warnings` error: using `println!("")` --> $DIR/println_empty_string.rs:6:14 diff --git a/tests/ui/ptr_arg.stderr b/tests/ui/ptr_arg.stderr index a29e393ba..6c16443f5 100644 --- a/tests/ui/ptr_arg.stderr +++ b/tests/ui/ptr_arg.stderr @@ -1,85 +1,85 @@ error: writing `&Vec<_>` instead of `&[_]` involves one more reference and cannot be used with non-Vec-based slices. - --> $DIR/ptr_arg.rs:6:14 + --> $DIR/ptr_arg.rs:8:14 | -6 | fn do_vec(x: &Vec) { +8 | fn do_vec(x: &Vec) { | ^^^^^^^^^ help: change this to: `&[i64]` | - = note: `-D ptr-arg` implied by `-D warnings` + = note: `-D clippy::ptr-arg` implied by `-D warnings` error: writing `&String` instead of `&str` involves a new object where a slice will do. - --> $DIR/ptr_arg.rs:14:14 + --> $DIR/ptr_arg.rs:16:14 | -14 | fn do_str(x: &String) { +16 | fn do_str(x: &String) { | ^^^^^^^ help: change this to: `&str` error: writing `&Vec<_>` instead of `&[_]` involves one more reference and cannot be used with non-Vec-based slices. - --> $DIR/ptr_arg.rs:27:18 + --> $DIR/ptr_arg.rs:29:18 | -27 | fn do_vec(x: &Vec); +29 | fn do_vec(x: &Vec); | ^^^^^^^^^ help: change this to: `&[i64]` error: writing `&Vec<_>` instead of `&[_]` involves one more reference and cannot be used with non-Vec-based slices. - --> $DIR/ptr_arg.rs:40:14 + --> $DIR/ptr_arg.rs:42:14 | -40 | fn cloned(x: &Vec) -> Vec { +42 | fn cloned(x: &Vec) -> Vec { | ^^^^^^^^ help: change this to | -40 | fn cloned(x: &[u8]) -> Vec { +42 | fn cloned(x: &[u8]) -> Vec { | ^^^^^ help: change `x.clone()` to | -41 | let e = x.to_owned(); +43 | let e = x.to_owned(); | ^^^^^^^^^^^^ help: change `x.clone()` to | -46 | x.to_owned() +48 | x.to_owned() | error: writing `&String` instead of `&str` involves a new object where a slice will do. - --> $DIR/ptr_arg.rs:49:18 + --> $DIR/ptr_arg.rs:51:18 | -49 | fn str_cloned(x: &String) -> String { +51 | fn str_cloned(x: &String) -> String { | ^^^^^^^ help: change this to | -49 | fn str_cloned(x: &str) -> String { +51 | fn str_cloned(x: &str) -> String { | ^^^^ help: change `x.clone()` to | -50 | let a = x.to_string(); +52 | let a = x.to_string(); | ^^^^^^^^^^^^^ help: change `x.clone()` to | -51 | let b = x.to_string(); +53 | let b = x.to_string(); | ^^^^^^^^^^^^^ help: change `x.clone()` to | -56 | x.to_string() +58 | x.to_string() | error: writing `&String` instead of `&str` involves a new object where a slice will do. - --> $DIR/ptr_arg.rs:59:44 + --> $DIR/ptr_arg.rs:61:44 | -59 | fn false_positive_capacity(x: &Vec, y: &String) { +61 | fn false_positive_capacity(x: &Vec, y: &String) { | ^^^^^^^ help: change this to | -59 | fn false_positive_capacity(x: &Vec, y: &str) { +61 | fn false_positive_capacity(x: &Vec, y: &str) { | ^^^^ help: change `y.clone()` to | -61 | let b = y.to_string(); +63 | let b = y.to_string(); | ^^^^^^^^^^^^^ help: change `y.as_str()` to | -62 | let c = y; +64 | let c = y; | ^ error: using a reference to `Cow` is not recommended. - --> $DIR/ptr_arg.rs:71:25 + --> $DIR/ptr_arg.rs:73:25 | -71 | fn test_cow_with_ref(c: &Cow<[i32]>) { +73 | fn test_cow_with_ref(c: &Cow<[i32]>) { | ^^^^^^^^^^^ help: change this to: `&[i32]` error: aborting due to 7 previous errors diff --git a/tests/ui/question_mark.stderr b/tests/ui/question_mark.stderr index e97b18698..68c0e5e38 100644 --- a/tests/ui/question_mark.stderr +++ b/tests/ui/question_mark.stderr @@ -7,7 +7,7 @@ error: this block may be rewritten with the `?` operator 4 | | } | |_____^ help: replace_it_with: `a?;` | - = note: `-D question-mark` implied by `-D warnings` + = note: `-D clippy::question-mark` implied by `-D warnings` error: this block may be rewritten with the `?` operator --> $DIR/question_mark.rs:37:3 diff --git a/tests/ui/range.stderr b/tests/ui/range.stderr index 064429c33..651ff266c 100644 --- a/tests/ui/range.stderr +++ b/tests/ui/range.stderr @@ -4,7 +4,7 @@ error: Iterator::step_by(0) will panic at runtime 10 | let _ = (0..1).step_by(0); | ^^^^^^^^^^^^^^^^^ | - = note: `-D iterator-step-by-zero` implied by `-D warnings` + = note: `-D clippy::iterator-step-by-zero` implied by `-D warnings` error: Iterator::step_by(0) will panic at runtime --> $DIR/range.rs:14:13 @@ -30,7 +30,7 @@ error: It is more idiomatic to use v1.iter().enumerate() 26 | let _x = v1.iter().zip(0..v1.len()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: `-D range-zip-with-len` implied by `-D warnings` + = note: `-D clippy::range-zip-with-len` implied by `-D warnings` error: Iterator::step_by(0) will panic at runtime --> $DIR/range.rs:30:13 diff --git a/tests/ui/range_plus_minus_one.stderr b/tests/ui/range_plus_minus_one.stderr index 1990300ef..083c153ad 100644 --- a/tests/ui/range_plus_minus_one.stderr +++ b/tests/ui/range_plus_minus_one.stderr @@ -1,47 +1,47 @@ error: an inclusive range would be more readable - --> $DIR/range_plus_minus_one.rs:10:14 + --> $DIR/range_plus_minus_one.rs:12:14 | -10 | for _ in 0..3+1 { } +12 | for _ in 0..3+1 { } | ^^^^^^ help: use: `0..=3` | - = note: `-D range-plus-one` implied by `-D warnings` + = note: `-D clippy::range-plus-one` implied by `-D warnings` error: an inclusive range would be more readable - --> $DIR/range_plus_minus_one.rs:13:14 + --> $DIR/range_plus_minus_one.rs:15:14 | -13 | for _ in 0..1+5 { } +15 | for _ in 0..1+5 { } | ^^^^^^ help: use: `0..=5` error: an inclusive range would be more readable - --> $DIR/range_plus_minus_one.rs:16:14 + --> $DIR/range_plus_minus_one.rs:18:14 | -16 | for _ in 1..1+1 { } +18 | for _ in 1..1+1 { } | ^^^^^^ help: use: `1..=1` error: an inclusive range would be more readable - --> $DIR/range_plus_minus_one.rs:22:14 + --> $DIR/range_plus_minus_one.rs:24:14 | -22 | for _ in 0..(1+f()) { } +24 | for _ in 0..(1+f()) { } | ^^^^^^^^^^ help: use: `0..=f()` error: an exclusive range would be more readable - --> $DIR/range_plus_minus_one.rs:26:13 + --> $DIR/range_plus_minus_one.rs:28:13 | -26 | let _ = ..=11-1; +28 | let _ = ..=11-1; | ^^^^^^^ help: use: `..11` | - = note: `-D range-minus-one` implied by `-D warnings` + = note: `-D clippy::range-minus-one` implied by `-D warnings` error: an exclusive range would be more readable - --> $DIR/range_plus_minus_one.rs:27:13 + --> $DIR/range_plus_minus_one.rs:29:13 | -27 | let _ = ..=(11-1); +29 | let _ = ..=(11-1); | ^^^^^^^^^ help: use: `..11` error: an inclusive range would be more readable - --> $DIR/range_plus_minus_one.rs:28:13 + --> $DIR/range_plus_minus_one.rs:30:13 | -28 | let _ = (f()+1)..(f()+1); +30 | let _ = (f()+1)..(f()+1); | ^^^^^^^^^^^^^^^^ help: use: `(f()+1)..=f()` error: aborting due to 7 previous errors diff --git a/tests/ui/redundant_closure_call.stderr b/tests/ui/redundant_closure_call.stderr index d2b5616a4..e4d490743 100644 --- a/tests/ui/redundant_closure_call.stderr +++ b/tests/ui/redundant_closure_call.stderr @@ -4,7 +4,7 @@ error: Closure called just once immediately after it was declared 15 | i = closure(); | ^^^^^^^^^^^^^ | - = note: `-D redundant-closure-call` implied by `-D warnings` + = note: `-D clippy::redundant-closure-call` implied by `-D warnings` error: Closure called just once immediately after it was declared --> $DIR/redundant_closure_call.rs:18:2 diff --git a/tests/ui/redundant_field_names.stderr b/tests/ui/redundant_field_names.stderr index 5821baf4c..457fe7d3c 100644 --- a/tests/ui/redundant_field_names.stderr +++ b/tests/ui/redundant_field_names.stderr @@ -1,45 +1,45 @@ error: redundant field names in struct initialization - --> $DIR/redundant_field_names.rs:34:9 + --> $DIR/redundant_field_names.rs:36:9 | -34 | gender: gender, +36 | gender: gender, | ^^^^^^^^^^^^^^ help: replace it with: `gender` | - = note: `-D redundant-field-names` implied by `-D warnings` + = note: `-D clippy::redundant-field-names` implied by `-D warnings` error: redundant field names in struct initialization - --> $DIR/redundant_field_names.rs:35:9 + --> $DIR/redundant_field_names.rs:37:9 | -35 | age: age, +37 | age: age, | ^^^^^^^^ help: replace it with: `age` error: redundant field names in struct initialization - --> $DIR/redundant_field_names.rs:56:25 + --> $DIR/redundant_field_names.rs:58:25 | -56 | let _ = RangeFrom { start: start }; +58 | let _ = RangeFrom { start: start }; | ^^^^^^^^^^^^ help: replace it with: `start` error: redundant field names in struct initialization - --> $DIR/redundant_field_names.rs:57:23 + --> $DIR/redundant_field_names.rs:59:23 | -57 | let _ = RangeTo { end: end }; +59 | let _ = RangeTo { end: end }; | ^^^^^^^^ help: replace it with: `end` error: redundant field names in struct initialization - --> $DIR/redundant_field_names.rs:58:21 + --> $DIR/redundant_field_names.rs:60:21 | -58 | let _ = Range { start: start, end: end }; +60 | let _ = Range { start: start, end: end }; | ^^^^^^^^^^^^ help: replace it with: `start` error: redundant field names in struct initialization - --> $DIR/redundant_field_names.rs:58:35 + --> $DIR/redundant_field_names.rs:60:35 | -58 | let _ = Range { start: start, end: end }; +60 | let _ = Range { start: start, end: end }; | ^^^^^^^^ help: replace it with: `end` error: redundant field names in struct initialization - --> $DIR/redundant_field_names.rs:60:32 + --> $DIR/redundant_field_names.rs:62:32 | -60 | let _ = RangeToInclusive { end: end }; +62 | let _ = RangeToInclusive { end: end }; | ^^^^^^^^ help: replace it with: `end` error: aborting due to 7 previous errors diff --git a/tests/ui/reference.stderr b/tests/ui/reference.stderr index 741c0cc10..13e0da987 100644 --- a/tests/ui/reference.stderr +++ b/tests/ui/reference.stderr @@ -4,7 +4,7 @@ error: immediately dereferencing a reference 19 | let b = *&a; | ^^^ help: try this: `a` | - = note: `-D deref-addrof` implied by `-D warnings` + = note: `-D clippy::deref-addrof` implied by `-D warnings` error: immediately dereferencing a reference --> $DIR/reference.rs:21:13 diff --git a/tests/ui/regex.stderr b/tests/ui/regex.stderr index 39c360583..fd8fecb11 100644 --- a/tests/ui/regex.stderr +++ b/tests/ui/regex.stderr @@ -4,7 +4,7 @@ error: trivial regex 16 | let pipe_in_wrong_position = Regex::new("|"); | ^^^ | - = note: `-D trivial-regex` implied by `-D warnings` + = note: `-D clippy::trivial-regex` implied by `-D warnings` = help: the regex is unlikely to be useful as it is error: trivial regex @@ -21,7 +21,7 @@ error: regex syntax error: invalid character class range, the start must be <= t 18 | let wrong_char_ranice = Regex::new("[z-a]"); | ^^^ | - = note: `-D invalid-regex` implied by `-D warnings` + = note: `-D clippy::invalid-regex` implied by `-D warnings` error: regex syntax error: invalid character class range, the start must be <= the end --> $DIR/regex.rs:19:37 diff --git a/tests/ui/replace_consts.stderr b/tests/ui/replace_consts.stderr index 0a9d5f4ab..fb9c9414c 100644 --- a/tests/ui/replace_consts.stderr +++ b/tests/ui/replace_consts.stderr @@ -1,217 +1,217 @@ error: using `ATOMIC_BOOL_INIT` - --> $DIR/replace_consts.rs:12:17 + --> $DIR/replace_consts.rs:14:17 | -12 | { let foo = ATOMIC_BOOL_INIT; }; +14 | { let foo = ATOMIC_BOOL_INIT; }; | ^^^^^^^^^^^^^^^^ help: try this: `AtomicBool::new(false)` | note: lint level defined here - --> $DIR/replace_consts.rs:3:9 + --> $DIR/replace_consts.rs:5:9 | -3 | #![deny(replace_consts)] - | ^^^^^^^^^^^^^^ +5 | #![deny(clippy::replace_consts)] + | ^^^^^^^^^^^^^^^^^^^^^^ error: using `ATOMIC_ISIZE_INIT` - --> $DIR/replace_consts.rs:13:17 + --> $DIR/replace_consts.rs:15:17 | -13 | { let foo = ATOMIC_ISIZE_INIT; }; +15 | { let foo = ATOMIC_ISIZE_INIT; }; | ^^^^^^^^^^^^^^^^^ help: try this: `AtomicIsize::new(0)` error: using `ATOMIC_I8_INIT` - --> $DIR/replace_consts.rs:14:17 + --> $DIR/replace_consts.rs:16:17 | -14 | { let foo = ATOMIC_I8_INIT; }; +16 | { let foo = ATOMIC_I8_INIT; }; | ^^^^^^^^^^^^^^ help: try this: `AtomicI8::new(0)` error: using `ATOMIC_I16_INIT` - --> $DIR/replace_consts.rs:15:17 + --> $DIR/replace_consts.rs:17:17 | -15 | { let foo = ATOMIC_I16_INIT; }; +17 | { let foo = ATOMIC_I16_INIT; }; | ^^^^^^^^^^^^^^^ help: try this: `AtomicI16::new(0)` error: using `ATOMIC_I32_INIT` - --> $DIR/replace_consts.rs:16:17 + --> $DIR/replace_consts.rs:18:17 | -16 | { let foo = ATOMIC_I32_INIT; }; +18 | { let foo = ATOMIC_I32_INIT; }; | ^^^^^^^^^^^^^^^ help: try this: `AtomicI32::new(0)` error: using `ATOMIC_I64_INIT` - --> $DIR/replace_consts.rs:17:17 + --> $DIR/replace_consts.rs:19:17 | -17 | { let foo = ATOMIC_I64_INIT; }; +19 | { let foo = ATOMIC_I64_INIT; }; | ^^^^^^^^^^^^^^^ help: try this: `AtomicI64::new(0)` error: using `ATOMIC_USIZE_INIT` - --> $DIR/replace_consts.rs:18:17 + --> $DIR/replace_consts.rs:20:17 | -18 | { let foo = ATOMIC_USIZE_INIT; }; +20 | { let foo = ATOMIC_USIZE_INIT; }; | ^^^^^^^^^^^^^^^^^ help: try this: `AtomicUsize::new(0)` error: using `ATOMIC_U8_INIT` - --> $DIR/replace_consts.rs:19:17 + --> $DIR/replace_consts.rs:21:17 | -19 | { let foo = ATOMIC_U8_INIT; }; +21 | { let foo = ATOMIC_U8_INIT; }; | ^^^^^^^^^^^^^^ help: try this: `AtomicU8::new(0)` error: using `ATOMIC_U16_INIT` - --> $DIR/replace_consts.rs:20:17 + --> $DIR/replace_consts.rs:22:17 | -20 | { let foo = ATOMIC_U16_INIT; }; +22 | { let foo = ATOMIC_U16_INIT; }; | ^^^^^^^^^^^^^^^ help: try this: `AtomicU16::new(0)` error: using `ATOMIC_U32_INIT` - --> $DIR/replace_consts.rs:21:17 + --> $DIR/replace_consts.rs:23:17 | -21 | { let foo = ATOMIC_U32_INIT; }; +23 | { let foo = ATOMIC_U32_INIT; }; | ^^^^^^^^^^^^^^^ help: try this: `AtomicU32::new(0)` error: using `ATOMIC_U64_INIT` - --> $DIR/replace_consts.rs:22:17 - | -22 | { let foo = ATOMIC_U64_INIT; }; - | ^^^^^^^^^^^^^^^ help: try this: `AtomicU64::new(0)` - -error: using `MIN` --> $DIR/replace_consts.rs:24:17 | -24 | { let foo = std::isize::MIN; }; - | ^^^^^^^^^^^^^^^ help: try this: `isize::min_value()` - -error: using `MIN` - --> $DIR/replace_consts.rs:25:17 - | -25 | { let foo = std::i8::MIN; }; - | ^^^^^^^^^^^^ help: try this: `i8::min_value()` +24 | { let foo = ATOMIC_U64_INIT; }; + | ^^^^^^^^^^^^^^^ help: try this: `AtomicU64::new(0)` error: using `MIN` --> $DIR/replace_consts.rs:26:17 | -26 | { let foo = std::i16::MIN; }; - | ^^^^^^^^^^^^^ help: try this: `i16::min_value()` +26 | { let foo = std::isize::MIN; }; + | ^^^^^^^^^^^^^^^ help: try this: `isize::min_value()` error: using `MIN` --> $DIR/replace_consts.rs:27:17 | -27 | { let foo = std::i32::MIN; }; - | ^^^^^^^^^^^^^ help: try this: `i32::min_value()` +27 | { let foo = std::i8::MIN; }; + | ^^^^^^^^^^^^ help: try this: `i8::min_value()` error: using `MIN` --> $DIR/replace_consts.rs:28:17 | -28 | { let foo = std::i64::MIN; }; - | ^^^^^^^^^^^^^ help: try this: `i64::min_value()` +28 | { let foo = std::i16::MIN; }; + | ^^^^^^^^^^^^^ help: try this: `i16::min_value()` error: using `MIN` --> $DIR/replace_consts.rs:29:17 | -29 | { let foo = std::i128::MIN; }; - | ^^^^^^^^^^^^^^ help: try this: `i128::min_value()` +29 | { let foo = std::i32::MIN; }; + | ^^^^^^^^^^^^^ help: try this: `i32::min_value()` error: using `MIN` --> $DIR/replace_consts.rs:30:17 | -30 | { let foo = std::usize::MIN; }; - | ^^^^^^^^^^^^^^^ help: try this: `usize::min_value()` +30 | { let foo = std::i64::MIN; }; + | ^^^^^^^^^^^^^ help: try this: `i64::min_value()` error: using `MIN` --> $DIR/replace_consts.rs:31:17 | -31 | { let foo = std::u8::MIN; }; - | ^^^^^^^^^^^^ help: try this: `u8::min_value()` +31 | { let foo = std::i128::MIN; }; + | ^^^^^^^^^^^^^^ help: try this: `i128::min_value()` error: using `MIN` --> $DIR/replace_consts.rs:32:17 | -32 | { let foo = std::u16::MIN; }; - | ^^^^^^^^^^^^^ help: try this: `u16::min_value()` +32 | { let foo = std::usize::MIN; }; + | ^^^^^^^^^^^^^^^ help: try this: `usize::min_value()` error: using `MIN` --> $DIR/replace_consts.rs:33:17 | -33 | { let foo = std::u32::MIN; }; - | ^^^^^^^^^^^^^ help: try this: `u32::min_value()` +33 | { let foo = std::u8::MIN; }; + | ^^^^^^^^^^^^ help: try this: `u8::min_value()` error: using `MIN` --> $DIR/replace_consts.rs:34:17 | -34 | { let foo = std::u64::MIN; }; - | ^^^^^^^^^^^^^ help: try this: `u64::min_value()` +34 | { let foo = std::u16::MIN; }; + | ^^^^^^^^^^^^^ help: try this: `u16::min_value()` error: using `MIN` --> $DIR/replace_consts.rs:35:17 | -35 | { let foo = std::u128::MIN; }; - | ^^^^^^^^^^^^^^ help: try this: `u128::min_value()` +35 | { let foo = std::u32::MIN; }; + | ^^^^^^^^^^^^^ help: try this: `u32::min_value()` -error: using `MAX` +error: using `MIN` + --> $DIR/replace_consts.rs:36:17 + | +36 | { let foo = std::u64::MIN; }; + | ^^^^^^^^^^^^^ help: try this: `u64::min_value()` + +error: using `MIN` --> $DIR/replace_consts.rs:37:17 | -37 | { let foo = std::isize::MAX; }; - | ^^^^^^^^^^^^^^^ help: try this: `isize::max_value()` - -error: using `MAX` - --> $DIR/replace_consts.rs:38:17 - | -38 | { let foo = std::i8::MAX; }; - | ^^^^^^^^^^^^ help: try this: `i8::max_value()` +37 | { let foo = std::u128::MIN; }; + | ^^^^^^^^^^^^^^ help: try this: `u128::min_value()` error: using `MAX` --> $DIR/replace_consts.rs:39:17 | -39 | { let foo = std::i16::MAX; }; - | ^^^^^^^^^^^^^ help: try this: `i16::max_value()` +39 | { let foo = std::isize::MAX; }; + | ^^^^^^^^^^^^^^^ help: try this: `isize::max_value()` error: using `MAX` --> $DIR/replace_consts.rs:40:17 | -40 | { let foo = std::i32::MAX; }; - | ^^^^^^^^^^^^^ help: try this: `i32::max_value()` +40 | { let foo = std::i8::MAX; }; + | ^^^^^^^^^^^^ help: try this: `i8::max_value()` error: using `MAX` --> $DIR/replace_consts.rs:41:17 | -41 | { let foo = std::i64::MAX; }; - | ^^^^^^^^^^^^^ help: try this: `i64::max_value()` +41 | { let foo = std::i16::MAX; }; + | ^^^^^^^^^^^^^ help: try this: `i16::max_value()` error: using `MAX` --> $DIR/replace_consts.rs:42:17 | -42 | { let foo = std::i128::MAX; }; - | ^^^^^^^^^^^^^^ help: try this: `i128::max_value()` +42 | { let foo = std::i32::MAX; }; + | ^^^^^^^^^^^^^ help: try this: `i32::max_value()` error: using `MAX` --> $DIR/replace_consts.rs:43:17 | -43 | { let foo = std::usize::MAX; }; - | ^^^^^^^^^^^^^^^ help: try this: `usize::max_value()` +43 | { let foo = std::i64::MAX; }; + | ^^^^^^^^^^^^^ help: try this: `i64::max_value()` error: using `MAX` --> $DIR/replace_consts.rs:44:17 | -44 | { let foo = std::u8::MAX; }; - | ^^^^^^^^^^^^ help: try this: `u8::max_value()` +44 | { let foo = std::i128::MAX; }; + | ^^^^^^^^^^^^^^ help: try this: `i128::max_value()` error: using `MAX` --> $DIR/replace_consts.rs:45:17 | -45 | { let foo = std::u16::MAX; }; - | ^^^^^^^^^^^^^ help: try this: `u16::max_value()` +45 | { let foo = std::usize::MAX; }; + | ^^^^^^^^^^^^^^^ help: try this: `usize::max_value()` error: using `MAX` --> $DIR/replace_consts.rs:46:17 | -46 | { let foo = std::u32::MAX; }; - | ^^^^^^^^^^^^^ help: try this: `u32::max_value()` +46 | { let foo = std::u8::MAX; }; + | ^^^^^^^^^^^^ help: try this: `u8::max_value()` error: using `MAX` --> $DIR/replace_consts.rs:47:17 | -47 | { let foo = std::u64::MAX; }; - | ^^^^^^^^^^^^^ help: try this: `u64::max_value()` +47 | { let foo = std::u16::MAX; }; + | ^^^^^^^^^^^^^ help: try this: `u16::max_value()` error: using `MAX` --> $DIR/replace_consts.rs:48:17 | -48 | { let foo = std::u128::MAX; }; +48 | { let foo = std::u32::MAX; }; + | ^^^^^^^^^^^^^ help: try this: `u32::max_value()` + +error: using `MAX` + --> $DIR/replace_consts.rs:49:17 + | +49 | { let foo = std::u64::MAX; }; + | ^^^^^^^^^^^^^ help: try this: `u64::max_value()` + +error: using `MAX` + --> $DIR/replace_consts.rs:50:17 + | +50 | { let foo = std::u128::MAX; }; | ^^^^^^^^^^^^^^ help: try this: `u128::max_value()` error: aborting due to 35 previous errors diff --git a/tests/ui/result_map_unit_fn.stderr b/tests/ui/result_map_unit_fn.stderr index 9ec24a7e9..5fba1a0d7 100644 --- a/tests/ui/result_map_unit_fn.stderr +++ b/tests/ui/result_map_unit_fn.stderr @@ -1,13 +1,3 @@ -error: called `map(f)` on an Result value where `f` is a unit function - --> $DIR/result_map_unit_fn.rs:33:5 - | -33 | x.field.map(do_nothing); - | ^^^^^^^^^^^^^^^^^^^^^^^- - | | - | help: try this: `if let Ok(x_field) = x.field { do_nothing(...) }` - | - = note: `-D result-map-unit-fn` implied by `-D warnings` - error: called `map(f)` on an Result value where `f` is a unit function --> $DIR/result_map_unit_fn.rs:35:5 | @@ -15,180 +5,190 @@ error: called `map(f)` on an Result value where `f` is a unit function | ^^^^^^^^^^^^^^^^^^^^^^^- | | | help: try this: `if let Ok(x_field) = x.field { do_nothing(...) }` + | + = note: `-D clippy::result-map-unit-fn` implied by `-D warnings` error: called `map(f)` on an Result value where `f` is a unit function --> $DIR/result_map_unit_fn.rs:37:5 | -37 | x.field.map(diverge); +37 | x.field.map(do_nothing); + | ^^^^^^^^^^^^^^^^^^^^^^^- + | | + | help: try this: `if let Ok(x_field) = x.field { do_nothing(...) }` + +error: called `map(f)` on an Result value where `f` is a unit function + --> $DIR/result_map_unit_fn.rs:39:5 + | +39 | x.field.map(diverge); | ^^^^^^^^^^^^^^^^^^^^- | | | help: try this: `if let Ok(x_field) = x.field { diverge(...) }` error: called `map(f)` on an Result value where `f` is a unit closure - --> $DIR/result_map_unit_fn.rs:43:5 + --> $DIR/result_map_unit_fn.rs:45:5 | -43 | x.field.map(|value| x.do_result_nothing(value + captured)); +45 | x.field.map(|value| x.do_result_nothing(value + captured)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- | | | help: try this: `if let Ok(value) = x.field { x.do_result_nothing(value + captured) }` error: called `map(f)` on an Result value where `f` is a unit closure - --> $DIR/result_map_unit_fn.rs:45:5 + --> $DIR/result_map_unit_fn.rs:47:5 | -45 | x.field.map(|value| { x.do_result_plus_one(value + captured); }); +47 | x.field.map(|value| { x.do_result_plus_one(value + captured); }); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- | | | help: try this: `if let Ok(value) = x.field { x.do_result_plus_one(value + captured); }` -error: called `map(f)` on an Result value where `f` is a unit closure - --> $DIR/result_map_unit_fn.rs:48:5 - | -48 | x.field.map(|value| do_nothing(value + captured)); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- - | | - | help: try this: `if let Ok(value) = x.field { do_nothing(value + captured) }` - error: called `map(f)` on an Result value where `f` is a unit closure --> $DIR/result_map_unit_fn.rs:50:5 | -50 | x.field.map(|value| { do_nothing(value + captured) }); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- +50 | x.field.map(|value| do_nothing(value + captured)); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- | | | help: try this: `if let Ok(value) = x.field { do_nothing(value + captured) }` error: called `map(f)` on an Result value where `f` is a unit closure --> $DIR/result_map_unit_fn.rs:52:5 | -52 | x.field.map(|value| { do_nothing(value + captured); }); +52 | x.field.map(|value| { do_nothing(value + captured) }); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- + | | + | help: try this: `if let Ok(value) = x.field { do_nothing(value + captured) }` + +error: called `map(f)` on an Result value where `f` is a unit closure + --> $DIR/result_map_unit_fn.rs:54:5 + | +54 | x.field.map(|value| { do_nothing(value + captured); }); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- | | | help: try this: `if let Ok(value) = x.field { do_nothing(value + captured); }` error: called `map(f)` on an Result value where `f` is a unit closure - --> $DIR/result_map_unit_fn.rs:54:5 + --> $DIR/result_map_unit_fn.rs:56:5 | -54 | x.field.map(|value| { { do_nothing(value + captured); } }); +56 | x.field.map(|value| { { do_nothing(value + captured); } }); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- | | | help: try this: `if let Ok(value) = x.field { do_nothing(value + captured); }` -error: called `map(f)` on an Result value where `f` is a unit closure - --> $DIR/result_map_unit_fn.rs:57:5 - | -57 | x.field.map(|value| diverge(value + captured)); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- - | | - | help: try this: `if let Ok(value) = x.field { diverge(value + captured) }` - error: called `map(f)` on an Result value where `f` is a unit closure --> $DIR/result_map_unit_fn.rs:59:5 | -59 | x.field.map(|value| { diverge(value + captured) }); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- +59 | x.field.map(|value| diverge(value + captured)); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- | | | help: try this: `if let Ok(value) = x.field { diverge(value + captured) }` error: called `map(f)` on an Result value where `f` is a unit closure --> $DIR/result_map_unit_fn.rs:61:5 | -61 | x.field.map(|value| { diverge(value + captured); }); +61 | x.field.map(|value| { diverge(value + captured) }); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- + | | + | help: try this: `if let Ok(value) = x.field { diverge(value + captured) }` + +error: called `map(f)` on an Result value where `f` is a unit closure + --> $DIR/result_map_unit_fn.rs:63:5 + | +63 | x.field.map(|value| { diverge(value + captured); }); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- | | | help: try this: `if let Ok(value) = x.field { diverge(value + captured); }` error: called `map(f)` on an Result value where `f` is a unit closure - --> $DIR/result_map_unit_fn.rs:63:5 + --> $DIR/result_map_unit_fn.rs:65:5 | -63 | x.field.map(|value| { { diverge(value + captured); } }); +65 | x.field.map(|value| { { diverge(value + captured); } }); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- | | | help: try this: `if let Ok(value) = x.field { diverge(value + captured); }` error: called `map(f)` on an Result value where `f` is a unit closure - --> $DIR/result_map_unit_fn.rs:68:5 + --> $DIR/result_map_unit_fn.rs:70:5 | -68 | x.field.map(|value| { let y = plus_one(value + captured); }); +70 | x.field.map(|value| { let y = plus_one(value + captured); }); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- | | | help: try this: `if let Ok(value) = x.field { let y = plus_one(value + captured); }` error: called `map(f)` on an Result value where `f` is a unit closure - --> $DIR/result_map_unit_fn.rs:70:5 + --> $DIR/result_map_unit_fn.rs:72:5 | -70 | x.field.map(|value| { plus_one(value + captured); }); +72 | x.field.map(|value| { plus_one(value + captured); }); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- | | | help: try this: `if let Ok(value) = x.field { plus_one(value + captured); }` error: called `map(f)` on an Result value where `f` is a unit closure - --> $DIR/result_map_unit_fn.rs:72:5 + --> $DIR/result_map_unit_fn.rs:74:5 | -72 | x.field.map(|value| { { plus_one(value + captured); } }); +74 | x.field.map(|value| { { plus_one(value + captured); } }); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- | | | help: try this: `if let Ok(value) = x.field { plus_one(value + captured); }` error: called `map(f)` on an Result value where `f` is a unit closure - --> $DIR/result_map_unit_fn.rs:75:5 + --> $DIR/result_map_unit_fn.rs:77:5 | -75 | x.field.map(|ref value| { do_nothing(value + captured) }); +77 | x.field.map(|ref value| { do_nothing(value + captured) }); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- | | | help: try this: `if let Ok(ref value) = x.field { do_nothing(value + captured) }` error: called `map(f)` on an Result value where `f` is a unit closure - --> $DIR/result_map_unit_fn.rs:78:5 + --> $DIR/result_map_unit_fn.rs:80:5 | -78 | x.field.map(|value| { do_nothing(value); do_nothing(value) }); +80 | x.field.map(|value| { do_nothing(value); do_nothing(value) }); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- | | | help: try this: `if let Ok(value) = x.field { ... }` error: called `map(f)` on an Result value where `f` is a unit closure - --> $DIR/result_map_unit_fn.rs:80:5 + --> $DIR/result_map_unit_fn.rs:82:5 | -80 | x.field.map(|value| if value > 0 { do_nothing(value); do_nothing(value) }); +82 | x.field.map(|value| if value > 0 { do_nothing(value); do_nothing(value) }); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- | | | help: try this: `if let Ok(value) = x.field { ... }` error: called `map(f)` on an Result value where `f` is a unit closure - --> $DIR/result_map_unit_fn.rs:84:5 + --> $DIR/result_map_unit_fn.rs:86:5 | -84 | x.field.map(|value| { +86 | x.field.map(|value| { | _____^ | |_____| | || -85 | || do_nothing(value); -86 | || do_nothing(value) -87 | || }); +87 | || do_nothing(value); +88 | || do_nothing(value) +89 | || }); | ||______^- help: try this: `if let Ok(value) = x.field { ... }` | |_______| | error: called `map(f)` on an Result value where `f` is a unit closure - --> $DIR/result_map_unit_fn.rs:88:5 + --> $DIR/result_map_unit_fn.rs:90:5 | -88 | x.field.map(|value| { do_nothing(value); do_nothing(value); }); +90 | x.field.map(|value| { do_nothing(value); do_nothing(value); }); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- | | | help: try this: `if let Ok(value) = x.field { ... }` error: called `map(f)` on an Result value where `f` is a unit function - --> $DIR/result_map_unit_fn.rs:92:5 + --> $DIR/result_map_unit_fn.rs:94:5 | -92 | "12".parse::().map(diverge); +94 | "12".parse::().map(diverge); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- | | | help: try this: `if let Ok(_) = "12".parse::() { diverge(...) }` error: called `map(f)` on an Result value where `f` is a unit function - --> $DIR/result_map_unit_fn.rs:98:5 - | -98 | y.map(do_nothing); - | ^^^^^^^^^^^^^^^^^- - | | - | help: try this: `if let Ok(_y) = y { do_nothing(...) }` + --> $DIR/result_map_unit_fn.rs:100:5 + | +100 | y.map(do_nothing); + | ^^^^^^^^^^^^^^^^^- + | | + | help: try this: `if let Ok(_y) = y { do_nothing(...) }` error: aborting due to 23 previous errors diff --git a/tests/ui/serde.stderr b/tests/ui/serde.stderr index 58667e0f8..cce839a0d 100644 --- a/tests/ui/serde.stderr +++ b/tests/ui/serde.stderr @@ -8,7 +8,7 @@ error: you should not implement `visit_string` without also implementing `visit_ 43 | | } | |_____^ | - = note: `-D serde-api-misuse` implied by `-D warnings` + = note: `-D clippy::serde-api-misuse` implied by `-D warnings` error: aborting due to previous error diff --git a/tests/ui/shadow.stderr b/tests/ui/shadow.stderr index 0eb5e5b2a..311177e25 100644 --- a/tests/ui/shadow.stderr +++ b/tests/ui/shadow.stderr @@ -4,7 +4,7 @@ error: `x` is shadowed by itself in `&mut x` 13 | let x = &mut x; | ^^^^^^^^^^^^^^^ | - = note: `-D shadow-same` implied by `-D warnings` + = note: `-D clippy::shadow-same` implied by `-D warnings` note: previous binding is here --> $DIR/shadow.rs:12:13 | @@ -41,7 +41,7 @@ error: `x` is shadowed by `{ *x + 1 }` which reuses the original value 16 | let x = { *x + 1 }; | ^ | - = note: `-D shadow-reuse` implied by `-D warnings` + = note: `-D clippy::shadow-reuse` implied by `-D warnings` note: initialization happens here --> $DIR/shadow.rs:16:13 | @@ -110,7 +110,7 @@ error: `x` is shadowed by `y` 21 | let x = y; | ^ | - = note: `-D shadow-unrelated` implied by `-D warnings` + = note: `-D clippy::shadow-unrelated` implied by `-D warnings` note: initialization happens here --> $DIR/shadow.rs:21:13 | diff --git a/tests/ui/short_circuit_statement.stderr b/tests/ui/short_circuit_statement.stderr index 7697cbd1c..bef497c33 100644 --- a/tests/ui/short_circuit_statement.stderr +++ b/tests/ui/short_circuit_statement.stderr @@ -4,7 +4,7 @@ error: boolean short circuit operator in statement may be clearer using an expli 7 | f() && g(); | ^^^^^^^^^^^ help: replace it with: `if f() { g(); }` | - = note: `-D short-circuit-statement` implied by `-D warnings` + = note: `-D clippy::short-circuit-statement` implied by `-D warnings` error: boolean short circuit operator in statement may be clearer using an explicit test --> $DIR/short_circuit_statement.rs:8:5 diff --git a/tests/ui/single_char_pattern.stderr b/tests/ui/single_char_pattern.stderr index 044b4909a..783556127 100644 --- a/tests/ui/single_char_pattern.stderr +++ b/tests/ui/single_char_pattern.stderr @@ -1,123 +1,123 @@ error: single-character string constant used as pattern - --> $DIR/single_char_pattern.rs:5:13 + --> $DIR/single_char_pattern.rs:7:13 | -5 | x.split("x"); +7 | x.split("x"); | ^^^ help: try using a char instead: `'x'` | - = note: `-D single-char-pattern` implied by `-D warnings` + = note: `-D clippy::single-char-pattern` implied by `-D warnings` error: single-character string constant used as pattern - --> $DIR/single_char_pattern.rs:22:16 + --> $DIR/single_char_pattern.rs:24:16 | -22 | x.contains("x"); +24 | x.contains("x"); | ^^^ help: try using a char instead: `'x'` error: single-character string constant used as pattern - --> $DIR/single_char_pattern.rs:23:19 + --> $DIR/single_char_pattern.rs:25:19 | -23 | x.starts_with("x"); +25 | x.starts_with("x"); | ^^^ help: try using a char instead: `'x'` error: single-character string constant used as pattern - --> $DIR/single_char_pattern.rs:24:17 + --> $DIR/single_char_pattern.rs:26:17 | -24 | x.ends_with("x"); +26 | x.ends_with("x"); | ^^^ help: try using a char instead: `'x'` error: single-character string constant used as pattern - --> $DIR/single_char_pattern.rs:25:12 + --> $DIR/single_char_pattern.rs:27:12 | -25 | x.find("x"); +27 | x.find("x"); | ^^^ help: try using a char instead: `'x'` error: single-character string constant used as pattern - --> $DIR/single_char_pattern.rs:26:13 + --> $DIR/single_char_pattern.rs:28:13 | -26 | x.rfind("x"); +28 | x.rfind("x"); | ^^^ help: try using a char instead: `'x'` error: single-character string constant used as pattern - --> $DIR/single_char_pattern.rs:27:14 + --> $DIR/single_char_pattern.rs:29:14 | -27 | x.rsplit("x"); +29 | x.rsplit("x"); | ^^^ help: try using a char instead: `'x'` error: single-character string constant used as pattern - --> $DIR/single_char_pattern.rs:28:24 + --> $DIR/single_char_pattern.rs:30:24 | -28 | x.split_terminator("x"); +30 | x.split_terminator("x"); | ^^^ help: try using a char instead: `'x'` error: single-character string constant used as pattern - --> $DIR/single_char_pattern.rs:29:25 + --> $DIR/single_char_pattern.rs:31:25 | -29 | x.rsplit_terminator("x"); +31 | x.rsplit_terminator("x"); | ^^^ help: try using a char instead: `'x'` error: single-character string constant used as pattern - --> $DIR/single_char_pattern.rs:30:17 + --> $DIR/single_char_pattern.rs:32:17 | -30 | x.splitn(0, "x"); +32 | x.splitn(0, "x"); | ^^^ help: try using a char instead: `'x'` error: single-character string constant used as pattern - --> $DIR/single_char_pattern.rs:31:18 + --> $DIR/single_char_pattern.rs:33:18 | -31 | x.rsplitn(0, "x"); +33 | x.rsplitn(0, "x"); | ^^^ help: try using a char instead: `'x'` error: single-character string constant used as pattern - --> $DIR/single_char_pattern.rs:32:15 + --> $DIR/single_char_pattern.rs:34:15 | -32 | x.matches("x"); +34 | x.matches("x"); | ^^^ help: try using a char instead: `'x'` error: single-character string constant used as pattern - --> $DIR/single_char_pattern.rs:33:16 + --> $DIR/single_char_pattern.rs:35:16 | -33 | x.rmatches("x"); +35 | x.rmatches("x"); | ^^^ help: try using a char instead: `'x'` error: single-character string constant used as pattern - --> $DIR/single_char_pattern.rs:34:21 + --> $DIR/single_char_pattern.rs:36:21 | -34 | x.match_indices("x"); +36 | x.match_indices("x"); | ^^^ help: try using a char instead: `'x'` error: single-character string constant used as pattern - --> $DIR/single_char_pattern.rs:35:22 + --> $DIR/single_char_pattern.rs:37:22 | -35 | x.rmatch_indices("x"); +37 | x.rmatch_indices("x"); | ^^^ help: try using a char instead: `'x'` error: single-character string constant used as pattern - --> $DIR/single_char_pattern.rs:36:25 + --> $DIR/single_char_pattern.rs:38:25 | -36 | x.trim_left_matches("x"); +38 | x.trim_left_matches("x"); | ^^^ help: try using a char instead: `'x'` error: single-character string constant used as pattern - --> $DIR/single_char_pattern.rs:37:26 + --> $DIR/single_char_pattern.rs:39:26 | -37 | x.trim_right_matches("x"); +39 | x.trim_right_matches("x"); | ^^^ help: try using a char instead: `'x'` error: single-character string constant used as pattern - --> $DIR/single_char_pattern.rs:39:13 + --> $DIR/single_char_pattern.rs:41:13 | -39 | x.split("/n"); +41 | x.split("/n"); | ^^^^ help: try using a char instead: `'/n'` error: single-character string constant used as pattern - --> $DIR/single_char_pattern.rs:44:31 + --> $DIR/single_char_pattern.rs:46:31 | -44 | x.replace(";", ",").split(","); // issue #2978 +46 | x.replace(";", ",").split(","); // issue #2978 | ^^^ help: try using a char instead: `','` error: single-character string constant used as pattern - --> $DIR/single_char_pattern.rs:45:19 + --> $DIR/single_char_pattern.rs:47:19 | -45 | x.starts_with("/x03"); // issue #2996 +47 | x.starts_with("/x03"); // issue #2996 | ^^^^^^ help: try using a char instead: `'/x03'` error: aborting due to 20 previous errors diff --git a/tests/ui/single_match.stderr b/tests/ui/single_match.stderr index d77211bc1..20d8fed25 100644 --- a/tests/ui/single_match.stderr +++ b/tests/ui/single_match.stderr @@ -1,48 +1,48 @@ error: you seem to be trying to use match for destructuring a single pattern. Consider using `if let` - --> $DIR/single_match.rs:9:5 + --> $DIR/single_match.rs:11:5 | -9 | / match x { -10 | | Some(y) => { println!("{:?}", y); } -11 | | _ => () -12 | | }; +11 | / match x { +12 | | Some(y) => { println!("{:?}", y); } +13 | | _ => () +14 | | }; | |_____^ help: try this: `if let Some(y) = x { println!("{:?}", y); }` | - = note: `-D single-match` implied by `-D warnings` + = note: `-D clippy::single-match` implied by `-D warnings` error: you seem to be trying to use match for destructuring a single pattern. Consider using `if let` - --> $DIR/single_match.rs:15:5 + --> $DIR/single_match.rs:17:5 | -15 | / match z { -16 | | (2...3, 7...9) => dummy(), -17 | | _ => {} -18 | | }; +17 | / match z { +18 | | (2...3, 7...9) => dummy(), +19 | | _ => {} +20 | | }; | |_____^ help: try this: `if let (2...3, 7...9) = z { dummy() }` error: you seem to be trying to use match for destructuring a single pattern. Consider using `if let` - --> $DIR/single_match.rs:41:5 + --> $DIR/single_match.rs:43:5 | -41 | / match x { -42 | | Some(y) => dummy(), -43 | | None => () -44 | | }; +43 | / match x { +44 | | Some(y) => dummy(), +45 | | None => () +46 | | }; | |_____^ help: try this: `if let Some(y) = x { dummy() }` error: you seem to be trying to use match for destructuring a single pattern. Consider using `if let` - --> $DIR/single_match.rs:46:5 + --> $DIR/single_match.rs:48:5 | -46 | / match y { -47 | | Ok(y) => dummy(), -48 | | Err(..) => () -49 | | }; +48 | / match y { +49 | | Ok(y) => dummy(), +50 | | Err(..) => () +51 | | }; | |_____^ help: try this: `if let Ok(y) = y { dummy() }` error: you seem to be trying to use match for destructuring a single pattern. Consider using `if let` - --> $DIR/single_match.rs:53:5 + --> $DIR/single_match.rs:55:5 | -53 | / match c { -54 | | Cow::Borrowed(..) => dummy(), -55 | | Cow::Owned(..) => (), -56 | | }; +55 | / match c { +56 | | Cow::Borrowed(..) => dummy(), +57 | | Cow::Owned(..) => (), +58 | | }; | |_____^ help: try this: `if let Cow::Borrowed(..) = c { dummy() }` error: aborting due to 5 previous errors diff --git a/tests/ui/starts_ends_with.stderr b/tests/ui/starts_ends_with.stderr index 7d73f201b..b3fb444b5 100644 --- a/tests/ui/starts_ends_with.stderr +++ b/tests/ui/starts_ends_with.stderr @@ -1,77 +1,77 @@ error: you should use the `starts_with` method - --> $DIR/starts_ends_with.rs:7:5 + --> $DIR/starts_ends_with.rs:9:5 | -7 | "".chars().next() == Some(' '); +9 | "".chars().next() == Some(' '); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: like this: `"".starts_with(' ')` | - = note: `-D chars-next-cmp` implied by `-D warnings` + = note: `-D clippy::chars-next-cmp` implied by `-D warnings` error: you should use the `starts_with` method - --> $DIR/starts_ends_with.rs:8:5 - | -8 | Some(' ') != "".chars().next(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: like this: `!"".starts_with(' ')` - -error: you should use the `starts_with` method - --> $DIR/starts_ends_with.rs:13:8 + --> $DIR/starts_ends_with.rs:10:5 | -13 | if s.chars().next().unwrap() == 'f' { // s.starts_with('f') +10 | Some(' ') != "".chars().next(); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: like this: `!"".starts_with(' ')` + +error: you should use the `starts_with` method + --> $DIR/starts_ends_with.rs:15:8 + | +15 | if s.chars().next().unwrap() == 'f' { // s.starts_with('f') | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: like this: `s.starts_with('f')` error: you should use the `ends_with` method - --> $DIR/starts_ends_with.rs:16:8 + --> $DIR/starts_ends_with.rs:18:8 | -16 | if s.chars().next_back().unwrap() == 'o' { // s.ends_with('o') +18 | if s.chars().next_back().unwrap() == 'o' { // s.ends_with('o') | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: like this: `s.ends_with('o')` | - = note: `-D chars-last-cmp` implied by `-D warnings` + = note: `-D clippy::chars-last-cmp` implied by `-D warnings` error: you should use the `ends_with` method - --> $DIR/starts_ends_with.rs:19:8 + --> $DIR/starts_ends_with.rs:21:8 | -19 | if s.chars().last().unwrap() == 'o' { // s.ends_with('o') +21 | if s.chars().last().unwrap() == 'o' { // s.ends_with('o') | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: like this: `s.ends_with('o')` error: you should use the `starts_with` method - --> $DIR/starts_ends_with.rs:22:8 + --> $DIR/starts_ends_with.rs:24:8 | -22 | if s.chars().next().unwrap() != 'f' { // !s.starts_with('f') +24 | if s.chars().next().unwrap() != 'f' { // !s.starts_with('f') | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: like this: `!s.starts_with('f')` error: you should use the `ends_with` method - --> $DIR/starts_ends_with.rs:25:8 + --> $DIR/starts_ends_with.rs:27:8 | -25 | if s.chars().next_back().unwrap() != 'o' { // !s.ends_with('o') +27 | if s.chars().next_back().unwrap() != 'o' { // !s.ends_with('o') | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: like this: `!s.ends_with('o')` error: you should use the `ends_with` method - --> $DIR/starts_ends_with.rs:28:8 + --> $DIR/starts_ends_with.rs:30:8 | -28 | if s.chars().last().unwrap() != 'o' { // !s.ends_with('o') +30 | if s.chars().last().unwrap() != 'o' { // !s.ends_with('o') | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: like this: `!s.ends_with('o')` -error: you should use the `ends_with` method - --> $DIR/starts_ends_with.rs:35:5 - | -35 | "".chars().last() == Some(' '); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: like this: `"".ends_with(' ')` - -error: you should use the `ends_with` method - --> $DIR/starts_ends_with.rs:36:5 - | -36 | Some(' ') != "".chars().last(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: like this: `!"".ends_with(' ')` - error: you should use the `ends_with` method --> $DIR/starts_ends_with.rs:37:5 | -37 | "".chars().next_back() == Some(' '); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: like this: `"".ends_with(' ')` +37 | "".chars().last() == Some(' '); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: like this: `"".ends_with(' ')` error: you should use the `ends_with` method --> $DIR/starts_ends_with.rs:38:5 | -38 | Some(' ') != "".chars().next_back(); +38 | Some(' ') != "".chars().last(); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: like this: `!"".ends_with(' ')` + +error: you should use the `ends_with` method + --> $DIR/starts_ends_with.rs:39:5 + | +39 | "".chars().next_back() == Some(' '); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: like this: `"".ends_with(' ')` + +error: you should use the `ends_with` method + --> $DIR/starts_ends_with.rs:40:5 + | +40 | Some(' ') != "".chars().next_back(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: like this: `!"".ends_with(' ')` error: aborting due to 12 previous errors diff --git a/tests/ui/string_extend.stderr b/tests/ui/string_extend.stderr index 4be2037ad..32e348269 100644 --- a/tests/ui/string_extend.stderr +++ b/tests/ui/string_extend.stderr @@ -4,7 +4,7 @@ error: calling `.extend(_.chars())` 16 | s.extend(abc.chars()); | ^^^^^^^^^^^^^^^^^^^^^ help: try this: `s.push_str(abc)` | - = note: `-D string-extend-chars` implied by `-D warnings` + = note: `-D clippy::string-extend-chars` implied by `-D warnings` error: calling `.extend(_.chars())` --> $DIR/string_extend.rs:19:5 diff --git a/tests/ui/strings.stderr b/tests/ui/strings.stderr index d098ce9df..258920e26 100644 --- a/tests/ui/strings.stderr +++ b/tests/ui/strings.stderr @@ -4,7 +4,7 @@ error: manual implementation of an assign operation 10 | x = x + "."; | ^^^^^^^^^^^ help: replace it with: `x += "."` | - = note: `-D assign-op-pattern` implied by `-D warnings` + = note: `-D clippy::assign-op-pattern` implied by `-D warnings` error: you added something to a string. Consider using `String::push_str()` instead --> $DIR/strings.rs:10:13 @@ -12,7 +12,7 @@ error: you added something to a string. Consider using `String::push_str()` inst 10 | x = x + "."; | ^^^^^^^ | - = note: `-D string-add` implied by `-D warnings` + = note: `-D clippy::string-add` implied by `-D warnings` error: you added something to a string. Consider using `String::push_str()` instead --> $DIR/strings.rs:14:13 @@ -26,7 +26,7 @@ error: you assigned the result of adding something to this string. Consider usin 24 | x = x + "."; | ^^^^^^^^^^^ | - = note: `-D string-add-assign` implied by `-D warnings` + = note: `-D clippy::string-add-assign` implied by `-D warnings` error: manual implementation of an assign operation --> $DIR/strings.rs:24:9 @@ -58,7 +58,7 @@ error: calling `as_bytes()` on a string literal 50 | let bs = "hello there".as_bytes(); | ^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using a byte string literal instead: `b"hello there"` | - = note: `-D string-lit-as-bytes` implied by `-D warnings` + = note: `-D clippy::string-lit-as-bytes` implied by `-D warnings` error: calling `as_bytes()` on a string literal --> $DIR/strings.rs:55:18 diff --git a/tests/ui/stutter.stderr b/tests/ui/stutter.stderr index 25e857991..3cc0be395 100644 --- a/tests/ui/stutter.stderr +++ b/tests/ui/stutter.stderr @@ -4,7 +4,7 @@ error: item name starts with its containing module's name 8 | pub fn foo_bar() {} | ^^^^^^^^^^^^^^^^^^^ | - = note: `-D stutter` implied by `-D warnings` + = note: `-D clippy::stutter` implied by `-D warnings` error: item name ends with its containing module's name --> $DIR/stutter.rs:9:5 diff --git a/tests/ui/suspicious_arithmetic_impl.stderr b/tests/ui/suspicious_arithmetic_impl.stderr index 8130b1cb3..0f396c3a5 100644 --- a/tests/ui/suspicious_arithmetic_impl.stderr +++ b/tests/ui/suspicious_arithmetic_impl.stderr @@ -4,7 +4,7 @@ error: Suspicious use of binary operator in `Add` impl 14 | Foo(self.0 - other.0) | ^ | - = note: `-D suspicious-arithmetic-impl` implied by `-D warnings` + = note: `-D clippy::suspicious-arithmetic-impl` implied by `-D warnings` error: Suspicious use of binary operator in `AddAssign` impl --> $DIR/suspicious_arithmetic_impl.rs:20:23 @@ -12,7 +12,7 @@ error: Suspicious use of binary operator in `AddAssign` impl 20 | *self = *self - other; | ^ | - = note: #[deny(suspicious_op_assign_impl)] on by default + = note: #[deny(clippy::suspicious_op_assign_impl)] on by default error: aborting due to 2 previous errors diff --git a/tests/ui/swap.stderr b/tests/ui/swap.stderr index a01ec375e..67d4fd8a1 100644 --- a/tests/ui/swap.stderr +++ b/tests/ui/swap.stderr @@ -6,7 +6,7 @@ error: this looks like you are swapping elements of `foo` manually 13 | | foo[1] = temp; | |_________________^ help: try: `foo.swap(0, 1)` | - = note: `-D manual-swap` implied by `-D warnings` + = note: `-D clippy::manual-swap` implied by `-D warnings` error: this looks like you are swapping elements of `foo` manually --> $DIR/swap.rs:20:5 @@ -53,7 +53,7 @@ error: this looks like you are trying to swap `a` and `b` 45 | | b = a; | |_________^ help: try: `std::mem::swap(&mut a, &mut b)` | - = note: `-D almost-swapped` implied by `-D warnings` + = note: `-D clippy::almost-swapped` implied by `-D warnings` = note: or maybe you should use `std::mem::replace`? error: this looks like you are trying to swap `c.0` and `a` diff --git a/tests/ui/temporary_assignment.stderr b/tests/ui/temporary_assignment.stderr index 979720c91..38379d8bd 100644 --- a/tests/ui/temporary_assignment.stderr +++ b/tests/ui/temporary_assignment.stderr @@ -4,7 +4,7 @@ error: assignment to temporary 29 | Struct { field: 0 }.field = 1; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: `-D temporary-assignment` implied by `-D warnings` + = note: `-D clippy::temporary-assignment` implied by `-D warnings` error: assignment to temporary --> $DIR/temporary_assignment.rs:30:5 diff --git a/tests/ui/toplevel_ref_arg.stderr b/tests/ui/toplevel_ref_arg.stderr index f360e8532..f3fe563f2 100644 --- a/tests/ui/toplevel_ref_arg.stderr +++ b/tests/ui/toplevel_ref_arg.stderr @@ -4,7 +4,7 @@ error: `ref` directly on a function argument is ignored. Consider using a refere 7 | fn the_answer(ref mut x: u8) { | ^^^^^^^^^ | - = note: `-D toplevel-ref-arg` implied by `-D warnings` + = note: `-D clippy::toplevel-ref-arg` implied by `-D warnings` error: `ref` on an entire `let` pattern is discouraged, take a reference with `&` instead --> $DIR/toplevel_ref_arg.rs:18:7 diff --git a/tests/ui/trailing_zeros.stderr b/tests/ui/trailing_zeros.stderr index 47b46be9b..477f42c28 100644 --- a/tests/ui/trailing_zeros.stderr +++ b/tests/ui/trailing_zeros.stderr @@ -4,7 +4,7 @@ error: bit mask could be simplified with a call to `trailing_zeros` 7 | let _ = #[clippy::author] (x & 0b1111 == 0); // suggest trailing_zeros | ^^^^^^^^^^^^^^^^^ help: try: `x.trailing_zeros() >= 4` | - = note: `-D verbose-bit-mask` implied by `-D warnings` + = note: `-D clippy::verbose-bit-mask` implied by `-D warnings` error: bit mask could be simplified with a call to `trailing_zeros` --> $DIR/trailing_zeros.rs:8:13 diff --git a/tests/ui/transmute.stderr b/tests/ui/transmute.stderr index abed5065c..4340c16b9 100644 --- a/tests/ui/transmute.stderr +++ b/tests/ui/transmute.stderr @@ -4,7 +4,7 @@ error: transmute from a type (`&'a T`) to itself 22 | let _: &'a T = core::intrinsics::transmute(t); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: `-D useless-transmute` implied by `-D warnings` + = note: `-D clippy::useless-transmute` implied by `-D warnings` error: transmute from a reference to a pointer --> $DIR/transmute.rs:26:23 @@ -30,7 +30,7 @@ error: transmute from a pointer type (`*const T`) to a reference type (`&T`) 35 | let _: &T = std::mem::transmute(p); | ^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*p` | - = note: `-D transmute-ptr-to-ref` implied by `-D warnings` + = note: `-D clippy::transmute-ptr-to-ref` implied by `-D warnings` error: transmute from a pointer type (`*mut T`) to a reference type (`&mut T`) --> $DIR/transmute.rs:38:21 @@ -134,7 +134,7 @@ error: transmute from a type (`*const Usize`) to the type that it points to (`Us 111 | let _: Usize = core::intrinsics::transmute(int_const_ptr); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: `-D crosspointer-transmute` implied by `-D warnings` + = note: `-D clippy::crosspointer-transmute` implied by `-D warnings` error: transmute from a type (`*mut Usize`) to the type that it points to (`Usize`) --> $DIR/transmute.rs:113:24 @@ -160,7 +160,7 @@ error: transmute from a `u32` to a `char` 123 | let _: char = unsafe { std::mem::transmute(0_u32) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `std::char::from_u32(0_u32).unwrap()` | - = note: `-D transmute-int-to-char` implied by `-D warnings` + = note: `-D clippy::transmute-int-to-char` implied by `-D warnings` error: transmute from a `i32` to a `char` --> $DIR/transmute.rs:124:28 @@ -174,7 +174,7 @@ error: transmute from a `u8` to a `bool` 129 | let _: bool = unsafe { std::mem::transmute(0_u8) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `0_u8 != 0` | - = note: `-D transmute-int-to-bool` implied by `-D warnings` + = note: `-D clippy::transmute-int-to-bool` implied by `-D warnings` error: transmute from a `u32` to a `f32` --> $DIR/transmute.rs:134:27 @@ -182,7 +182,7 @@ error: transmute from a `u32` to a `f32` 134 | let _: f32 = unsafe { std::mem::transmute(0_u32) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `f32::from_bits(0_u32)` | - = note: `-D transmute-int-to-float` implied by `-D warnings` + = note: `-D clippy::transmute-int-to-float` implied by `-D warnings` error: transmute from a `i32` to a `f32` --> $DIR/transmute.rs:135:27 @@ -196,7 +196,7 @@ error: transmute from a `&[u8]` to a `&str` 139 | let _: &str = unsafe { std::mem::transmute(b) }; | ^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `std::str::from_utf8(b).unwrap()` | - = note: `-D transmute-bytes-to-str` implied by `-D warnings` + = note: `-D clippy::transmute-bytes-to-str` implied by `-D warnings` error: transmute from a `&mut [u8]` to a `&mut str` --> $DIR/transmute.rs:140:32 @@ -210,7 +210,7 @@ error: transmute from a pointer to a pointer 172 | let _: *const f32 = std::mem::transmute(ptr); | ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `ptr as *const f32` | - = note: `-D transmute-ptr-to-ptr` implied by `-D warnings` + = note: `-D clippy::transmute-ptr-to-ptr` implied by `-D warnings` error: transmute from a pointer to a pointer --> $DIR/transmute.rs:173:27 diff --git a/tests/ui/transmute_64bit.stderr b/tests/ui/transmute_64bit.stderr index 3a6a6e73f..e86908655 100644 --- a/tests/ui/transmute_64bit.stderr +++ b/tests/ui/transmute_64bit.stderr @@ -1,15 +1,15 @@ error: transmute from a `f64` to a pointer - --> $DIR/transmute_64bit.rs:9:31 - | -9 | let _: *const usize = std::mem::transmute(6.0f64); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: `-D wrong-transmute` implied by `-D warnings` + --> $DIR/transmute_64bit.rs:11:31 + | +11 | let _: *const usize = std::mem::transmute(6.0f64); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: `-D clippy::wrong-transmute` implied by `-D warnings` error: transmute from a `f64` to a pointer - --> $DIR/transmute_64bit.rs:11:29 + --> $DIR/transmute_64bit.rs:13:29 | -11 | let _: *mut usize = std::mem::transmute(6.0f64); +13 | let _: *mut usize = std::mem::transmute(6.0f64); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 2 previous errors diff --git a/tests/ui/trivially_copy_pass_by_ref.stderr b/tests/ui/trivially_copy_pass_by_ref.stderr index 757b6b4c9..2db627dd9 100644 --- a/tests/ui/trivially_copy_pass_by_ref.stderr +++ b/tests/ui/trivially_copy_pass_by_ref.stderr @@ -1,81 +1,81 @@ error: this argument is passed by reference, but would be more efficient if passed by value - --> $DIR/trivially_copy_pass_by_ref.rs:40:11 + --> $DIR/trivially_copy_pass_by_ref.rs:42:11 | -40 | fn bad(x: &u32, y: &Foo, z: &Baz) { +42 | fn bad(x: &u32, y: &Foo, z: &Baz) { | ^^^^ help: consider passing by value instead: `u32` | - = note: `-D trivially-copy-pass-by-ref` implied by `-D warnings` + = note: `-D clippy::trivially-copy-pass-by-ref` implied by `-D warnings` error: this argument is passed by reference, but would be more efficient if passed by value - --> $DIR/trivially_copy_pass_by_ref.rs:40:20 + --> $DIR/trivially_copy_pass_by_ref.rs:42:20 | -40 | fn bad(x: &u32, y: &Foo, z: &Baz) { +42 | fn bad(x: &u32, y: &Foo, z: &Baz) { | ^^^^ help: consider passing by value instead: `Foo` error: this argument is passed by reference, but would be more efficient if passed by value - --> $DIR/trivially_copy_pass_by_ref.rs:40:29 + --> $DIR/trivially_copy_pass_by_ref.rs:42:29 | -40 | fn bad(x: &u32, y: &Foo, z: &Baz) { +42 | fn bad(x: &u32, y: &Foo, z: &Baz) { | ^^^^ help: consider passing by value instead: `Baz` error: this argument is passed by reference, but would be more efficient if passed by value - --> $DIR/trivially_copy_pass_by_ref.rs:50:12 + --> $DIR/trivially_copy_pass_by_ref.rs:52:12 | -50 | fn bad(&self, x: &u32, y: &Foo, z: &Baz) { +52 | fn bad(&self, x: &u32, y: &Foo, z: &Baz) { | ^^^^^ help: consider passing by value instead: `self` error: this argument is passed by reference, but would be more efficient if passed by value - --> $DIR/trivially_copy_pass_by_ref.rs:50:22 + --> $DIR/trivially_copy_pass_by_ref.rs:52:22 | -50 | fn bad(&self, x: &u32, y: &Foo, z: &Baz) { +52 | fn bad(&self, x: &u32, y: &Foo, z: &Baz) { | ^^^^ help: consider passing by value instead: `u32` error: this argument is passed by reference, but would be more efficient if passed by value - --> $DIR/trivially_copy_pass_by_ref.rs:50:31 + --> $DIR/trivially_copy_pass_by_ref.rs:52:31 | -50 | fn bad(&self, x: &u32, y: &Foo, z: &Baz) { +52 | fn bad(&self, x: &u32, y: &Foo, z: &Baz) { | ^^^^ help: consider passing by value instead: `Foo` error: this argument is passed by reference, but would be more efficient if passed by value - --> $DIR/trivially_copy_pass_by_ref.rs:50:40 + --> $DIR/trivially_copy_pass_by_ref.rs:52:40 | -50 | fn bad(&self, x: &u32, y: &Foo, z: &Baz) { +52 | fn bad(&self, x: &u32, y: &Foo, z: &Baz) { | ^^^^ help: consider passing by value instead: `Baz` error: this argument is passed by reference, but would be more efficient if passed by value - --> $DIR/trivially_copy_pass_by_ref.rs:53:16 + --> $DIR/trivially_copy_pass_by_ref.rs:55:16 | -53 | fn bad2(x: &u32, y: &Foo, z: &Baz) { +55 | fn bad2(x: &u32, y: &Foo, z: &Baz) { | ^^^^ help: consider passing by value instead: `u32` error: this argument is passed by reference, but would be more efficient if passed by value - --> $DIR/trivially_copy_pass_by_ref.rs:53:25 + --> $DIR/trivially_copy_pass_by_ref.rs:55:25 | -53 | fn bad2(x: &u32, y: &Foo, z: &Baz) { +55 | fn bad2(x: &u32, y: &Foo, z: &Baz) { | ^^^^ help: consider passing by value instead: `Foo` error: this argument is passed by reference, but would be more efficient if passed by value - --> $DIR/trivially_copy_pass_by_ref.rs:53:34 + --> $DIR/trivially_copy_pass_by_ref.rs:55:34 | -53 | fn bad2(x: &u32, y: &Foo, z: &Baz) { +55 | fn bad2(x: &u32, y: &Foo, z: &Baz) { | ^^^^ help: consider passing by value instead: `Baz` error: this argument is passed by reference, but would be more efficient if passed by value - --> $DIR/trivially_copy_pass_by_ref.rs:67:16 + --> $DIR/trivially_copy_pass_by_ref.rs:69:16 | -67 | fn bad2(x: &u32, y: &Foo, z: &Baz) { +69 | fn bad2(x: &u32, y: &Foo, z: &Baz) { | ^^^^ help: consider passing by value instead: `u32` error: this argument is passed by reference, but would be more efficient if passed by value - --> $DIR/trivially_copy_pass_by_ref.rs:67:25 + --> $DIR/trivially_copy_pass_by_ref.rs:69:25 | -67 | fn bad2(x: &u32, y: &Foo, z: &Baz) { +69 | fn bad2(x: &u32, y: &Foo, z: &Baz) { | ^^^^ help: consider passing by value instead: `Foo` error: this argument is passed by reference, but would be more efficient if passed by value - --> $DIR/trivially_copy_pass_by_ref.rs:67:34 + --> $DIR/trivially_copy_pass_by_ref.rs:69:34 | -67 | fn bad2(x: &u32, y: &Foo, z: &Baz) { +69 | fn bad2(x: &u32, y: &Foo, z: &Baz) { | ^^^^ help: consider passing by value instead: `Baz` error: aborting due to 13 previous errors diff --git a/tests/ui/types.stderr b/tests/ui/types.stderr index b41bff7a9..e2f751628 100644 --- a/tests/ui/types.stderr +++ b/tests/ui/types.stderr @@ -4,7 +4,7 @@ error: casting i32 to i64 may become silently lossy if types change 9 | let c_i64 : i64 = c as i64; | ^^^^^^^^ help: try: `i64::from(c)` | - = note: `-D cast-lossless` implied by `-D warnings` + = note: `-D clippy::cast-lossless` implied by `-D warnings` error: aborting due to previous error diff --git a/tests/ui/types_fn_to_int.stderr b/tests/ui/types_fn_to_int.stderr index bbdf4ce2e..a06809b9b 100644 --- a/tests/ui/types_fn_to_int.stderr +++ b/tests/ui/types_fn_to_int.stderr @@ -4,7 +4,7 @@ error: casting a `fn(usize) -> Foo {Foo::A}` to `i32` may truncate the function 12 | let _y = x as i32; | ^^^^^^^^ help: if you need the address of the function, consider: `x as usize` | - = note: #[deny(fn_to_numeric_cast_with_truncation)] on by default + = note: #[deny(clippy::fn_to_numeric_cast_with_truncation)] on by default error: casting a `fn(usize) -> Foo {Foo::A}` to `i32` may truncate the function address value. --> $DIR/types_fn_to_int.rs:13:15 @@ -36,7 +36,7 @@ error: casting a `fn() -> i32 {bar}` to `u64` is bad style. 17 | let _y = bar as u64; | ^^^^^^^^^^ help: if you need the address of the function, consider: `bar as usize` | - = note: `-D fn-to-numeric-cast` implied by `-D warnings` + = note: `-D clippy::fn-to-numeric-cast` implied by `-D warnings` error: casting a `fn(usize) -> Foo {Foo::A}` to `i128` is bad style. --> $DIR/types_fn_to_int.rs:18:14 diff --git a/tests/ui/unicode.stderr b/tests/ui/unicode.stderr index 9e99a44bb..b0e567fc2 100644 --- a/tests/ui/unicode.stderr +++ b/tests/ui/unicode.stderr @@ -4,7 +4,7 @@ error: zero-width space detected 6 | print!("Here >​< is a ZWS, and ​another"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: `-D zero-width-space` implied by `-D warnings` + = note: `-D clippy::zero-width-space` implied by `-D warnings` = help: Consider replacing the string with: ""Here >/u{200B}< is a ZWS, and /u{200B}another"" @@ -14,7 +14,7 @@ error: non-nfc unicode sequence detected 12 | print!("̀àh?"); | ^^^^^ | - = note: `-D unicode-not-nfc` implied by `-D warnings` + = note: `-D clippy::unicode-not-nfc` implied by `-D warnings` = help: Consider replacing the string with: ""̀àh?"" @@ -24,7 +24,7 @@ error: literal non-ASCII character detected 18 | print!("Üben!"); | ^^^^^^^ | - = note: `-D non-ascii-literal` implied by `-D warnings` + = note: `-D clippy::non-ascii-literal` implied by `-D warnings` = help: Consider replacing the string with: ""/u{dc}ben!"" diff --git a/tests/ui/unit_arg.stderr b/tests/ui/unit_arg.stderr index ca48f3926..e1845c0c0 100644 --- a/tests/ui/unit_arg.stderr +++ b/tests/ui/unit_arg.stderr @@ -1,30 +1,10 @@ -error: passing a unit value to a function - --> $DIR/unit_arg.rs:23:9 - | -23 | foo({}); - | ^^ - | - = note: `-D unit-arg` implied by `-D warnings` -help: if you intended to pass a unit value, use a unit literal instead - | -23 | foo(()); - | ^^ - -error: passing a unit value to a function - --> $DIR/unit_arg.rs:24:9 - | -24 | foo({ 1; }); - | ^^^^^^ -help: if you intended to pass a unit value, use a unit literal instead - | -24 | foo(()); - | ^^ - error: passing a unit value to a function --> $DIR/unit_arg.rs:25:9 | -25 | foo(foo(1)); - | ^^^^^^ +25 | foo({}); + | ^^ + | + = note: `-D clippy::unit-arg` implied by `-D warnings` help: if you intended to pass a unit value, use a unit literal instead | 25 | foo(()); @@ -33,35 +13,55 @@ help: if you intended to pass a unit value, use a unit literal instead error: passing a unit value to a function --> $DIR/unit_arg.rs:26:9 | -26 | foo({ - | _________^ -27 | | foo(1); -28 | | foo(2); -29 | | }); - | |_____^ +26 | foo({ 1; }); + | ^^^^^^ help: if you intended to pass a unit value, use a unit literal instead | 26 | foo(()); | ^^ error: passing a unit value to a function - --> $DIR/unit_arg.rs:30:10 + --> $DIR/unit_arg.rs:27:9 | -30 | foo3({}, 2, 2); +27 | foo(foo(1)); + | ^^^^^^ +help: if you intended to pass a unit value, use a unit literal instead + | +27 | foo(()); + | ^^ + +error: passing a unit value to a function + --> $DIR/unit_arg.rs:28:9 + | +28 | foo({ + | _________^ +29 | | foo(1); +30 | | foo(2); +31 | | }); + | |_____^ +help: if you intended to pass a unit value, use a unit literal instead + | +28 | foo(()); + | ^^ + +error: passing a unit value to a function + --> $DIR/unit_arg.rs:32:10 + | +32 | foo3({}, 2, 2); | ^^ help: if you intended to pass a unit value, use a unit literal instead | -30 | foo3((), 2, 2); +32 | foo3((), 2, 2); | ^^ error: passing a unit value to a function - --> $DIR/unit_arg.rs:32:11 + --> $DIR/unit_arg.rs:34:11 | -32 | b.bar({ 1; }); +34 | b.bar({ 1; }); | ^^^^^^ help: if you intended to pass a unit value, use a unit literal instead | -32 | b.bar(()); +34 | b.bar(()); | ^^ error: aborting due to 6 previous errors diff --git a/tests/ui/unit_cmp.stderr b/tests/ui/unit_cmp.stderr index 51ad3fca9..a85eb3284 100644 --- a/tests/ui/unit_cmp.stderr +++ b/tests/ui/unit_cmp.stderr @@ -4,7 +4,7 @@ error: ==-comparison of unit values detected. This will always be true 16 | if { true; } == { false; } { | ^^^^^^^^^^^^^^^^^^^^^^^ | - = note: `-D unit-cmp` implied by `-D warnings` + = note: `-D clippy::unit-cmp` implied by `-D warnings` error: >-comparison of unit values detected. This will always be false --> $DIR/unit_cmp.rs:19:8 diff --git a/tests/ui/unnecessary_clone.stderr b/tests/ui/unnecessary_clone.stderr index 3c1ce9080..b2985f84b 100644 --- a/tests/ui/unnecessary_clone.stderr +++ b/tests/ui/unnecessary_clone.stderr @@ -1,84 +1,84 @@ error: using `clone` on a `Copy` type - --> $DIR/unnecessary_clone.rs:16:5 + --> $DIR/unnecessary_clone.rs:18:5 | -16 | 42.clone(); +18 | 42.clone(); | ^^^^^^^^^^ help: try removing the `clone` call: `42` | - = note: `-D clone-on-copy` implied by `-D warnings` + = note: `-D clippy::clone-on-copy` implied by `-D warnings` error: using `clone` on a `Copy` type - --> $DIR/unnecessary_clone.rs:20:5 + --> $DIR/unnecessary_clone.rs:22:5 | -20 | (&42).clone(); +22 | (&42).clone(); | ^^^^^^^^^^^^^ help: try dereferencing it: `*(&42)` error: using '.clone()' on a ref-counted pointer - --> $DIR/unnecessary_clone.rs:30:5 + --> $DIR/unnecessary_clone.rs:32:5 | -30 | rc.clone(); +32 | rc.clone(); | ^^^^^^^^^^ help: try this: `Rc::::clone(&rc)` | - = note: `-D clone-on-ref-ptr` implied by `-D warnings` + = note: `-D clippy::clone-on-ref-ptr` implied by `-D warnings` error: using '.clone()' on a ref-counted pointer - --> $DIR/unnecessary_clone.rs:33:5 + --> $DIR/unnecessary_clone.rs:35:5 | -33 | arc.clone(); +35 | arc.clone(); | ^^^^^^^^^^^ help: try this: `Arc::::clone(&arc)` error: using '.clone()' on a ref-counted pointer - --> $DIR/unnecessary_clone.rs:36:5 + --> $DIR/unnecessary_clone.rs:38:5 | -36 | rcweak.clone(); +38 | rcweak.clone(); | ^^^^^^^^^^^^^^ help: try this: `Weak::::clone(&rcweak)` error: using '.clone()' on a ref-counted pointer - --> $DIR/unnecessary_clone.rs:39:5 + --> $DIR/unnecessary_clone.rs:41:5 | -39 | arc_weak.clone(); +41 | arc_weak.clone(); | ^^^^^^^^^^^^^^^^ help: try this: `Weak::::clone(&arc_weak)` error: using '.clone()' on a ref-counted pointer - --> $DIR/unnecessary_clone.rs:43:29 + --> $DIR/unnecessary_clone.rs:45:29 | -43 | let _: Arc = x.clone(); +45 | let _: Arc = x.clone(); | ^^^^^^^^^ help: try this: `Arc::::clone(&x)` -error: using `clone` on a `Copy` type - --> $DIR/unnecessary_clone.rs:47:5 - | -47 | t.clone(); - | ^^^^^^^^^ help: try removing the `clone` call: `t` - error: using `clone` on a `Copy` type --> $DIR/unnecessary_clone.rs:49:5 | -49 | Some(t).clone(); +49 | t.clone(); + | ^^^^^^^^^ help: try removing the `clone` call: `t` + +error: using `clone` on a `Copy` type + --> $DIR/unnecessary_clone.rs:51:5 + | +51 | Some(t).clone(); | ^^^^^^^^^^^^^^^ help: try removing the `clone` call: `Some(t)` error: using `clone` on a double-reference; this will copy the reference instead of cloning the inner type - --> $DIR/unnecessary_clone.rs:55:22 + --> $DIR/unnecessary_clone.rs:57:22 | -55 | let z: &Vec<_> = y.clone(); +57 | let z: &Vec<_> = y.clone(); | ^^^^^^^^^ | - = note: #[deny(clone_double_ref)] on by default + = note: #[deny(clippy::clone_double_ref)] on by default help: try dereferencing it | -55 | let z: &Vec<_> = &(*y).clone(); +57 | let z: &Vec<_> = &(*y).clone(); | ^^^^^^^^^^^^^ help: or try being explicit about what type to clone | -55 | let z: &Vec<_> = &std::vec::Vec::clone(y); +57 | let z: &Vec<_> = &std::vec::Vec::clone(y); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: called `cloned().collect()` on a slice to create a `Vec`. Calling `to_vec()` is both faster and more readable - --> $DIR/unnecessary_clone.rs:62:27 + --> $DIR/unnecessary_clone.rs:64:27 | -62 | let v2 : Vec = v.iter().cloned().collect(); +64 | let v2 : Vec = v.iter().cloned().collect(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: `-D iter-cloned-collect` implied by `-D warnings` + = note: `-D clippy::iter-cloned-collect` implied by `-D warnings` error: aborting due to 11 previous errors diff --git a/tests/ui/unnecessary_fold.stderr b/tests/ui/unnecessary_fold.stderr index 8bc4b8244..e72f671b6 100644 --- a/tests/ui/unnecessary_fold.stderr +++ b/tests/ui/unnecessary_fold.stderr @@ -4,7 +4,7 @@ error: this `.fold` can be written more succinctly using another method 4 | let _ = (0..3).fold(false, |acc, x| acc || x > 2); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `.any(|x| x > 2)` | - = note: `-D unnecessary-fold` implied by `-D warnings` + = note: `-D clippy::unnecessary-fold` implied by `-D warnings` error: this `.fold` can be written more succinctly using another method --> $DIR/unnecessary_fold.rs:6:19 diff --git a/tests/ui/unnecessary_ref.stderr b/tests/ui/unnecessary_ref.stderr index ffc65084a..d27ba26f3 100644 --- a/tests/ui/unnecessary_ref.stderr +++ b/tests/ui/unnecessary_ref.stderr @@ -1,14 +1,14 @@ error: Creating a reference that is immediately dereferenced. - --> $DIR/unnecessary_ref.rs:11:17 + --> $DIR/unnecessary_ref.rs:13:17 | -11 | let inner = (&outer).inner; +13 | let inner = (&outer).inner; | ^^^^^^^^ help: try this: `outer.inner` | note: lint level defined here - --> $DIR/unnecessary_ref.rs:8:8 + --> $DIR/unnecessary_ref.rs:10:8 | -8 | #[deny(ref_in_deref)] - | ^^^^^^^^^^^^ +10 | #[deny(clippy::ref_in_deref)] + | ^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/tests/ui/unneeded_field_pattern.stderr b/tests/ui/unneeded_field_pattern.stderr index 7e4c3a6cb..40aa4f524 100644 --- a/tests/ui/unneeded_field_pattern.stderr +++ b/tests/ui/unneeded_field_pattern.stderr @@ -4,7 +4,7 @@ error: You matched a field with a wildcard pattern. Consider using `..` instead 17 | Foo { a: _, b: 0, .. } => {} | ^^^^ | - = note: `-D unneeded-field-pattern` implied by `-D warnings` + = note: `-D clippy::unneeded-field-pattern` implied by `-D warnings` = help: Try with `Foo { b: 0, .. }` error: All the struct fields are matched to a wildcard pattern, consider using `..`. diff --git a/tests/ui/unreadable_literal.stderr b/tests/ui/unreadable_literal.stderr index cffcad1ee..516b6ccc5 100644 --- a/tests/ui/unreadable_literal.stderr +++ b/tests/ui/unreadable_literal.stderr @@ -4,7 +4,7 @@ error: long literal lacking separators 7 | let bad = (0b110110_i64, 0x12345678901_usize, 123456_f32, 1.234567_f32); | ^^^^^^^^^^^^ help: consider: `0b11_0110_i64` | - = note: `-D unreadable-literal` implied by `-D warnings` + = note: `-D clippy::unreadable-literal` implied by `-D warnings` error: long literal lacking separators --> $DIR/unreadable_literal.rs:7:30 diff --git a/tests/ui/unsafe_removed_from_name.stderr b/tests/ui/unsafe_removed_from_name.stderr index 93f2ddd53..2b014ca58 100644 --- a/tests/ui/unsafe_removed_from_name.stderr +++ b/tests/ui/unsafe_removed_from_name.stderr @@ -4,7 +4,7 @@ error: removed "unsafe" from the name of `UnsafeCell` in use as `TotallySafeCell 7 | use std::cell::{UnsafeCell as TotallySafeCell}; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: `-D unsafe-removed-from-name` implied by `-D warnings` + = note: `-D clippy::unsafe-removed-from-name` implied by `-D warnings` error: removed "unsafe" from the name of `UnsafeCell` in use as `TotallySafeCellAgain` --> $DIR/unsafe_removed_from_name.rs:9:1 diff --git a/tests/ui/unused_io_amount.stderr b/tests/ui/unused_io_amount.stderr index 5114d375f..48a575157 100644 --- a/tests/ui/unused_io_amount.stderr +++ b/tests/ui/unused_io_amount.stderr @@ -4,7 +4,7 @@ error: handle written amount returned or use `Write::write_all` instead 11 | try!(s.write(b"test")); | ^^^^^^^^^^^^^^^^^^^^^^^ | - = note: `-D unused-io-amount` implied by `-D warnings` + = note: `-D clippy::unused-io-amount` implied by `-D warnings` = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) error: handle read amount returned or use `Read::read_exact` instead diff --git a/tests/ui/unused_labels.stderr b/tests/ui/unused_labels.stderr index 19c91e2a6..d35ca41a1 100644 --- a/tests/ui/unused_labels.stderr +++ b/tests/ui/unused_labels.stderr @@ -6,7 +6,7 @@ error: unused label `'label` 10 | | } | |_____^ | - = note: `-D unused-label` implied by `-D warnings` + = note: `-D clippy::unused-label` implied by `-D warnings` error: unused label `'a` --> $DIR/unused_labels.rs:21:5 diff --git a/tests/ui/unused_lt.stderr b/tests/ui/unused_lt.stderr index f01dfda70..4cad611c2 100644 --- a/tests/ui/unused_lt.stderr +++ b/tests/ui/unused_lt.stderr @@ -4,7 +4,7 @@ error: this lifetime isn't used in the function definition 16 | fn unused_lt<'a>(x: u8) { | ^^ | - = note: `-D extra-unused-lifetimes` implied by `-D warnings` + = note: `-D clippy::extra-unused-lifetimes` implied by `-D warnings` error: this lifetime isn't used in the function definition --> $DIR/unused_lt.rs:20:25 diff --git a/tests/ui/unwrap_or.stderr b/tests/ui/unwrap_or.stderr index e4704dd0e..42c72090c 100644 --- a/tests/ui/unwrap_or.stderr +++ b/tests/ui/unwrap_or.stderr @@ -1,16 +1,16 @@ error: use of `unwrap_or` followed by a function call - --> $DIR/unwrap_or.rs:4:47 + --> $DIR/unwrap_or.rs:5:47 | -4 | let s = Some(String::from("test string")).unwrap_or("Fail".to_string()).len(); +5 | let s = Some(String::from("test string")).unwrap_or("Fail".to_string()).len(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(|| "Fail".to_string())` | - = note: `-D or-fun-call` implied by `-D warnings` + = note: `-D clippy::or-fun-call` implied by `-D warnings` error: use of `unwrap_or` followed by a function call - --> $DIR/unwrap_or.rs:9:10 - | -9 | .unwrap_or("Fail".to_string()) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(|| "Fail".to_string())` + --> $DIR/unwrap_or.rs:10:10 + | +10 | .unwrap_or("Fail".to_string()) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(|| "Fail".to_string())` error: aborting due to 2 previous errors diff --git a/tests/ui/use_self.stderr b/tests/ui/use_self.stderr index 899361012..cf673e166 100644 --- a/tests/ui/use_self.stderr +++ b/tests/ui/use_self.stderr @@ -1,123 +1,123 @@ error: unnecessary structure name repetition - --> $DIR/use_self.rs:11:21 + --> $DIR/use_self.rs:13:21 | -11 | fn new() -> Foo { +13 | fn new() -> Foo { | ^^^ help: use the applicable keyword: `Self` | - = note: `-D use-self` implied by `-D warnings` + = note: `-D clippy::use-self` implied by `-D warnings` error: unnecessary structure name repetition - --> $DIR/use_self.rs:12:13 + --> $DIR/use_self.rs:14:13 | -12 | Foo {} +14 | Foo {} | ^^^ help: use the applicable keyword: `Self` error: unnecessary structure name repetition - --> $DIR/use_self.rs:14:22 + --> $DIR/use_self.rs:16:22 | -14 | fn test() -> Foo { +16 | fn test() -> Foo { | ^^^ help: use the applicable keyword: `Self` error: unnecessary structure name repetition - --> $DIR/use_self.rs:15:13 + --> $DIR/use_self.rs:17:13 | -15 | Foo::new() +17 | Foo::new() | ^^^^^^^^ help: use the applicable keyword: `Self` error: unnecessary structure name repetition - --> $DIR/use_self.rs:20:25 + --> $DIR/use_self.rs:22:25 | -20 | fn default() -> Foo { +22 | fn default() -> Foo { | ^^^ help: use the applicable keyword: `Self` error: unnecessary structure name repetition - --> $DIR/use_self.rs:21:13 + --> $DIR/use_self.rs:23:13 | -21 | Foo::new() +23 | Foo::new() | ^^^^^^^^ help: use the applicable keyword: `Self` error: unnecessary structure name repetition - --> $DIR/use_self.rs:84:22 + --> $DIR/use_self.rs:86:22 | -84 | fn refs(p1: &Bad) -> &Bad { +86 | fn refs(p1: &Bad) -> &Bad { | ^^^ help: use the applicable keyword: `Self` error: unnecessary structure name repetition - --> $DIR/use_self.rs:84:31 + --> $DIR/use_self.rs:86:31 | -84 | fn refs(p1: &Bad) -> &Bad { +86 | fn refs(p1: &Bad) -> &Bad { | ^^^ help: use the applicable keyword: `Self` error: unnecessary structure name repetition - --> $DIR/use_self.rs:88:37 + --> $DIR/use_self.rs:90:37 | -88 | fn ref_refs<'a>(p1: &'a &'a Bad) -> &'a &'a Bad { +90 | fn ref_refs<'a>(p1: &'a &'a Bad) -> &'a &'a Bad { | ^^^ help: use the applicable keyword: `Self` error: unnecessary structure name repetition - --> $DIR/use_self.rs:88:53 + --> $DIR/use_self.rs:90:53 | -88 | fn ref_refs<'a>(p1: &'a &'a Bad) -> &'a &'a Bad { +90 | fn ref_refs<'a>(p1: &'a &'a Bad) -> &'a &'a Bad { | ^^^ help: use the applicable keyword: `Self` error: unnecessary structure name repetition - --> $DIR/use_self.rs:92:30 + --> $DIR/use_self.rs:94:30 | -92 | fn mut_refs(p1: &mut Bad) -> &mut Bad { +94 | fn mut_refs(p1: &mut Bad) -> &mut Bad { | ^^^ help: use the applicable keyword: `Self` error: unnecessary structure name repetition - --> $DIR/use_self.rs:92:43 + --> $DIR/use_self.rs:94:43 | -92 | fn mut_refs(p1: &mut Bad) -> &mut Bad { +94 | fn mut_refs(p1: &mut Bad) -> &mut Bad { | ^^^ help: use the applicable keyword: `Self` error: unnecessary structure name repetition - --> $DIR/use_self.rs:96:28 + --> $DIR/use_self.rs:98:28 | -96 | fn nested(_p1: Box, _p2: (&u8, &Bad)) { +98 | fn nested(_p1: Box, _p2: (&u8, &Bad)) { | ^^^ help: use the applicable keyword: `Self` error: unnecessary structure name repetition - --> $DIR/use_self.rs:96:46 + --> $DIR/use_self.rs:98:46 | -96 | fn nested(_p1: Box, _p2: (&u8, &Bad)) { +98 | fn nested(_p1: Box, _p2: (&u8, &Bad)) { | ^^^ help: use the applicable keyword: `Self` error: unnecessary structure name repetition - --> $DIR/use_self.rs:99:20 - | -99 | fn vals(_: Bad) -> Bad { - | ^^^ help: use the applicable keyword: `Self` - -error: unnecessary structure name repetition - --> $DIR/use_self.rs:99:28 - | -99 | fn vals(_: Bad) -> Bad { - | ^^^ help: use the applicable keyword: `Self` - -error: unnecessary structure name repetition - --> $DIR/use_self.rs:100:13 + --> $DIR/use_self.rs:101:20 | -100 | Bad::default() +101 | fn vals(_: Bad) -> Bad { + | ^^^ help: use the applicable keyword: `Self` + +error: unnecessary structure name repetition + --> $DIR/use_self.rs:101:28 + | +101 | fn vals(_: Bad) -> Bad { + | ^^^ help: use the applicable keyword: `Self` + +error: unnecessary structure name repetition + --> $DIR/use_self.rs:102:13 + | +102 | Bad::default() | ^^^^^^^^^^^^ help: use the applicable keyword: `Self` error: unnecessary structure name repetition - --> $DIR/use_self.rs:105:23 + --> $DIR/use_self.rs:107:23 | -105 | type Output = Bad; +107 | type Output = Bad; | ^^^ help: use the applicable keyword: `Self` error: unnecessary structure name repetition - --> $DIR/use_self.rs:107:27 + --> $DIR/use_self.rs:109:27 | -107 | fn mul(self, rhs: Bad) -> Bad { +109 | fn mul(self, rhs: Bad) -> Bad { | ^^^ help: use the applicable keyword: `Self` error: unnecessary structure name repetition - --> $DIR/use_self.rs:107:35 + --> $DIR/use_self.rs:109:35 | -107 | fn mul(self, rhs: Bad) -> Bad { +109 | fn mul(self, rhs: Bad) -> Bad { | ^^^ help: use the applicable keyword: `Self` error: aborting due to 20 previous errors diff --git a/tests/ui/used_underscore_binding.stderr b/tests/ui/used_underscore_binding.stderr index 712f81c1b..a1bb57a50 100644 --- a/tests/ui/used_underscore_binding.stderr +++ b/tests/ui/used_underscore_binding.stderr @@ -4,7 +4,7 @@ error: used binding `_foo` which is prefixed with an underscore. A leading under 17 | _foo + 1 | ^^^^ | - = note: `-D used-underscore-binding` implied by `-D warnings` + = note: `-D clippy::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. --> $DIR/used_underscore_binding.rs:22:20 diff --git a/tests/ui/useless_asref.stderr b/tests/ui/useless_asref.stderr index 875d830a3..6247fb27a 100644 --- a/tests/ui/useless_asref.stderr +++ b/tests/ui/useless_asref.stderr @@ -1,73 +1,73 @@ error: this call to `as_ref` does nothing - --> $DIR/useless_asref.rs:31:18 + --> $DIR/useless_asref.rs:33:18 | -31 | foo_rstr(rstr.as_ref()); +33 | foo_rstr(rstr.as_ref()); | ^^^^^^^^^^^^^ help: try this: `rstr` | note: lint level defined here - --> $DIR/useless_asref.rs:1:9 + --> $DIR/useless_asref.rs:3:9 | -1 | #![deny(useless_asref)] - | ^^^^^^^^^^^^^ +3 | #![deny(clippy::useless_asref)] + | ^^^^^^^^^^^^^^^^^^^^^ error: this call to `as_ref` does nothing - --> $DIR/useless_asref.rs:33:20 + --> $DIR/useless_asref.rs:35:20 | -33 | foo_rslice(rslice.as_ref()); +35 | foo_rslice(rslice.as_ref()); | ^^^^^^^^^^^^^^^ help: try this: `rslice` error: this call to `as_mut` does nothing - --> $DIR/useless_asref.rs:37:21 + --> $DIR/useless_asref.rs:39:21 | -37 | foo_mrslice(mrslice.as_mut()); +39 | foo_mrslice(mrslice.as_mut()); | ^^^^^^^^^^^^^^^^ help: try this: `mrslice` error: this call to `as_ref` does nothing - --> $DIR/useless_asref.rs:39:20 + --> $DIR/useless_asref.rs:41:20 | -39 | foo_rslice(mrslice.as_ref()); +41 | foo_rslice(mrslice.as_ref()); | ^^^^^^^^^^^^^^^^ help: try this: `mrslice` error: this call to `as_ref` does nothing - --> $DIR/useless_asref.rs:46:20 + --> $DIR/useless_asref.rs:48:20 | -46 | foo_rslice(rrrrrslice.as_ref()); +48 | foo_rslice(rrrrrslice.as_ref()); | ^^^^^^^^^^^^^^^^^^^ help: try this: `rrrrrslice` error: this call to `as_ref` does nothing - --> $DIR/useless_asref.rs:48:18 + --> $DIR/useless_asref.rs:50:18 | -48 | foo_rstr(rrrrrstr.as_ref()); +50 | foo_rstr(rrrrrstr.as_ref()); | ^^^^^^^^^^^^^^^^^ help: try this: `rrrrrstr` error: this call to `as_mut` does nothing - --> $DIR/useless_asref.rs:53:21 + --> $DIR/useless_asref.rs:55:21 | -53 | foo_mrslice(mrrrrrslice.as_mut()); +55 | foo_mrslice(mrrrrrslice.as_mut()); | ^^^^^^^^^^^^^^^^^^^^ help: try this: `mrrrrrslice` error: this call to `as_ref` does nothing - --> $DIR/useless_asref.rs:55:20 + --> $DIR/useless_asref.rs:57:20 | -55 | foo_rslice(mrrrrrslice.as_ref()); +57 | foo_rslice(mrrrrrslice.as_ref()); | ^^^^^^^^^^^^^^^^^^^^ help: try this: `mrrrrrslice` error: this call to `as_ref` does nothing - --> $DIR/useless_asref.rs:58:16 + --> $DIR/useless_asref.rs:60:16 | -58 | foo_rrrrmr((&&&&MoreRef).as_ref()); +60 | foo_rrrrmr((&&&&MoreRef).as_ref()); | ^^^^^^^^^^^^^^^^^^^^^^ help: try this: `(&&&&MoreRef)` error: this call to `as_mut` does nothing - --> $DIR/useless_asref.rs:104:13 + --> $DIR/useless_asref.rs:106:13 | -104 | foo_mrt(mrt.as_mut()); +106 | foo_mrt(mrt.as_mut()); | ^^^^^^^^^^^^ help: try this: `mrt` error: this call to `as_ref` does nothing - --> $DIR/useless_asref.rs:106:12 + --> $DIR/useless_asref.rs:108:12 | -106 | foo_rt(mrt.as_ref()); +108 | foo_rt(mrt.as_ref()); | ^^^^^^^^^^^^ help: try this: `mrt` error: aborting due to 11 previous errors diff --git a/tests/ui/useless_attribute.stderr b/tests/ui/useless_attribute.stderr index 84b81e561..59f1aaffb 100644 --- a/tests/ui/useless_attribute.stderr +++ b/tests/ui/useless_attribute.stderr @@ -4,7 +4,7 @@ error: useless lint attribute 5 | #[allow(dead_code, unused_extern_crates)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: if you just forgot a `!`, use: `#![allow(dead_code, unused_extern_crates)]` | - = note: `-D useless-attribute` implied by `-D warnings` + = note: `-D clippy::useless-attribute` implied by `-D warnings` error: useless lint attribute --> $DIR/useless_attribute.rs:6:1 diff --git a/tests/ui/vec.stderr b/tests/ui/vec.stderr index 6a47eb5b0..b9541e58c 100644 --- a/tests/ui/vec.stderr +++ b/tests/ui/vec.stderr @@ -4,7 +4,7 @@ error: useless use of `vec!` 24 | on_slice(&vec![]); | ^^^^^^^ help: you can use a slice directly: `&[]` | - = note: `-D useless-vec` implied by `-D warnings` + = note: `-D clippy::useless-vec` implied by `-D warnings` error: useless use of `vec!` --> $DIR/vec.rs:27:14 diff --git a/tests/ui/while_loop.stderr b/tests/ui/while_loop.stderr index d2b50b61e..cc309e379 100644 --- a/tests/ui/while_loop.stderr +++ b/tests/ui/while_loop.stderr @@ -10,7 +10,7 @@ error: this loop could be written as a `while let` loop 15 | | } | |_____^ help: try: `while let Some(_x) = y { .. }` | - = note: `-D while-let-loop` implied by `-D warnings` + = note: `-D clippy::while-let-loop` implied by `-D warnings` error: this loop could be written as a `while let` loop --> $DIR/while_loop.rs:22:5 @@ -65,7 +65,7 @@ error: this loop could be written as a `for` loop 68 | while let Option::Some(x) = iter.next() { | ^^^^^^^^^^^ help: try: `for x in iter { .. }` | - = note: `-D while-let-on-iterator` implied by `-D warnings` + = note: `-D clippy::while-let-on-iterator` implied by `-D warnings` error: this loop could be written as a `for` loop --> $DIR/while_loop.rs:73:25 @@ -97,7 +97,7 @@ error: empty `loop {}` detected. You may want to either use `panic!()` or add `s 123 | loop {} | ^^^^^^^ | - = note: `-D empty-loop` implied by `-D warnings` + = note: `-D clippy::empty-loop` implied by `-D warnings` error: this loop could be written as a `for` loop --> $DIR/while_loop.rs:183:29 diff --git a/tests/ui/write_literal.stderr b/tests/ui/write_literal.stderr index d2e8ca94e..644f6f15b 100644 --- a/tests/ui/write_literal.stderr +++ b/tests/ui/write_literal.stderr @@ -1,87 +1,87 @@ error: literal with an empty format string - --> $DIR/write_literal.rs:27:79 + --> $DIR/write_literal.rs:29:79 | -27 | writeln!(&mut v, "{} of {:b} people know binary, the other half doesn't", 1, 2); +29 | writeln!(&mut v, "{} of {:b} people know binary, the other half doesn't", 1, 2); | ^ | - = note: `-D write-literal` implied by `-D warnings` + = note: `-D clippy::write-literal` implied by `-D warnings` error: literal with an empty format string - --> $DIR/write_literal.rs:28:32 + --> $DIR/write_literal.rs:30:32 | -28 | write!(&mut v, "Hello {}", "world"); +30 | write!(&mut v, "Hello {}", "world"); | ^^^^^^^ error: literal with an empty format string - --> $DIR/write_literal.rs:29:44 + --> $DIR/write_literal.rs:31:44 | -29 | writeln!(&mut v, "Hello {} {}", world, "world"); +31 | writeln!(&mut v, "Hello {} {}", world, "world"); | ^^^^^^^ error: literal with an empty format string - --> $DIR/write_literal.rs:30:34 + --> $DIR/write_literal.rs:32:34 | -30 | writeln!(&mut v, "Hello {}", "world"); +32 | writeln!(&mut v, "Hello {}", "world"); | ^^^^^^^ error: literal with an empty format string - --> $DIR/write_literal.rs:31:38 + --> $DIR/write_literal.rs:33:38 | -31 | writeln!(&mut v, "10 / 4 is {}", 2.5); +33 | writeln!(&mut v, "10 / 4 is {}", 2.5); | ^^^ error: literal with an empty format string - --> $DIR/write_literal.rs:32:36 + --> $DIR/write_literal.rs:34:36 | -32 | writeln!(&mut v, "2 + 1 = {}", 3); +34 | writeln!(&mut v, "2 + 1 = {}", 3); | ^ error: literal with an empty format string - --> $DIR/write_literal.rs:37:33 + --> $DIR/write_literal.rs:39:33 | -37 | writeln!(&mut v, "{0} {1}", "hello", "world"); +39 | writeln!(&mut v, "{0} {1}", "hello", "world"); | ^^^^^^^ error: literal with an empty format string - --> $DIR/write_literal.rs:37:42 + --> $DIR/write_literal.rs:39:42 | -37 | writeln!(&mut v, "{0} {1}", "hello", "world"); +39 | writeln!(&mut v, "{0} {1}", "hello", "world"); | ^^^^^^^ error: literal with an empty format string - --> $DIR/write_literal.rs:38:33 + --> $DIR/write_literal.rs:40:33 | -38 | writeln!(&mut v, "{1} {0}", "hello", "world"); +40 | writeln!(&mut v, "{1} {0}", "hello", "world"); | ^^^^^^^ error: literal with an empty format string - --> $DIR/write_literal.rs:38:42 + --> $DIR/write_literal.rs:40:42 | -38 | writeln!(&mut v, "{1} {0}", "hello", "world"); +40 | writeln!(&mut v, "{1} {0}", "hello", "world"); | ^^^^^^^ error: literal with an empty format string - --> $DIR/write_literal.rs:41:41 + --> $DIR/write_literal.rs:43:41 | -41 | writeln!(&mut v, "{foo} {bar}", foo="hello", bar="world"); +43 | writeln!(&mut v, "{foo} {bar}", foo="hello", bar="world"); | ^^^^^^^ error: literal with an empty format string - --> $DIR/write_literal.rs:41:54 + --> $DIR/write_literal.rs:43:54 | -41 | writeln!(&mut v, "{foo} {bar}", foo="hello", bar="world"); +43 | writeln!(&mut v, "{foo} {bar}", foo="hello", bar="world"); | ^^^^^^^ error: literal with an empty format string - --> $DIR/write_literal.rs:42:41 + --> $DIR/write_literal.rs:44:41 | -42 | writeln!(&mut v, "{bar} {foo}", foo="hello", bar="world"); +44 | writeln!(&mut v, "{bar} {foo}", foo="hello", bar="world"); | ^^^^^^^ error: literal with an empty format string - --> $DIR/write_literal.rs:42:54 + --> $DIR/write_literal.rs:44:54 | -42 | writeln!(&mut v, "{bar} {foo}", foo="hello", bar="world"); +44 | writeln!(&mut v, "{bar} {foo}", foo="hello", bar="world"); | ^^^^^^^ error: aborting due to 14 previous errors diff --git a/tests/ui/write_with_newline.stderr b/tests/ui/write_with_newline.stderr index a8a6039f3..c8617b493 100644 --- a/tests/ui/write_with_newline.stderr +++ b/tests/ui/write_with_newline.stderr @@ -1,27 +1,27 @@ -error: using `write!()` with a format string that ends in a single newline, consider using `writeln!()` instead - --> $DIR/write_with_newline.rs:10:5 - | -10 | write!(&mut v, "Hello/n"); - | ^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: `-D write-with-newline` implied by `-D warnings` - -error: using `write!()` with a format string that ends in a single newline, consider using `writeln!()` instead - --> $DIR/write_with_newline.rs:11:5 - | -11 | write!(&mut v, "Hello {}/n", "world"); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - error: using `write!()` with a format string that ends in a single newline, consider using `writeln!()` instead --> $DIR/write_with_newline.rs:12:5 | -12 | write!(&mut v, "Hello {} {}/n", "world", "#2"); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +12 | write!(&mut v, "Hello/n"); + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: `-D clippy::write-with-newline` implied by `-D warnings` error: using `write!()` with a format string that ends in a single newline, consider using `writeln!()` instead --> $DIR/write_with_newline.rs:13:5 | -13 | write!(&mut v, "{}/n", 1265); +13 | write!(&mut v, "Hello {}/n", "world"); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: using `write!()` with a format string that ends in a single newline, consider using `writeln!()` instead + --> $DIR/write_with_newline.rs:14:5 + | +14 | write!(&mut v, "Hello {} {}/n", "world", "#2"); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: using `write!()` with a format string that ends in a single newline, consider using `writeln!()` instead + --> $DIR/write_with_newline.rs:15:5 + | +15 | write!(&mut v, "{}/n", 1265); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 4 previous errors diff --git a/tests/ui/writeln_empty_string.stderr b/tests/ui/writeln_empty_string.stderr index 7bb6350ec..ef1e9b3d3 100644 --- a/tests/ui/writeln_empty_string.stderr +++ b/tests/ui/writeln_empty_string.stderr @@ -1,15 +1,15 @@ error: using `writeln!(&mut v, "")` - --> $DIR/writeln_empty_string.rs:9:5 - | -9 | writeln!(&mut v, ""); - | ^^^^^^^^^^^^^^^^^^^^ help: replace it with: `writeln!(&mut v)` - | - = note: `-D writeln-empty-string` implied by `-D warnings` + --> $DIR/writeln_empty_string.rs:11:5 + | +11 | writeln!(&mut v, ""); + | ^^^^^^^^^^^^^^^^^^^^ help: replace it with: `writeln!(&mut v)` + | + = note: `-D clippy::writeln-empty-string` implied by `-D warnings` error: using `writeln!(&mut suggestion, "")` - --> $DIR/writeln_empty_string.rs:12:5 + --> $DIR/writeln_empty_string.rs:14:5 | -12 | writeln!(&mut suggestion, ""); +14 | writeln!(&mut suggestion, ""); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `writeln!(&mut suggestion)` error: aborting due to 2 previous errors diff --git a/tests/ui/wrong_self_convention.stderr b/tests/ui/wrong_self_convention.stderr index 216fd0bb8..4a6e5e0ab 100644 --- a/tests/ui/wrong_self_convention.stderr +++ b/tests/ui/wrong_self_convention.stderr @@ -4,7 +4,7 @@ error: methods called `from_*` usually take no self; consider choosing a less am 21 | fn from_i32(self) {} | ^^^^ | - = note: `-D wrong-self-convention` implied by `-D warnings` + = note: `-D clippy::wrong-self-convention` implied by `-D warnings` error: methods called `from_*` usually take no self; consider choosing a less ambiguous name --> $DIR/wrong_self_convention.rs:27:21 diff --git a/tests/ui/zero_div_zero.stderr b/tests/ui/zero_div_zero.stderr index f1788fc9e..a5e86883d 100644 --- a/tests/ui/zero_div_zero.stderr +++ b/tests/ui/zero_div_zero.stderr @@ -4,7 +4,7 @@ error: equal expressions as operands to `/` 7 | let nan = 0.0 / 0.0; | ^^^^^^^^^ | - = note: #[deny(eq_op)] on by default + = note: #[deny(clippy::eq_op)] on by default error: constant division of 0.0 with 0.0 will always result in NaN --> $DIR/zero_div_zero.rs:7:15 @@ -12,7 +12,7 @@ error: constant division of 0.0 with 0.0 will always result in NaN 7 | let nan = 0.0 / 0.0; | ^^^^^^^^^ | - = note: `-D zero-divided-by-zero` implied by `-D warnings` + = note: `-D clippy::zero-divided-by-zero` implied by `-D warnings` = help: Consider using `std::f64::NAN` if you would like a constant representing NaN error: equal expressions as operands to `/` diff --git a/tests/ui/zero_ptr.stderr b/tests/ui/zero_ptr.stderr index 5155dc401..b5e279eaa 100644 --- a/tests/ui/zero_ptr.stderr +++ b/tests/ui/zero_ptr.stderr @@ -4,7 +4,7 @@ error: `0 as *const _` detected. Consider using `ptr::null()` 6 | let x = 0 as *const usize; | ^^^^^^^^^^^^^^^^^ | - = note: `-D zero-ptr` implied by `-D warnings` + = note: `-D clippy::zero-ptr` implied by `-D warnings` error: `0 as *mut _` detected. Consider using `ptr::null_mut()` --> $DIR/zero_ptr.rs:7:13