Skip to content

Commit f1d5194

Browse files
committed
tests: revert some changs and add further rustfmt::skip attributes.
1 parent 0a6e568 commit f1d5194

11 files changed

+58
-57
lines changed

tests/ui/cast.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@ fn main() {
5151
false as bool;
5252
&1i32 as &i32;
5353
// Should not trigger
54-
let v = vec![1];
54+
#[rustfmt::skip]
55+
let v = vec!(1);
5556
&v as &[i32];
5657
1.0 as f64;
5758
1 as u64;

tests/ui/identity_op.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ const ZERO: i64 = 0;
1818
clippy::double_parens
1919
)]
2020
#[warn(clippy::identity_op)]
21+
#[rustfmt::skip]
2122
fn main() {
2223
let x = 0;
2324

@@ -28,7 +29,7 @@ fn main() {
2829
1 + x;
2930
x - ZERO; //no error, as we skip lookups (for now)
3031
x | (0);
31-
(ZERO) | x; //no error, as we skip lookups (for now)
32+
((ZERO)) | x; //no error, as we skip lookups (for now)
3233

3334
x * 1;
3435
1 * x;

tests/ui/identity_op.stderr

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,51 @@
11
error: the operation is ineffective. Consider reducing it to `x`
2-
--> $DIR/identity_op.rs:24:5
2+
--> $DIR/identity_op.rs:25:5
33
|
4-
24 | x + 0;
4+
25 | x + 0;
55
| ^^^^^
66
|
77
= note: `-D clippy::identity-op` implied by `-D warnings`
88

99
error: the operation is ineffective. Consider reducing it to `x`
10-
--> $DIR/identity_op.rs:25:5
10+
--> $DIR/identity_op.rs:26:5
1111
|
12-
25 | x + (1 - 1);
12+
26 | x + (1 - 1);
1313
| ^^^^^^^^^^^
1414

1515
error: the operation is ineffective. Consider reducing it to `x`
16-
--> $DIR/identity_op.rs:27:5
16+
--> $DIR/identity_op.rs:28:5
1717
|
18-
27 | 0 + x;
18+
28 | 0 + x;
1919
| ^^^^^
2020

2121
error: the operation is ineffective. Consider reducing it to `x`
22-
--> $DIR/identity_op.rs:30:5
22+
--> $DIR/identity_op.rs:31:5
2323
|
24-
30 | x | (0);
24+
31 | x | (0);
2525
| ^^^^^^^
2626

2727
error: the operation is ineffective. Consider reducing it to `x`
28-
--> $DIR/identity_op.rs:33:5
28+
--> $DIR/identity_op.rs:34:5
2929
|
30-
33 | x * 1;
30+
34 | x * 1;
3131
| ^^^^^
3232

3333
error: the operation is ineffective. Consider reducing it to `x`
34-
--> $DIR/identity_op.rs:34:5
34+
--> $DIR/identity_op.rs:35:5
3535
|
36-
34 | 1 * x;
36+
35 | 1 * x;
3737
| ^^^^^
3838

3939
error: the operation is ineffective. Consider reducing it to `x`
40-
--> $DIR/identity_op.rs:40:5
40+
--> $DIR/identity_op.rs:41:5
4141
|
42-
40 | -1 & x;
42+
41 | -1 & x;
4343
| ^^^^^^
4444

4545
error: the operation is ineffective. Consider reducing it to `u`
46-
--> $DIR/identity_op.rs:43:5
46+
--> $DIR/identity_op.rs:44:5
4747
|
48-
43 | u & 255;
48+
44 | u & 255;
4949
| ^^^^^^^
5050

5151
error: aborting due to 8 previous errors

tests/ui/implicit_return.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,11 @@ fn test_if_block() -> bool {
2727
}
2828

2929
#[allow(clippy::match_bool)]
30+
#[rustfmt::skip]
3031
fn test_match(x: bool) -> bool {
3132
match x {
3233
true => false,
33-
false => true,
34+
false => { true },
3435
}
3536
}
3637

@@ -42,7 +43,8 @@ fn test_loop() -> bool {
4243
}
4344

4445
fn test_closure() {
45-
let _ = || true;
46+
#[rustfmt::skip]
47+
let _ = || { true };
4648
let _ = || true;
4749
}
4850

tests/ui/implicit_return.stderr

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,33 +19,33 @@ error: missing return statement
1919
| ^^^^^ help: add `return` as shown: `return false`
2020

2121
error: missing return statement
22-
--> $DIR/implicit_return.rs:32:17
22+
--> $DIR/implicit_return.rs:33:17
2323
|
24-
32 | true => false,
24+
33 | true => false,
2525
| ^^^^^ help: add `return` as shown: `return false`
2626

2727
error: missing return statement
28-
--> $DIR/implicit_return.rs:33:18
28+
--> $DIR/implicit_return.rs:34:20
2929
|
30-
33 | false => true,
31-
| ^^^^ help: add `return` as shown: `return true`
30+
34 | false => { true },
31+
| ^^^^ help: add `return` as shown: `return true`
3232

3333
error: missing return statement
34-
--> $DIR/implicit_return.rs:40:9
34+
--> $DIR/implicit_return.rs:41:9
3535
|
36-
40 | break true;
36+
41 | break true;
3737
| ^^^^^^^^^^ help: change `break` to `return` as shown: `return true`
3838

3939
error: missing return statement
40-
--> $DIR/implicit_return.rs:45:16
40+
--> $DIR/implicit_return.rs:47:18
4141
|
42-
45 | let _ = || true;
43-
| ^^^^ help: add `return` as shown: `return true`
42+
47 | let _ = || { true };
43+
| ^^^^ help: add `return` as shown: `return true`
4444

4545
error: missing return statement
46-
--> $DIR/implicit_return.rs:46:16
46+
--> $DIR/implicit_return.rs:48:16
4747
|
48-
46 | let _ = || true;
48+
48 | let _ = || true;
4949
| ^^^^ help: add `return` as shown: `return true`
5050

5151
error: aborting due to 8 previous errors

tests/ui/reference.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ fn main() {
3737

3838
let b = *(&a);
3939

40-
let b = *(&a);
40+
#[rustfmt::skip]
41+
let b = *((&a));
4142

4243
let b = *&&a;
4344

tests/ui/reference.stderr

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -31,39 +31,39 @@ error: immediately dereferencing a reference
3131
| ^^^^^ help: try this: `a`
3232

3333
error: immediately dereferencing a reference
34-
--> $DIR/reference.rs:40:13
34+
--> $DIR/reference.rs:41:13
3535
|
36-
40 | let b = *(&a);
37-
| ^^^^^ help: try this: `a`
36+
41 | let b = *((&a));
37+
| ^^^^^^^ help: try this: `a`
3838

3939
error: immediately dereferencing a reference
40-
--> $DIR/reference.rs:42:13
40+
--> $DIR/reference.rs:43:13
4141
|
42-
42 | let b = *&&a;
42+
43 | let b = *&&a;
4343
| ^^^^ help: try this: `&a`
4444

4545
error: immediately dereferencing a reference
46-
--> $DIR/reference.rs:44:14
46+
--> $DIR/reference.rs:45:14
4747
|
48-
44 | let b = **&aref;
48+
45 | let b = **&aref;
4949
| ^^^^^^ help: try this: `aref`
5050

5151
error: immediately dereferencing a reference
52-
--> $DIR/reference.rs:48:14
52+
--> $DIR/reference.rs:49:14
5353
|
54-
48 | let b = **&&a;
54+
49 | let b = **&&a;
5555
| ^^^^ help: try this: `&a`
5656

5757
error: immediately dereferencing a reference
58-
--> $DIR/reference.rs:52:17
58+
--> $DIR/reference.rs:53:17
5959
|
60-
52 | let y = *&mut x;
60+
53 | let y = *&mut x;
6161
| ^^^^^^^ help: try this: `x`
6262

6363
error: immediately dereferencing a reference
64-
--> $DIR/reference.rs:59:18
64+
--> $DIR/reference.rs:60:18
6565
|
66-
59 | let y = **&mut &mut x;
66+
60 | let y = **&mut &mut x;
6767
| ^^^^^^^^^^^^ help: try this: `&mut x`
6868

6969
error: aborting due to 11 previous errors

tests/ui/useless_attribute.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@
1111

1212
#[allow(dead_code)]
1313
#[cfg_attr(feature = "cargo-clippy", allow(dead_code))]
14-
#[cfg_attr(feature = "cargo-clippy", allow(dead_code))]
14+
#[rustfmt::skip]
15+
#[cfg_attr(feature = "cargo-clippy",
16+
allow(dead_code))]
1517
#[allow(unused_imports)]
1618
#[allow(unused_extern_crates)]
1719
#[macro_use]

tests/ui/useless_attribute.stderr

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,5 @@ error: useless lint attribute
1212
13 | #[cfg_attr(feature = "cargo-clippy", allow(dead_code))]
1313
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: if you just forgot a `!`, use: `#![cfg_attr(feature = "cargo-clippy", allow(dead_code)`
1414

15-
error: useless lint attribute
16-
--> $DIR/useless_attribute.rs:14:1
17-
|
18-
14 | #[cfg_attr(feature = "cargo-clippy", allow(dead_code))]
19-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: if you just forgot a `!`, use: `#![cfg_attr(feature = "cargo-clippy", allow(dead_code)`
20-
21-
error: aborting due to 3 previous errors
15+
error: aborting due to 2 previous errors
2216

tests/ui/vec.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ fn main() {
3535

3636
on_slice(&vec![1, 2]);
3737
on_slice(&[1, 2]);
38-
39-
on_slice(&vec![1, 2]);
38+
#[rustfmt::skip]
39+
on_slice(&vec!(1, 2));
4040
on_slice(&[1, 2]);
4141

4242
on_slice(&vec![1; 2]);

tests/ui/vec.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ error: useless use of `vec!`
2121
error: useless use of `vec!`
2222
--> $DIR/vec.rs:39:14
2323
|
24-
39 | on_slice(&vec![1, 2]);
24+
39 | on_slice(&vec!(1, 2));
2525
| ^^^^^^^^^^^ help: you can use a slice directly: `&[1, 2]`
2626

2727
error: useless use of `vec!`

0 commit comments

Comments
 (0)