mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-24 05:33:27 +00:00
0774b203f4
It might still have false positives, but it’s even less likely.
36 lines
685 B
Rust
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();
|
|
}
|