Add ui tests for panic![123] and panic!{123}.
This commit is contained in:
parent
37c532c010
commit
8ad12bb9b2
@ -37,6 +37,9 @@ fn main() {
|
||||
|
||||
panic!(format!("{}", 1)); //~ WARN panic message is not a string literal
|
||||
|
||||
panic![123]; //~ WARN panic message is not a string literal
|
||||
panic!{123}; //~ WARN panic message is not a string literal
|
||||
|
||||
// Check that the lint only triggers for std::panic and core::panic,
|
||||
// not any panic macro:
|
||||
macro_rules! panic {
|
||||
|
@ -212,5 +212,37 @@ help: remove the `format!(..)` macro call
|
||||
LL | panic!("{}", 1);
|
||||
| -- --
|
||||
|
||||
warning: 16 warnings emitted
|
||||
warning: panic message is not a string literal
|
||||
--> $DIR/non-fmt-panic.rs:40:12
|
||||
|
|
||||
LL | panic![123];
|
||||
| ^^^
|
||||
|
|
||||
= note: this is no longer accepted in Rust 2021
|
||||
help: add a "{}" format string to Display the message
|
||||
|
|
||||
LL | panic!["{}", 123];
|
||||
| ^^^^^
|
||||
help: or use std::panic::panic_any instead
|
||||
|
|
||||
LL | std::panic::panic_any(123);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^ ^
|
||||
|
||||
warning: panic message is not a string literal
|
||||
--> $DIR/non-fmt-panic.rs:41:12
|
||||
|
|
||||
LL | panic!{123};
|
||||
| ^^^
|
||||
|
|
||||
= note: this is no longer accepted in Rust 2021
|
||||
help: add a "{}" format string to Display the message
|
||||
|
|
||||
LL | panic!{"{}", 123};
|
||||
| ^^^^^
|
||||
help: or use std::panic::panic_any instead
|
||||
|
|
||||
LL | std::panic::panic_any(123);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^ ^
|
||||
|
||||
warning: 18 warnings emitted
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user