2015-12-23 21:37:52 +00:00
|
|
|
#![feature(plugin)]
|
|
|
|
#![plugin(clippy)]
|
|
|
|
|
|
|
|
#[deny(panic_params)]
|
|
|
|
|
|
|
|
fn missing() {
|
2016-03-12 20:23:01 +00:00
|
|
|
if true {
|
|
|
|
panic!("{}"); //~ERROR: You probably are missing some parameter
|
|
|
|
} else {
|
|
|
|
panic!("{:?}"); //~ERROR: You probably are missing some parameter
|
|
|
|
}
|
2015-12-23 21:37:52 +00:00
|
|
|
}
|
|
|
|
|
2016-03-12 20:23:01 +00:00
|
|
|
fn ok_single() {
|
2015-12-23 21:37:52 +00:00
|
|
|
panic!("foo bar");
|
|
|
|
}
|
|
|
|
|
|
|
|
fn ok_multiple() {
|
|
|
|
panic!("{}", "This is {ok}");
|
|
|
|
}
|
|
|
|
|
2016-03-12 20:23:01 +00:00
|
|
|
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{"),
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-12-23 21:37:52 +00:00
|
|
|
fn main() {
|
|
|
|
missing();
|
2016-03-12 20:23:01 +00:00
|
|
|
ok_single();
|
2015-12-23 21:37:52 +00:00
|
|
|
ok_multiple();
|
2016-03-12 20:23:01 +00:00
|
|
|
ok_bracket();
|
2015-12-23 21:37:52 +00:00
|
|
|
}
|