Skip to content

Commit f416779

Browse files
committed
Update int_plus_one suggestion text
This is now in line with the recommendations from here: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_errors/struct.Diagnostic.html#method.span_suggestion
1 parent 31cf2f2 commit f416779

File tree

2 files changed

+5
-21
lines changed

2 files changed

+5
-21
lines changed

clippy_lints/src/int_plus_one.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ impl IntPlusOne {
158158
|db| {
159159
db.span_suggestion(
160160
block.span,
161-
"change `>= y + 1` to `> y` as shown",
161+
"change it to",
162162
recommendation,
163163
Applicability::MachineApplicable, // snippet
164164
);

tests/ui/int_plus_one.stderr

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,43 +2,27 @@ error: Unnecessary `>= y + 1` or `x - 1 >=`
22
--> $DIR/int_plus_one.rs:9:13
33
|
44
LL | let _ = x >= y + 1;
5-
| ^^^^^^^^^^
5+
| ^^^^^^^^^^ help: change it to: `x > y`
66
|
77
= note: `-D clippy::int-plus-one` implied by `-D warnings`
8-
help: change `>= y + 1` to `> y` as shown
9-
|
10-
LL | let _ = x > y;
11-
| ^^^^^
128

139
error: Unnecessary `>= y + 1` or `x - 1 >=`
1410
--> $DIR/int_plus_one.rs:10:13
1511
|
1612
LL | let _ = y + 1 <= x;
17-
| ^^^^^^^^^^
18-
help: change `>= y + 1` to `> y` as shown
19-
|
20-
LL | let _ = y < x;
21-
| ^^^^^
13+
| ^^^^^^^^^^ help: change it to: `y < x`
2214

2315
error: Unnecessary `>= y + 1` or `x - 1 >=`
2416
--> $DIR/int_plus_one.rs:12:13
2517
|
2618
LL | let _ = x - 1 >= y;
27-
| ^^^^^^^^^^
28-
help: change `>= y + 1` to `> y` as shown
29-
|
30-
LL | let _ = x > y;
31-
| ^^^^^
19+
| ^^^^^^^^^^ help: change it to: `x > y`
3220

3321
error: Unnecessary `>= y + 1` or `x - 1 >=`
3422
--> $DIR/int_plus_one.rs:13:13
3523
|
3624
LL | let _ = y <= x - 1;
37-
| ^^^^^^^^^^
38-
help: change `>= y + 1` to `> y` as shown
39-
|
40-
LL | let _ = y < x;
41-
| ^^^^^
25+
| ^^^^^^^^^^ help: change it to: `y < x`
4226

4327
error: aborting due to 4 previous errors
4428

0 commit comments

Comments
 (0)