mirror of
https://github.com/rust-lang/rust.git
synced 2025-04-28 02:57:37 +00:00
Test for formating placeholders in panic_fmt lint test.
This commit is contained in:
parent
b8a8b681b8
commit
14dcf0a8ac
@ -4,6 +4,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 a brace
|
||||
assert!(false, "} } }..."); //~ 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
|
||||
}
|
||||
|
@ -23,28 +23,36 @@ help: add a "{}" format string to use the message literally
|
||||
LL | std::panic!("{}", "another one: }");
|
||||
| ^^^^^
|
||||
|
||||
warning: Panic message contains a brace
|
||||
--> $DIR/panic-brace.rs:7:5
|
||||
warning: Panic message contains an unused formatting placeholder
|
||||
--> $DIR/panic-brace.rs:7:18
|
||||
|
|
||||
LL | core::panic!("Hello { { {");
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
LL | core::panic!("Hello {}");
|
||||
| ^^^^^^^^^^
|
||||
|
|
||||
= note: This message is not used as a format string, but will be in a future Rust version
|
||||
help: add a "{}" format string to use the message literally
|
||||
= 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 { { {");
|
||||
LL | core::panic!("Hello {}", argument);
|
||||
| ^^^^^^^^^^
|
||||
help: or add a "{}" format string to use the message literally
|
||||
|
|
||||
LL | core::panic!("{}", "Hello {}");
|
||||
| ^^^^^
|
||||
|
||||
warning: Panic message contains a brace
|
||||
--> $DIR/panic-brace.rs:8:5
|
||||
warning: Panic message contains an unused formatting placeholder
|
||||
--> $DIR/panic-brace.rs:8:20
|
||||
|
|
||||
LL | assert!(false, "} } }...");
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
LL | assert!(false, "{:03x} bla");
|
||||
| ^^^^^^^^^^^^
|
||||
|
|
||||
= note: This message is not used as a format string, but will be in a future Rust version
|
||||
help: add a "{}" format string to use the message literally
|
||||
= 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, "{}", "} } }...");
|
||||
LL | assert!(false, "{:03x} bla", argument);
|
||||
| ^^^^^^^^^^
|
||||
help: or add a "{}" format string to use the message literally
|
||||
|
|
||||
LL | assert!(false, "{}", "{:03x} bla");
|
||||
| ^^^^^
|
||||
|
||||
warning: 4 warnings emitted
|
||||
|
Loading…
Reference in New Issue
Block a user