Test that panic_fmt lint doesn't trigger for custom panic macro.

This commit is contained in:
Mara Bos 2020-10-24 21:13:04 +02:00
parent 190c3ad64e
commit 1993f1efe7
1 changed files with 7 additions and 0 deletions

View File

@ -15,4 +15,11 @@ fn main() {
panic!(S); // No warning (yet)
panic!(concat!("{", "}")); //~ WARN panic message contains an unused formatting placeholder
panic!(concat!("{", "{")); //~ WARN panic message contains braces
// Check that the lint only triggers for std::panic and core::panic,
// not any panic macro:
macro_rules! panic {
($e:expr) => ();
}
panic!("{}"); // OK
}