Static rustc_lint::non_fmt_panic::NON_FMT_PANICS
source · static NON_FMT_PANICS: &Lint
Expand description
The non_fmt_panics
lint detects panic!(..)
invocations where the first
argument is not a formatting string.
§Example
ⓘ
panic!("{}");
panic!(123);
{{produces}}
§Explanation
In Rust 2018 and earlier, panic!(x)
directly uses x
as the message.
That means that panic!("{}")
panics with the message "{}"
instead
of using it as a formatting string, and panic!(123)
will panic with
an i32
as message.
Rust 2021 always interprets the first argument as format string.