diff options
| author | Mara Bos <m-ou.se@m-ou.se> | 2020-10-20 22:25:42 +0200 |
|---|---|---|
| committer | Mara Bos <m-ou.se@m-ou.se> | 2020-10-20 22:25:42 +0200 |
| commit | 6b44662669cf1680fe097e593eae20ca5dbed2ee (patch) | |
| tree | 7adf9caad63fe6c221ee6e97ff9adf9b3ce3a929 /src | |
| parent | 0f193d1a62c128ae94e1f21d7c1212d7c9e95b7d (diff) | |
| download | rust-6b44662669cf1680fe097e593eae20ca5dbed2ee.tar.gz rust-6b44662669cf1680fe097e593eae20ca5dbed2ee.zip | |
Parse the format string for the panic_fmt lint for better warnings.
Diffstat (limited to 'src')
| -rw-r--r-- | src/test/ui/panic-brace.rs | 2 | ||||
| -rw-r--r-- | src/test/ui/panic-brace.stderr | 22 |
2 files changed, 12 insertions, 12 deletions
diff --git a/src/test/ui/panic-brace.rs b/src/test/ui/panic-brace.rs index 6ab5fafee88..e74b6ad96c2 100644 --- a/src/test/ui/panic-brace.rs +++ b/src/test/ui/panic-brace.rs @@ -5,6 +5,6 @@ fn main() { panic!("here's a brace: {"); //~ WARN panic message contains a brace std::panic!("another one: }"); //~ WARN panic message contains a brace core::panic!("Hello {}"); //~ WARN panic message contains an unused formatting placeholder - assert!(false, "{:03x} bla"); //~ WARN panic message contains an unused formatting placeholder + assert!(false, "{:03x} {test} bla"); //~ WARN panic message contains unused formatting placeholders debug_assert!(false, "{{}} bla"); //~ WARN panic message contains a brace } diff --git a/src/test/ui/panic-brace.stderr b/src/test/ui/panic-brace.stderr index 00b005a59d8..23ae31d00eb 100644 --- a/src/test/ui/panic-brace.stderr +++ b/src/test/ui/panic-brace.stderr @@ -24,35 +24,35 @@ LL | std::panic!("{}", "another one: }"); | ^^^^^ warning: panic message contains an unused formatting placeholder - --> $DIR/panic-brace.rs:7:18 + --> $DIR/panic-brace.rs:7:25 | LL | core::panic!("Hello {}"); - | ^^^^^^^^^^ + | ^^ | = note: this message is not used as a format string when given without arguments, but will be in a future Rust version help: add the missing argument(s) | -LL | core::panic!("Hello {}", argument); - | ^^^^^^^^^^ +LL | core::panic!("Hello {}", ...); + | ^^^^^ help: or add a "{}" format string to use the message literally | LL | core::panic!("{}", "Hello {}"); | ^^^^^ -warning: panic message contains an unused formatting placeholder - --> $DIR/panic-brace.rs:8:20 +warning: panic message contains unused formatting placeholders + --> $DIR/panic-brace.rs:8:21 | -LL | assert!(false, "{:03x} bla"); - | ^^^^^^^^^^^^ +LL | assert!(false, "{:03x} {test} bla"); + | ^^^^^^ ^^^^^^ | = note: this message is not used as a format string when given without arguments, but will be in a future Rust version help: add the missing argument(s) | -LL | assert!(false, "{:03x} bla", argument); - | ^^^^^^^^^^ +LL | assert!(false, "{:03x} {test} bla", ...); + | ^^^^^ help: or add a "{}" format string to use the message literally | -LL | assert!(false, "{}", "{:03x} bla"); +LL | assert!(false, "{}", "{:03x} {test} bla"); | ^^^^^ warning: panic message contains a brace |
