Add suggestion test

This commit is contained in:
francorbacho 2023-10-05 14:59:15 +02:00
parent 905bace904
commit 38b0182832
3 changed files with 33 additions and 10 deletions

View File

@ -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
}

View File

@ -1,3 +1,5 @@
// run-rustfix
fn main() {
let x = 0;
let y = 0;

View File

@ -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);
| ^ ^
@ -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);
| ^