Skip to content

Commit 27f29d5

Browse files
committed
Add suggestion test
1 parent 2684fa3 commit 27f29d5

File tree

3 files changed

+33
-10
lines changed

3 files changed

+33
-10
lines changed
+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// run-rustfix
2+
3+
fn main() {
4+
let x = 0;
5+
let y = 0;
6+
7+
println!("{x}", );
8+
//~^ ERROR: redundant argument
9+
10+
println!("{x} {}", x, );
11+
//~^ ERROR: redundant argument
12+
13+
println!("{} {x}", x, );
14+
//~^ ERROR: redundant argument
15+
16+
println!("{x} {y}", );
17+
//~^ ERROR: redundant arguments
18+
19+
println!("{} {} {x} {y} {}", x, x, x, );
20+
//~^ ERROR: redundant arguments
21+
}

tests/ui/did_you_mean/issue-105225.rs

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// run-rustfix
2+
13
fn main() {
24
let x = 0;
35
let y = 0;

tests/ui/did_you_mean/issue-105225.stderr

+10-10
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,47 @@
11
error: redundant argument
2-
--> $DIR/issue-105225.rs:5:21
2+
--> $DIR/issue-105225.rs:7:21
33
|
44
LL | println!("{x}", x);
55
| ^ help: this can be removed
66
|
77
note: the formatting specifier is referencing the binding already
8-
--> $DIR/issue-105225.rs:5:16
8+
--> $DIR/issue-105225.rs:7:16
99
|
1010
LL | println!("{x}", x);
1111
| ^
1212

1313
error: redundant argument
14-
--> $DIR/issue-105225.rs:8:27
14+
--> $DIR/issue-105225.rs:10:27
1515
|
1616
LL | println!("{x} {}", x, x);
1717
| ^ help: this can be removed
1818
|
1919
note: the formatting specifier is referencing the binding already
20-
--> $DIR/issue-105225.rs:8:16
20+
--> $DIR/issue-105225.rs:10:16
2121
|
2222
LL | println!("{x} {}", x, x);
2323
| ^
2424

2525
error: redundant argument
26-
--> $DIR/issue-105225.rs:11:27
26+
--> $DIR/issue-105225.rs:13:27
2727
|
2828
LL | println!("{} {x}", x, x);
2929
| ^ help: this can be removed
3030
|
3131
note: the formatting specifier is referencing the binding already
32-
--> $DIR/issue-105225.rs:11:19
32+
--> $DIR/issue-105225.rs:13:19
3333
|
3434
LL | println!("{} {x}", x, x);
3535
| ^
3636

3737
error: redundant arguments
38-
--> $DIR/issue-105225.rs:14:25
38+
--> $DIR/issue-105225.rs:16:25
3939
|
4040
LL | println!("{x} {y}", x, y);
4141
| ^ ^
4242
|
4343
note: the formatting specifiers are referencing the bindings already
44-
--> $DIR/issue-105225.rs:14:16
44+
--> $DIR/issue-105225.rs:16:16
4545
|
4646
LL | println!("{x} {y}", x, y);
4747
| ^ ^
@@ -52,13 +52,13 @@ LL + println!("{x} {y}", );
5252
|
5353

5454
error: redundant arguments
55-
--> $DIR/issue-105225.rs:17:43
55+
--> $DIR/issue-105225.rs:19:43
5656
|
5757
LL | println!("{} {} {x} {y} {}", x, x, x, y, y);
5858
| ^ ^
5959
|
6060
note: the formatting specifiers are referencing the bindings already
61-
--> $DIR/issue-105225.rs:17:26
61+
--> $DIR/issue-105225.rs:19:26
6262
|
6363
LL | println!("{} {} {x} {y} {}", x, x, x, y, y);
6464
| ^

0 commit comments

Comments
 (0)