rust-clippy/tests/compile-fail/panic.rs
mcarton 0774b203f4 Fix false-positive in panic_params
It might still have false positives, but it’s even less likely.
2016-03-12 21:23:57 +01:00

36 lines
685 B
Rust

#![feature(plugin)]
#![plugin(clippy)]
#[deny(panic_params)]
fn missing() {
if true {
panic!("{}"); //~ERROR: You probably are missing some parameter
} else {
panic!("{:?}"); //~ERROR: You probably are missing some parameter
}
}
fn ok_single() {
panic!("foo bar");
}
fn ok_multiple() {
panic!("{}", "This is {ok}");
}
fn ok_bracket() {
// the match is just here because of #759, it serves no other purpose for the lint
match 42 {
1337 => panic!("{so is this"),
666 => panic!("so is this}"),
_ => panic!("}so is that{"),
}
}
fn main() {
missing();
ok_single();
ok_multiple();
ok_bracket();
}