mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-14 17:48:10 +00:00
30 lines
489 B
Rust
30 lines
489 B
Rust
// revisions: edition2018 edition2021
|
|
//[edition2018] edition:2018
|
|
//[edition2021] edition:2021
|
|
// run-rustfix
|
|
|
|
#![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}");
|
|
}
|
|
}
|
|
}
|