Skip to content

Commit 00c5105

Browse files
authored
Merge pull request #1899 from rust-lang-nursery/ui_test_changes
Fix ui tests
2 parents b6609ea + f889ba9 commit 00c5105

31 files changed

+300
-282
lines changed

clippy_tests/examples/assign_ops.stderr

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,137 +2,137 @@ error: assign operation detected
22
--> assign_ops.rs:8:5
33
|
44
8 | i += 2;
5-
| ^^^^^^ help: replace it with `i = i + 2`
5+
| ^^^^^^ help: replace it with: `i = i + 2`
66
|
77
= note: `-D assign-ops` implied by `-D warnings`
88

99
error: assign operation detected
1010
--> assign_ops.rs:9:5
1111
|
1212
9 | i += 2 + 17;
13-
| ^^^^^^^^^^^ help: replace it with `i = i + 2 + 17`
13+
| ^^^^^^^^^^^ help: replace it with: `i = i + 2 + 17`
1414

1515
error: assign operation detected
1616
--> assign_ops.rs:10:5
1717
|
1818
10 | i -= 6;
19-
| ^^^^^^ help: replace it with `i = i - 6`
19+
| ^^^^^^ help: replace it with: `i = i - 6`
2020

2121
error: assign operation detected
2222
--> assign_ops.rs:11:5
2323
|
2424
11 | i -= 2 - 1;
25-
| ^^^^^^^^^^ help: replace it with `i = i - (2 - 1)`
25+
| ^^^^^^^^^^ help: replace it with: `i = i - (2 - 1)`
2626

2727
error: assign operation detected
2828
--> assign_ops.rs:12:5
2929
|
3030
12 | i *= 5;
31-
| ^^^^^^ help: replace it with `i = i * 5`
31+
| ^^^^^^ help: replace it with: `i = i * 5`
3232

3333
error: assign operation detected
3434
--> assign_ops.rs:13:5
3535
|
3636
13 | i *= 1+5;
37-
| ^^^^^^^^ help: replace it with `i = i * (1+5)`
37+
| ^^^^^^^^ help: replace it with: `i = i * (1+5)`
3838

3939
error: assign operation detected
4040
--> assign_ops.rs:14:5
4141
|
4242
14 | i /= 32;
43-
| ^^^^^^^ help: replace it with `i = i / 32`
43+
| ^^^^^^^ help: replace it with: `i = i / 32`
4444

4545
error: assign operation detected
4646
--> assign_ops.rs:15:5
4747
|
4848
15 | i /= 32 | 5;
49-
| ^^^^^^^^^^^ help: replace it with `i = i / (32 | 5)`
49+
| ^^^^^^^^^^^ help: replace it with: `i = i / (32 | 5)`
5050

5151
error: assign operation detected
5252
--> assign_ops.rs:16:5
5353
|
5454
16 | i /= 32 / 5;
55-
| ^^^^^^^^^^^ help: replace it with `i = i / (32 / 5)`
55+
| ^^^^^^^^^^^ help: replace it with: `i = i / (32 / 5)`
5656

5757
error: assign operation detected
5858
--> assign_ops.rs:17:5
5959
|
6060
17 | i %= 42;
61-
| ^^^^^^^ help: replace it with `i = i % 42`
61+
| ^^^^^^^ help: replace it with: `i = i % 42`
6262

6363
error: assign operation detected
6464
--> assign_ops.rs:18:5
6565
|
6666
18 | i >>= i;
67-
| ^^^^^^^ help: replace it with `i = i >> i`
67+
| ^^^^^^^ help: replace it with: `i = i >> i`
6868

6969
error: assign operation detected
7070
--> assign_ops.rs:19:5
7171
|
7272
19 | i <<= 9 + 6 - 7;
73-
| ^^^^^^^^^^^^^^^ help: replace it with `i = i << (9 + 6 - 7)`
73+
| ^^^^^^^^^^^^^^^ help: replace it with: `i = i << (9 + 6 - 7)`
7474

7575
error: assign operation detected
7676
--> assign_ops.rs:20:5
7777
|
7878
20 | i += 1 << 5;
79-
| ^^^^^^^^^^^ help: replace it with `i = i + (1 << 5)`
79+
| ^^^^^^^^^^^ help: replace it with: `i = i + (1 << 5)`
8080

8181
error: manual implementation of an assign operation
8282
--> assign_ops.rs:27:5
8383
|
8484
27 | a = a + 1;
85-
| ^^^^^^^^^ help: replace it with `a += 1`
85+
| ^^^^^^^^^ help: replace it with: `a += 1`
8686
|
8787
= note: `-D assign-op-pattern` implied by `-D warnings`
8888

8989
error: manual implementation of an assign operation
9090
--> assign_ops.rs:28:5
9191
|
9292
28 | a = 1 + a;
93-
| ^^^^^^^^^ help: replace it with `a += 1`
93+
| ^^^^^^^^^ help: replace it with: `a += 1`
9494

9595
error: manual implementation of an assign operation
9696
--> assign_ops.rs:29:5
9797
|
9898
29 | a = a - 1;
99-
| ^^^^^^^^^ help: replace it with `a -= 1`
99+
| ^^^^^^^^^ help: replace it with: `a -= 1`
100100

101101
error: manual implementation of an assign operation
102102
--> assign_ops.rs:30:5
103103
|
104104
30 | a = a * 99;
105-
| ^^^^^^^^^^ help: replace it with `a *= 99`
105+
| ^^^^^^^^^^ help: replace it with: `a *= 99`
106106

107107
error: manual implementation of an assign operation
108108
--> assign_ops.rs:31:5
109109
|
110110
31 | a = 42 * a;
111-
| ^^^^^^^^^^ help: replace it with `a *= 42`
111+
| ^^^^^^^^^^ help: replace it with: `a *= 42`
112112

113113
error: manual implementation of an assign operation
114114
--> assign_ops.rs:32:5
115115
|
116116
32 | a = a / 2;
117-
| ^^^^^^^^^ help: replace it with `a /= 2`
117+
| ^^^^^^^^^ help: replace it with: `a /= 2`
118118

119119
error: manual implementation of an assign operation
120120
--> assign_ops.rs:33:5
121121
|
122122
33 | a = a % 5;
123-
| ^^^^^^^^^ help: replace it with `a %= 5`
123+
| ^^^^^^^^^ help: replace it with: `a %= 5`
124124

125125
error: manual implementation of an assign operation
126126
--> assign_ops.rs:34:5
127127
|
128128
34 | a = a & 1;
129-
| ^^^^^^^^^ help: replace it with `a &= 1`
129+
| ^^^^^^^^^ help: replace it with: `a &= 1`
130130

131131
error: manual implementation of an assign operation
132132
--> assign_ops.rs:40:5
133133
|
134134
40 | s = s + "bla";
135-
| ^^^^^^^^^^^^^ help: replace it with `s += "bla"`
135+
| ^^^^^^^^^^^^^ help: replace it with: `s += "bla"`
136136

137137
error: aborting due to 22 previous errors
138138

clippy_tests/examples/assign_ops2.stderr

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,51 +2,51 @@ error: variable appears on both sides of an assignment operation
22
--> assign_ops2.rs:8:5
33
|
44
8 | a += a + 1;
5-
| ^^^^^^^^^^ help: replace it with `a += 1`
5+
| ^^^^^^^^^^ help: replace it with: `a += 1`
66
|
77
= note: `-D misrefactored-assign-op` implied by `-D warnings`
88

99
error: variable appears on both sides of an assignment operation
1010
--> assign_ops2.rs:9:5
1111
|
1212
9 | a += 1 + a;
13-
| ^^^^^^^^^^ help: replace it with `a += 1`
13+
| ^^^^^^^^^^ help: replace it with: `a += 1`
1414

1515
error: variable appears on both sides of an assignment operation
1616
--> assign_ops2.rs:10:5
1717
|
1818
10 | a -= a - 1;
19-
| ^^^^^^^^^^ help: replace it with `a -= 1`
19+
| ^^^^^^^^^^ help: replace it with: `a -= 1`
2020

2121
error: variable appears on both sides of an assignment operation
2222
--> assign_ops2.rs:11:5
2323
|
2424
11 | a *= a * 99;
25-
| ^^^^^^^^^^^ help: replace it with `a *= 99`
25+
| ^^^^^^^^^^^ help: replace it with: `a *= 99`
2626

2727
error: variable appears on both sides of an assignment operation
2828
--> assign_ops2.rs:12:5
2929
|
3030
12 | a *= 42 * a;
31-
| ^^^^^^^^^^^ help: replace it with `a *= 42`
31+
| ^^^^^^^^^^^ help: replace it with: `a *= 42`
3232

3333
error: variable appears on both sides of an assignment operation
3434
--> assign_ops2.rs:13:5
3535
|
3636
13 | a /= a / 2;
37-
| ^^^^^^^^^^ help: replace it with `a /= 2`
37+
| ^^^^^^^^^^ help: replace it with: `a /= 2`
3838

3939
error: variable appears on both sides of an assignment operation
4040
--> assign_ops2.rs:14:5
4141
|
4242
14 | a %= a % 5;
43-
| ^^^^^^^^^^ help: replace it with `a %= 5`
43+
| ^^^^^^^^^^ help: replace it with: `a %= 5`
4444

4545
error: variable appears on both sides of an assignment operation
4646
--> assign_ops2.rs:15:5
4747
|
4848
15 | a &= a & 1;
49-
| ^^^^^^^^^^ help: replace it with `a &= 1`
49+
| ^^^^^^^^^^ help: replace it with: `a &= 1`
5050

5151
error: aborting due to 8 previous errors
5252

clippy_tests/examples/block_in_if_condition.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ error: this boolean expression can be simplified
4646
--> block_in_if_condition.rs:67:8
4747
|
4848
67 | if true && x == 3 {
49-
| ^^^^^^^^^^^^^^ help: try `x == 3`
49+
| ^^^^^^^^^^^^^^ help: try: `x == 3`
5050
|
5151
= note: `-D nonminimal-bool` implied by `-D warnings`
5252

clippy_tests/examples/bool_comparison.stderr

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,27 @@ error: equality checks against true are unnecessary
22
--> bool_comparison.rs:7:8
33
|
44
7 | if x == true { "yes" } else { "no" };
5-
| ^^^^^^^^^ help: try simplifying it as shown: `x`
5+
| ^^^^^^^^^ help: try simplifying it as shown:: `x`
66
|
77
= note: `-D bool-comparison` implied by `-D warnings`
88

99
error: equality checks against false can be replaced by a negation
1010
--> bool_comparison.rs:8:8
1111
|
1212
8 | if x == false { "yes" } else { "no" };
13-
| ^^^^^^^^^^ help: try simplifying it as shown: `!x`
13+
| ^^^^^^^^^^ help: try simplifying it as shown:: `!x`
1414

1515
error: equality checks against true are unnecessary
1616
--> bool_comparison.rs:9:8
1717
|
1818
9 | if true == x { "yes" } else { "no" };
19-
| ^^^^^^^^^ help: try simplifying it as shown: `x`
19+
| ^^^^^^^^^ help: try simplifying it as shown:: `x`
2020

2121
error: equality checks against false can be replaced by a negation
2222
--> bool_comparison.rs:10:8
2323
|
2424
10 | if false == x { "yes" } else { "no" };
25-
| ^^^^^^^^^^ help: try simplifying it as shown: `!x`
25+
| ^^^^^^^^^^ help: try simplifying it as shown:: `!x`
2626

2727
error: aborting due to 4 previous errors
2828

clippy_tests/examples/booleans.stderr

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error: this boolean expression contains a logic bug
22
--> booleans.rs:12:13
33
|
44
12 | let _ = a && b || a;
5-
| ^^^^^^^^^^^ help: it would look like the following `a`
5+
| ^^^^^^^^^^^ help: it would look like the following: `a`
66
|
77
= note: `-D logic-bug` implied by `-D warnings`
88
help: this expression can be optimized out by applying boolean operations to the outer expression
@@ -15,27 +15,27 @@ error: this boolean expression can be simplified
1515
--> booleans.rs:14:13
1616
|
1717
14 | let _ = !true;
18-
| ^^^^^ help: try `false`
18+
| ^^^^^ help: try: `false`
1919
|
2020
= note: `-D nonminimal-bool` implied by `-D warnings`
2121

2222
error: this boolean expression can be simplified
2323
--> booleans.rs:15:13
2424
|
2525
15 | let _ = !false;
26-
| ^^^^^^ help: try `true`
26+
| ^^^^^^ help: try: `true`
2727

2828
error: this boolean expression can be simplified
2929
--> booleans.rs:16:13
3030
|
3131
16 | let _ = !!a;
32-
| ^^^ help: try `a`
32+
| ^^^ help: try: `a`
3333

3434
error: this boolean expression contains a logic bug
3535
--> booleans.rs:17:13
3636
|
3737
17 | let _ = false && a;
38-
| ^^^^^^^^^^ help: it would look like the following `false`
38+
| ^^^^^^^^^^ help: it would look like the following: `false`
3939
|
4040
help: this expression can be optimized out by applying boolean operations to the outer expression
4141
--> booleans.rs:17:22
@@ -47,19 +47,31 @@ error: this boolean expression can be simplified
4747
--> booleans.rs:18:13
4848
|
4949
18 | let _ = false || a;
50-
| ^^^^^^^^^^ help: try `a`
50+
| ^^^^^^^^^^ help: try: `a`
51+
52+
error: this boolean expression contains a logic bug
53+
--> booleans.rs:20:13
54+
|
55+
20 | let _ = cfg!(you_shall_not_not_pass) && a;
56+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: it would look like the following: `false`
57+
|
58+
help: this expression can be optimized out by applying boolean operations to the outer expression
59+
--> booleans.rs:20:45
60+
|
61+
20 | let _ = cfg!(you_shall_not_not_pass) && a;
62+
| ^
5163

5264
error: this boolean expression can be simplified
5365
--> booleans.rs:23:13
5466
|
5567
23 | let _ = !(!a && b);
56-
| ^^^^^^^^^^ help: try `!b || a`
68+
| ^^^^^^^^^^ help: try: `!b || a`
5769

5870
error: this boolean expression contains a logic bug
5971
--> booleans.rs:33:13
6072
|
6173
33 | let _ = a == b && a != b;
62-
| ^^^^^^^^^^^^^^^^ help: it would look like the following `false`
74+
| ^^^^^^^^^^^^^^^^ help: it would look like the following: `false`
6375
|
6476
help: this expression can be optimized out by applying boolean operations to the outer expression
6577
--> booleans.rs:33:13
@@ -97,7 +109,7 @@ error: this boolean expression contains a logic bug
97109
--> booleans.rs:36:13
98110
|
99111
36 | let _ = a < b && a >= b;
100-
| ^^^^^^^^^^^^^^^ help: it would look like the following `false`
112+
| ^^^^^^^^^^^^^^^ help: it would look like the following: `false`
101113
|
102114
help: this expression can be optimized out by applying boolean operations to the outer expression
103115
--> booleans.rs:36:13
@@ -109,7 +121,7 @@ error: this boolean expression contains a logic bug
109121
--> booleans.rs:37:13
110122
|
111123
37 | let _ = a > b && a <= b;
112-
| ^^^^^^^^^^^^^^^ help: it would look like the following `false`
124+
| ^^^^^^^^^^^^^^^ help: it would look like the following: `false`
113125
|
114126
help: this expression can be optimized out by applying boolean operations to the outer expression
115127
--> booleans.rs:37:13
@@ -130,7 +142,7 @@ help: try
130142
39 | let _ = !(a == b && c == d);
131143
| ^^^^^^^^^^^^^^^^^^^
132144

133-
error: aborting due to 13 previous errors
145+
error: aborting due to 14 previous errors
134146

135147

136148
To learn more, run the command again with --verbose.

clippy_tests/examples/borrow_box.stderr

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error: you seem to be trying to use `&Box<T>`. Consider using just `&T`
22
--> borrow_box.rs:9:19
33
|
44
9 | pub fn test1(foo: &mut Box<bool>) {
5-
| ^^^^^^^^^^^^^^ help: try `&mut bool`
5+
| ^^^^^^^^^^^^^^ help: try: `&mut bool`
66
|
77
note: lint level defined here
88
--> borrow_box.rs:4:9
@@ -14,19 +14,19 @@ error: you seem to be trying to use `&Box<T>`. Consider using just `&T`
1414
--> borrow_box.rs:14:14
1515
|
1616
14 | let foo: &Box<bool>;
17-
| ^^^^^^^^^^ help: try `&bool`
17+
| ^^^^^^^^^^ help: try: `&bool`
1818

1919
error: you seem to be trying to use `&Box<T>`. Consider using just `&T`
2020
--> borrow_box.rs:18:10
2121
|
2222
18 | foo: &'a Box<bool>
23-
| ^^^^^^^^^^^^^ help: try `&'a bool`
23+
| ^^^^^^^^^^^^^ help: try: `&'a bool`
2424

2525
error: you seem to be trying to use `&Box<T>`. Consider using just `&T`
2626
--> borrow_box.rs:22:17
2727
|
2828
22 | fn test4(a: &Box<bool>);
29-
| ^^^^^^^^^^ help: try `&bool`
29+
| ^^^^^^^^^^ help: try: `&bool`
3030

3131
error: aborting due to 4 previous errors
3232

0 commit comments

Comments
 (0)