Also apply panic_fmt lint suggestions to debug_assert!().

This commit is contained in:
Mara Bos 2020-10-19 00:45:07 +02:00
parent 0a9330c7ef
commit d3b41497fe
5 changed files with 23 additions and 10 deletions

View file

@ -6,4 +6,5 @@ fn main() {
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
debug_assert!(false, "{{}} bla"); //~ WARN Panic message contains a brace
}

View file

@ -55,5 +55,17 @@ help: or add a "{}" format string to use the message literally
LL | assert!(false, "{}", "{:03x} bla");
| ^^^^^
warning: 4 warnings emitted
warning: Panic message contains a brace
--> $DIR/panic-brace.rs:9:5
|
LL | debug_assert!(false, "{{}} 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
|
LL | debug_assert!(false, "{}", "{{}} bla");
| ^^^^^
warning: 5 warnings emitted