diff options
| author | Pietro Albini <pietro@pietroalbini.org> | 2018-08-01 10:13:02 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-08-01 10:13:02 +0200 |
| commit | a8ed6033a6b89d838264a18dddf80cb3fc831e0d (patch) | |
| tree | c4ed22b9b4c01412a81fed671ad4fc6accc43904 /src/test | |
| parent | 312f18c2ea889961378ee2362c69c10471333804 (diff) | |
| parent | 75ff0ddb4349eca292016a29402980205c181d3f (diff) | |
Rollup merge of #52888 - estebank:shell-sugg, r=oli-obk
Use suggestions for shell format arguments Follow up to #52649.
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/ui/macros/format-foreign.rs | 2 | ||||
| -rw-r--r-- | src/test/ui/macros/format-foreign.stderr | 21 | ||||
| -rw-r--r-- | src/test/ui/macros/format-unused-lables.stderr | 6 |
3 files changed, 24 insertions, 5 deletions
diff --git a/src/test/ui/macros/format-foreign.rs b/src/test/ui/macros/format-foreign.rs index 33401424c9a..ac00ce3af96 100644 --- a/src/test/ui/macros/format-foreign.rs +++ b/src/test/ui/macros/format-foreign.rs @@ -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 } diff --git a/src/test/ui/macros/format-foreign.stderr b/src/test/ui/macros/format-foreign.stderr index 5e76c0a322e..d5e2b514c40 100644 --- a/src/test/ui/macros/format-foreign.stderr +++ b/src/test/ui/macros/format-foreign.stderr @@ -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 diff --git a/src/test/ui/macros/format-unused-lables.stderr b/src/test/ui/macros/format-unused-lables.stderr index 81171a1ed01..67ffeec67cc 100644 --- a/src/test/ui/macros/format-unused-lables.stderr +++ b/src/test/ui/macros/format-unused-lables.stderr @@ -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 |
