Use suggestions for shell format arguments

This commit is contained in:
Esteban Küber 2018-07-30 16:33:53 -07:00
parent 70cac59031
commit 75ff0ddb43
4 changed files with 70 additions and 39 deletions

View file

@ -22,4 +22,6 @@ fn main() {
println!("{} %f", "one", 2.0); //~ ERROR never used
println!("Hi there, $NAME.", NAME="Tim"); //~ ERROR never used
println!("$1 $0 $$ $NAME", 1, 2, NAME=3);
//~^ ERROR multiple unused formatting arguments
}

View file

@ -52,10 +52,25 @@ error: named argument never used
--> $DIR/format-foreign.rs:24:39
|
LL | println!("Hi there, $NAME.", NAME="Tim"); //~ ERROR never used
| ^^^^^
| ----- ^^^^^
| |
| help: format specifiers use curly braces: `{NAME}`
|
= help: `$NAME` should be written as `{NAME}`
= note: shell formatting not supported; see the documentation for `std::fmt`
error: aborting due to 5 previous errors
error: multiple unused formatting arguments
--> $DIR/format-foreign.rs:25:32
|
LL | println!("$1 $0 $$ $NAME", 1, 2, NAME=3);
| ---------------- ^ ^ ^
| |
| multiple missing formatting specifiers
|
= note: shell formatting not supported; see the documentation for `std::fmt`
help: format specifiers use curly braces
|
LL | println!("{1} {0} $$ {NAME}", 1, 2, NAME=3);
| ^^^ ^^^ ^^^^^^
error: aborting due to 6 previous errors

View file

@ -30,7 +30,10 @@ error: multiple unused formatting arguments
--> $DIR/format-unused-lables.rs:24:9
|
LL | println!("Some more $STUFF",
| ------------------ multiple missing formatting specifiers
| ------------------
| | |
| | help: format specifiers use curly braces: `{STUFF}`
| multiple missing formatting specifiers
LL | "woo!", //~ ERROR multiple unused formatting arguments
| ^^^^^^
LL | STUFF=
@ -39,7 +42,6 @@ LL | "things"
LL | , UNUSED="args");
| ^^^^^^
|
= help: `$STUFF` should be written as `{STUFF}`
= note: shell formatting not supported; see the documentation for `std::fmt`
error: aborting due to 4 previous errors