mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-30 16:39:26 +00:00
31 lines
559 B
Rust
31 lines
559 B
Rust
//@revisions: edition2018 edition2021
|
|
//@[edition2018] edition:2018
|
|
//@[edition2021] edition:2021
|
|
|
|
#![warn(clippy::uninlined_format_args)]
|
|
|
|
fn main() {
|
|
let var = 1;
|
|
|
|
println!("val='{}'", var);
|
|
|
|
if var > 0 {
|
|
panic!("p1 {}", var);
|
|
}
|
|
if var > 0 {
|
|
panic!("p2 {0}", var);
|
|
}
|
|
if var > 0 {
|
|
panic!("p3 {var}", var = var);
|
|
}
|
|
|
|
#[allow(non_fmt_panics)]
|
|
{
|
|
if var > 0 {
|
|
panic!("p4 {var}");
|
|
}
|
|
}
|
|
|
|
assert!(var == 1, "p5 {}", var);
|
|
debug_assert!(var == 1, "p6 {}", var);
|
|
}
|