2015-12-23 21:37:52 +00:00
|
|
|
#![feature(plugin)]
|
|
|
|
#![plugin(clippy)]
|
|
|
|
|
2016-03-15 20:02:08 +00:00
|
|
|
#![deny(panic_params)]
|
2015-12-23 21:37:52 +00:00
|
|
|
|
|
|
|
fn missing() {
|
2016-03-12 20:23:01 +00:00
|
|
|
if true {
|
2017-02-08 13:58:07 +00:00
|
|
|
panic!("{}");
|
2016-03-15 20:02:08 +00:00
|
|
|
} else if false {
|
2017-02-08 13:58:07 +00:00
|
|
|
panic!("{:?}");
|
2016-03-12 20:23:01 +00:00
|
|
|
} else {
|
2017-02-08 13:58:07 +00:00
|
|
|
assert!(true, "here be missing values: {}");
|
2016-03-12 20:23:01 +00:00
|
|
|
}
|
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");
|
|
|
|
}
|
|
|
|
|
2016-03-15 20:02:08 +00:00
|
|
|
fn ok_inner() {
|
|
|
|
// Test for #768
|
|
|
|
assert!("foo bar".contains(&format!("foo {}", "bar")));
|
|
|
|
}
|
|
|
|
|
2015-12-23 21:37:52 +00:00
|
|
|
fn ok_multiple() {
|
|
|
|
panic!("{}", "This is {ok}");
|
|
|
|
}
|
|
|
|
|
2016-03-12 20:23:01 +00:00
|
|
|
fn ok_bracket() {
|
|
|
|
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();
|
2016-03-15 20:02:08 +00:00
|
|
|
ok_inner();
|
2015-12-23 21:37:52 +00:00
|
|
|
}
|