diff --git a/tests/ui/cast.rs b/tests/ui/cast.rs index 45e878e9d80..51e41b70172 100644 --- a/tests/ui/cast.rs +++ b/tests/ui/cast.rs @@ -51,7 +51,8 @@ fn main() { false as bool; &1i32 as &i32; // Should not trigger - let v = vec![1]; + #[rustfmt::skip] + let v = vec!(1); &v as &[i32]; 1.0 as f64; 1 as u64; diff --git a/tests/ui/identity_op.rs b/tests/ui/identity_op.rs index c8874250a04..299cd2a6786 100644 --- a/tests/ui/identity_op.rs +++ b/tests/ui/identity_op.rs @@ -18,6 +18,7 @@ const ZERO: i64 = 0; clippy::double_parens )] #[warn(clippy::identity_op)] +#[rustfmt::skip] fn main() { let x = 0; @@ -28,7 +29,7 @@ fn main() { 1 + x; x - ZERO; //no error, as we skip lookups (for now) x | (0); - (ZERO) | x; //no error, as we skip lookups (for now) + ((ZERO)) | x; //no error, as we skip lookups (for now) x * 1; 1 * x; diff --git a/tests/ui/identity_op.stderr b/tests/ui/identity_op.stderr index e2b6efa7dbe..19846b5ecdf 100644 --- a/tests/ui/identity_op.stderr +++ b/tests/ui/identity_op.stderr @@ -1,51 +1,51 @@ error: the operation is ineffective. Consider reducing it to `x` - --> $DIR/identity_op.rs:24:5 + --> $DIR/identity_op.rs:25:5 | -24 | x + 0; +25 | x + 0; | ^^^^^ | = note: `-D clippy::identity-op` implied by `-D warnings` error: the operation is ineffective. Consider reducing it to `x` - --> $DIR/identity_op.rs:25:5 + --> $DIR/identity_op.rs:26:5 | -25 | x + (1 - 1); +26 | x + (1 - 1); | ^^^^^^^^^^^ error: the operation is ineffective. Consider reducing it to `x` - --> $DIR/identity_op.rs:27:5 + --> $DIR/identity_op.rs:28:5 | -27 | 0 + x; +28 | 0 + x; | ^^^^^ error: the operation is ineffective. Consider reducing it to `x` - --> $DIR/identity_op.rs:30:5 + --> $DIR/identity_op.rs:31:5 | -30 | x | (0); +31 | x | (0); | ^^^^^^^ -error: the operation is ineffective. Consider reducing it to `x` - --> $DIR/identity_op.rs:33:5 - | -33 | x * 1; - | ^^^^^ - error: the operation is ineffective. Consider reducing it to `x` --> $DIR/identity_op.rs:34:5 | -34 | 1 * x; +34 | x * 1; | ^^^^^ error: the operation is ineffective. Consider reducing it to `x` - --> $DIR/identity_op.rs:40:5 + --> $DIR/identity_op.rs:35:5 | -40 | -1 & x; +35 | 1 * x; + | ^^^^^ + +error: the operation is ineffective. Consider reducing it to `x` + --> $DIR/identity_op.rs:41:5 + | +41 | -1 & x; | ^^^^^^ error: the operation is ineffective. Consider reducing it to `u` - --> $DIR/identity_op.rs:43:5 + --> $DIR/identity_op.rs:44:5 | -43 | u & 255; +44 | u & 255; | ^^^^^^^ error: aborting due to 8 previous errors diff --git a/tests/ui/implicit_return.rs b/tests/ui/implicit_return.rs index 3bff92cf492..6188835e555 100644 --- a/tests/ui/implicit_return.rs +++ b/tests/ui/implicit_return.rs @@ -27,10 +27,11 @@ fn test_if_block() -> bool { } #[allow(clippy::match_bool)] +#[rustfmt::skip] fn test_match(x: bool) -> bool { match x { true => false, - false => true, + false => { true }, } } @@ -42,7 +43,8 @@ fn test_loop() -> bool { } fn test_closure() { - let _ = || true; + #[rustfmt::skip] + let _ = || { true }; let _ = || true; } diff --git a/tests/ui/implicit_return.stderr b/tests/ui/implicit_return.stderr index 26474aab4b8..b2feec3f57a 100644 --- a/tests/ui/implicit_return.stderr +++ b/tests/ui/implicit_return.stderr @@ -19,33 +19,33 @@ error: missing return statement | ^^^^^ help: add `return` as shown: `return false` error: missing return statement - --> $DIR/implicit_return.rs:32:17 + --> $DIR/implicit_return.rs:33:17 | -32 | true => false, +33 | true => false, | ^^^^^ help: add `return` as shown: `return false` error: missing return statement - --> $DIR/implicit_return.rs:33:18 + --> $DIR/implicit_return.rs:34:20 | -33 | false => true, - | ^^^^ help: add `return` as shown: `return true` +34 | false => { true }, + | ^^^^ help: add `return` as shown: `return true` error: missing return statement - --> $DIR/implicit_return.rs:40:9 + --> $DIR/implicit_return.rs:41:9 | -40 | break true; +41 | break true; | ^^^^^^^^^^ help: change `break` to `return` as shown: `return true` error: missing return statement - --> $DIR/implicit_return.rs:45:16 + --> $DIR/implicit_return.rs:47:18 | -45 | let _ = || true; - | ^^^^ help: add `return` as shown: `return true` +47 | let _ = || { true }; + | ^^^^ help: add `return` as shown: `return true` error: missing return statement - --> $DIR/implicit_return.rs:46:16 + --> $DIR/implicit_return.rs:48:16 | -46 | let _ = || true; +48 | let _ = || true; | ^^^^ help: add `return` as shown: `return true` error: aborting due to 8 previous errors diff --git a/tests/ui/reference.rs b/tests/ui/reference.rs index 583829aae41..bab0c21ffd9 100644 --- a/tests/ui/reference.rs +++ b/tests/ui/reference.rs @@ -37,7 +37,8 @@ fn main() { let b = *(&a); - let b = *(&a); + #[rustfmt::skip] + let b = *((&a)); let b = *&&a; diff --git a/tests/ui/reference.stderr b/tests/ui/reference.stderr index c09a31e2d8a..7665e0d1932 100644 --- a/tests/ui/reference.stderr +++ b/tests/ui/reference.stderr @@ -31,39 +31,39 @@ error: immediately dereferencing a reference | ^^^^^ help: try this: `a` error: immediately dereferencing a reference - --> $DIR/reference.rs:40:13 + --> $DIR/reference.rs:41:13 | -40 | let b = *(&a); - | ^^^^^ help: try this: `a` +41 | let b = *((&a)); + | ^^^^^^^ help: try this: `a` error: immediately dereferencing a reference - --> $DIR/reference.rs:42:13 + --> $DIR/reference.rs:43:13 | -42 | let b = *&&a; +43 | let b = *&&a; | ^^^^ help: try this: `&a` error: immediately dereferencing a reference - --> $DIR/reference.rs:44:14 + --> $DIR/reference.rs:45:14 | -44 | let b = **&aref; +45 | let b = **&aref; | ^^^^^^ help: try this: `aref` error: immediately dereferencing a reference - --> $DIR/reference.rs:48:14 + --> $DIR/reference.rs:49:14 | -48 | let b = **&&a; +49 | let b = **&&a; | ^^^^ help: try this: `&a` error: immediately dereferencing a reference - --> $DIR/reference.rs:52:17 + --> $DIR/reference.rs:53:17 | -52 | let y = *&mut x; +53 | let y = *&mut x; | ^^^^^^^ help: try this: `x` error: immediately dereferencing a reference - --> $DIR/reference.rs:59:18 + --> $DIR/reference.rs:60:18 | -59 | let y = **&mut &mut x; +60 | let y = **&mut &mut x; | ^^^^^^^^^^^^ help: try this: `&mut x` error: aborting due to 11 previous errors diff --git a/tests/ui/useless_attribute.rs b/tests/ui/useless_attribute.rs index 4ee6520443d..2d7a9ae04d1 100644 --- a/tests/ui/useless_attribute.rs +++ b/tests/ui/useless_attribute.rs @@ -11,7 +11,9 @@ #[allow(dead_code)] #[cfg_attr(feature = "cargo-clippy", allow(dead_code))] -#[cfg_attr(feature = "cargo-clippy", allow(dead_code))] +#[rustfmt::skip] +#[cfg_attr(feature = "cargo-clippy", + allow(dead_code))] #[allow(unused_imports)] #[allow(unused_extern_crates)] #[macro_use] diff --git a/tests/ui/useless_attribute.stderr b/tests/ui/useless_attribute.stderr index 54d18fbf2e1..2dde3fd7eac 100644 --- a/tests/ui/useless_attribute.stderr +++ b/tests/ui/useless_attribute.stderr @@ -12,11 +12,5 @@ error: useless lint attribute 13 | #[cfg_attr(feature = "cargo-clippy", allow(dead_code))] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: if you just forgot a `!`, use: `#![cfg_attr(feature = "cargo-clippy", allow(dead_code)` -error: useless lint attribute - --> $DIR/useless_attribute.rs:14:1 - | -14 | #[cfg_attr(feature = "cargo-clippy", allow(dead_code))] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: if you just forgot a `!`, use: `#![cfg_attr(feature = "cargo-clippy", allow(dead_code)` - -error: aborting due to 3 previous errors +error: aborting due to 2 previous errors diff --git a/tests/ui/vec.rs b/tests/ui/vec.rs index a7ccda375bf..f795c11ec5b 100644 --- a/tests/ui/vec.rs +++ b/tests/ui/vec.rs @@ -35,8 +35,8 @@ fn main() { on_slice(&vec![1, 2]); on_slice(&[1, 2]); - - on_slice(&vec![1, 2]); + #[rustfmt::skip] + on_slice(&vec!(1, 2)); on_slice(&[1, 2]); on_slice(&vec![1; 2]); diff --git a/tests/ui/vec.stderr b/tests/ui/vec.stderr index 94e9bcdd2a7..ccd6a7d25c7 100644 --- a/tests/ui/vec.stderr +++ b/tests/ui/vec.stderr @@ -21,7 +21,7 @@ error: useless use of `vec!` error: useless use of `vec!` --> $DIR/vec.rs:39:14 | -39 | on_slice(&vec![1, 2]); +39 | on_slice(&vec!(1, 2)); | ^^^^^^^^^^^ help: you can use a slice directly: `&[1, 2]` error: useless use of `vec!`