Skip to content

Commit

Permalink
Add suggestion test
Browse files Browse the repository at this point in the history
  • Loading branch information
francorbacho committed Oct 5, 2023
1 parent 905bace commit 38b0182
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 10 deletions.
21 changes: 21 additions & 0 deletions tests/ui/did_you_mean/issue-105225.fixed
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// run-rustfix

fn main() {
let x = 0;
let y = 0;

println!("{x}", );
//~^ ERROR: redundant argument

println!("{x} {}", x, );
//~^ ERROR: redundant argument

println!("{} {x}", x, );
//~^ ERROR: redundant argument

println!("{x} {y}", );
//~^ ERROR: redundant arguments

println!("{} {} {x} {y} {}", x, x, x, );
//~^ ERROR: redundant arguments
}
2 changes: 2 additions & 0 deletions tests/ui/did_you_mean/issue-105225.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// run-rustfix

fn main() {
let x = 0;
let y = 0;
Expand Down
20 changes: 10 additions & 10 deletions tests/ui/did_you_mean/issue-105225.stderr
Original file line number Diff line number Diff line change
@@ -1,47 +1,47 @@
error: redundant argument
--> $DIR/issue-105225.rs:5:21
--> $DIR/issue-105225.rs:7:21
|
LL | println!("{x}", x);
| ^ help: this can be removed
|
note: the formatting specifier is referencing the binding already
--> $DIR/issue-105225.rs:5:16
--> $DIR/issue-105225.rs:7:16
|
LL | println!("{x}", x);
| ^

error: redundant argument
--> $DIR/issue-105225.rs:8:27
--> $DIR/issue-105225.rs:10:27
|
LL | println!("{x} {}", x, x);
| ^ help: this can be removed
|
note: the formatting specifier is referencing the binding already
--> $DIR/issue-105225.rs:8:16
--> $DIR/issue-105225.rs:10:16
|
LL | println!("{x} {}", x, x);
| ^

error: redundant argument
--> $DIR/issue-105225.rs:11:27
--> $DIR/issue-105225.rs:13:27
|
LL | println!("{} {x}", x, x);
| ^ help: this can be removed
|
note: the formatting specifier is referencing the binding already
--> $DIR/issue-105225.rs:11:19
--> $DIR/issue-105225.rs:13:19
|
LL | println!("{} {x}", x, x);
| ^

error: redundant arguments
--> $DIR/issue-105225.rs:14:25
--> $DIR/issue-105225.rs:16:25
|
LL | println!("{x} {y}", x, y);
| ^ ^
|
note: the formatting specifiers are referencing the bindings already
--> $DIR/issue-105225.rs:14:16
--> $DIR/issue-105225.rs:16:16
|
LL | println!("{x} {y}", x, y);
| ^ ^
Expand All @@ -52,13 +52,13 @@ LL + println!("{x} {y}", );
|

error: redundant arguments
--> $DIR/issue-105225.rs:17:43
--> $DIR/issue-105225.rs:19:43
|
LL | println!("{} {} {x} {y} {}", x, x, x, y, y);
| ^ ^
|
note: the formatting specifiers are referencing the bindings already
--> $DIR/issue-105225.rs:17:26
--> $DIR/issue-105225.rs:19:26
|
LL | println!("{} {} {x} {y} {}", x, x, x, y, y);
| ^
Expand Down

0 comments on commit 38b0182

Please sign in to comment.