2015-12-23 15:37:52 -06:00
|
|
|
#![feature(plugin)]
|
|
|
|
#![plugin(clippy)]
|
|
|
|
|
2016-03-15 15:02:08 -05:00
|
|
|
#![deny(panic_params)]
|
2015-12-23 15:37:52 -06:00
|
|
|
|
|
|
|
fn missing() {
|
2016-03-12 14:23:01 -06:00
|
|
|
if true {
|
2016-03-15 15:02:08 -05:00
|
|
|
panic!("{}"); //~ERROR: you probably are missing some parameter
|
|
|
|
} else if false {
|
|
|
|
panic!("{:?}"); //~ERROR: you probably are missing some parameter
|
2016-03-12 14:23:01 -06:00
|
|
|
} else {
|
2016-03-15 15:02:08 -05:00
|
|
|
assert!(true, "here be missing values: {}"); //~ERROR you probably are missing some parameter
|
2016-03-12 14:23:01 -06:00
|
|
|
}
|
2015-12-23 15:37:52 -06:00
|
|
|
}
|
|
|
|
|
2016-03-12 14:23:01 -06:00
|
|
|
fn ok_single() {
|
2015-12-23 15:37:52 -06:00
|
|
|
panic!("foo bar");
|
|
|
|
}
|
|
|
|
|
2016-03-15 15:02:08 -05:00
|
|
|
fn ok_inner() {
|
|
|
|
// Test for #768
|
|
|
|
assert!("foo bar".contains(&format!("foo {}", "bar")));
|
|
|
|
}
|
|
|
|
|
2015-12-23 15:37:52 -06:00
|
|
|
fn ok_multiple() {
|
|
|
|
panic!("{}", "This is {ok}");
|
|
|
|
}
|
|
|
|
|
2016-03-12 14:23:01 -06:00
|
|
|
fn ok_bracket() {
|
|
|
|
match 42 {
|
|
|
|
1337 => panic!("{so is this"),
|
|
|
|
666 => panic!("so is this}"),
|
|
|
|
_ => panic!("}so is that{"),
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-12-23 15:37:52 -06:00
|
|
|
fn main() {
|
|
|
|
missing();
|
2016-03-12 14:23:01 -06:00
|
|
|
ok_single();
|
2015-12-23 15:37:52 -06:00
|
|
|
ok_multiple();
|
2016-03-12 14:23:01 -06:00
|
|
|
ok_bracket();
|
2016-03-15 15:02:08 -05:00
|
|
|
ok_inner();
|
2015-12-23 15:37:52 -06:00
|
|
|
}
|