Skip to content

Commit 23d7346

Browse files
committed
Make span_suggestions always verbose
`span_suggestions` is to provide mutually exclusive suggestions. When it was introduced, we made its behavior be that if a single suggestion is given to it, we present the suggestion inline, otherwise in patch format. Changing this to make all of its uses be verbose, as that is closer in intent of output.
1 parent f4b9b8d commit 23d7346

4 files changed

Lines changed: 95 additions & 14 deletions

File tree

tests/ui/blocks_in_conditions.stderr

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,15 @@ error: this boolean expression can be simplified
2929
--> tests/ui/blocks_in_conditions.rs:48:8
3030
|
3131
LL | if true && x == 3 { 6 } else { 10 }
32-
| ^^^^^^^^^^^^^^ help: try: `x == 3`
32+
| ^^^^^^^^^^^^^^
3333
|
3434
= note: `-D clippy::nonminimal-bool` implied by `-D warnings`
3535
= help: to override `-D warnings` add `#[allow(clippy::nonminimal_bool)]`
36+
help: try
37+
|
38+
LL - if true && x == 3 { 6 } else { 10 }
39+
LL + if x == 3 { 6 } else { 10 }
40+
|
3641

3742
error: aborting due to 3 previous errors
3843

tests/ui/crashes/ice-96721.stderr

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,14 @@ error: malformed `path` attribute input
22
--> tests/ui/crashes/ice-96721.rs:7:1
33
|
44
LL | #[path = foo!()]
5-
| ^^^^^^^^^^^^^^^^ help: must be of the form: `#[path = "file"]`
5+
| ^^^^^^^^^^^^^^^^
66
|
77
= note: for more information, visit <https://doc.rust-lang.org/reference/items/modules.html#the-path-attribute>
8+
help: must be of the form
9+
|
10+
LL - #[path = foo!()]
11+
LL + #[path = "file"]
12+
|
813

914
error: aborting due to 1 previous error
1015

tests/ui/nonminimal_bool.stderr

Lines changed: 69 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,46 +2,87 @@ error: this boolean expression can be simplified
22
--> tests/ui/nonminimal_bool.rs:17:13
33
|
44
LL | let _ = !true;
5-
| ^^^^^ help: try: `false`
5+
| ^^^^^
66
|
77
= note: `-D clippy::nonminimal-bool` implied by `-D warnings`
88
= help: to override `-D warnings` add `#[allow(clippy::nonminimal_bool)]`
9+
help: try
10+
|
11+
LL - let _ = !true;
12+
LL + let _ = false;
13+
|
914

1015
error: this boolean expression can be simplified
1116
--> tests/ui/nonminimal_bool.rs:20:13
1217
|
1318
LL | let _ = !false;
14-
| ^^^^^^ help: try: `true`
19+
| ^^^^^^
20+
|
21+
help: try
22+
|
23+
LL - let _ = !false;
24+
LL + let _ = true;
25+
|
1526

1627
error: this boolean expression can be simplified
1728
--> tests/ui/nonminimal_bool.rs:23:13
1829
|
1930
LL | let _ = !!a;
20-
| ^^^ help: try: `a`
31+
| ^^^
32+
|
33+
help: try
34+
|
35+
LL - let _ = !!a;
36+
LL + let _ = a;
37+
|
2138

2239
error: this boolean expression can be simplified
2340
--> tests/ui/nonminimal_bool.rs:26:13
2441
|
2542
LL | let _ = false || a;
26-
| ^^^^^^^^^^ help: try: `a`
43+
| ^^^^^^^^^^
44+
|
45+
help: try
46+
|
47+
LL - let _ = false || a;
48+
LL + let _ = a;
49+
|
2750

2851
error: this boolean expression can be simplified
2952
--> tests/ui/nonminimal_bool.rs:32:13
3053
|
3154
LL | let _ = !(!a && b);
32-
| ^^^^^^^^^^ help: try: `a || !b`
55+
| ^^^^^^^^^^
56+
|
57+
help: try
58+
|
59+
LL - let _ = !(!a && b);
60+
LL + let _ = a || !b;
61+
|
3362

3463
error: this boolean expression can be simplified
3564
--> tests/ui/nonminimal_bool.rs:35:13
3665
|
3766
LL | let _ = !(!a || b);
38-
| ^^^^^^^^^^ help: try: `a && !b`
67+
| ^^^^^^^^^^
68+
|
69+
help: try
70+
|
71+
LL - let _ = !(!a || b);
72+
LL + let _ = a && !b;
73+
|
3974

4075
error: this boolean expression can be simplified
4176
--> tests/ui/nonminimal_bool.rs:38:13
4277
|
4378
LL | let _ = !a && !(b && c);
44-
| ^^^^^^^^^^^^^^^ help: try: `!(a || b && c)`
79+
| ^^^^^^^^^^^^^^^
80+
|
81+
help: try
82+
|
83+
LL - let _ = !a && !(b && c);
84+
LL + let _ = !(a || b && c);
85+
|
4586

4687
error: this boolean expression can be simplified
4788
--> tests/ui/nonminimal_bool.rs:47:13
@@ -122,7 +163,13 @@ error: this boolean expression can be simplified
122163
--> tests/ui/nonminimal_bool.rs:90:8
123164
|
124165
LL | if matches!(true, true) && true {
125-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `matches!(true, true)`
166+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
167+
|
168+
help: try
169+
|
170+
LL - if matches!(true, true) && true {
171+
LL + if matches!(true, true) {
172+
|
126173

127174
error: this boolean expression can be simplified
128175
--> tests/ui/nonminimal_bool.rs:171:8
@@ -215,13 +262,25 @@ error: this boolean expression can be simplified
215262
--> tests/ui/nonminimal_bool.rs:212:8
216263
|
217264
LL | if !(a < 2.0 && !b) {
218-
| ^^^^^^^^^^^^^^^^ help: try: `a >= 2.0 || b`
265+
| ^^^^^^^^^^^^^^^^
266+
|
267+
help: try
268+
|
269+
LL - if !(a < 2.0 && !b) {
270+
LL + if a >= 2.0 || b {
271+
|
219272

220273
error: this boolean expression can be simplified
221274
--> tests/ui/nonminimal_bool.rs:231:12
222275
|
223276
LL | if !(matches!(ty, TyKind::Ref(_, _, _)) && !is_mutable(&expr)) {
224-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `!matches!(ty, TyKind::Ref(_, _, _)) || is_mutable(&expr)`
277+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
278+
|
279+
help: try
280+
|
281+
LL - if !(matches!(ty, TyKind::Ref(_, _, _)) && !is_mutable(&expr)) {
282+
LL + if !matches!(ty, TyKind::Ref(_, _, _)) || is_mutable(&expr) {
283+
|
225284

226285
error: this boolean expression can be simplified
227286
--> tests/ui/nonminimal_bool.rs:251:8

tests/ui/nonminimal_bool_methods.stderr

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,25 @@ error: this boolean expression can be simplified
2929
--> tests/ui/nonminimal_bool_methods.rs:20:13
3030
|
3131
LL | let _ = !(a.is_some() && !c);
32-
| ^^^^^^^^^^^^^^^^^^^^ help: try: `a.is_none() || c`
32+
| ^^^^^^^^^^^^^^^^^^^^
33+
|
34+
help: try
35+
|
36+
LL - let _ = !(a.is_some() && !c);
37+
LL + let _ = a.is_none() || c;
38+
|
3339

3440
error: this boolean expression can be simplified
3541
--> tests/ui/nonminimal_bool_methods.rs:22:13
3642
|
3743
LL | let _ = !(a.is_some() || !c);
38-
| ^^^^^^^^^^^^^^^^^^^^ help: try: `a.is_none() && c`
44+
| ^^^^^^^^^^^^^^^^^^^^
45+
|
46+
help: try
47+
|
48+
LL - let _ = !(a.is_some() || !c);
49+
LL + let _ = a.is_none() && c;
50+
|
3951

4052
error: this boolean expression can be simplified
4153
--> tests/ui/nonminimal_bool_methods.rs:24:26

0 commit comments

Comments
 (0)