]> git.lizzy.rs Git - rust.git/blob - tests/ui/panic_unimplemented.rs
Adapt the *.stderr files of the ui-tests to the tool_lints
[rust.git] / tests / ui / panic_unimplemented.rs
1 #![feature(tool_lints)]
2
3
4 #![warn(clippy::panic_params, clippy::unimplemented)]
5
6 fn missing() {
7     if true {
8         panic!("{}");
9     } else if false {
10         panic!("{:?}");
11     } else {
12         assert!(true, "here be missing values: {}");
13     }
14
15     panic!("{{{this}}}");
16 }
17
18 fn ok_single() {
19     panic!("foo bar");
20 }
21
22 fn ok_inner() {
23     // Test for #768
24     assert!("foo bar".contains(&format!("foo {}", "bar")));
25 }
26
27 fn ok_multiple() {
28     panic!("{}", "This is {ok}");
29 }
30
31 fn ok_bracket() {
32     match 42 {
33         1337 => panic!("{so is this"),
34         666 => panic!("so is this}"),
35         _ => panic!("}so is that{"),
36     }
37 }
38
39 const ONE : u32= 1;
40
41 fn ok_nomsg() {
42     assert!({ 1 == ONE });
43     assert!(if 1 == ONE { ONE == 1 } else { false });
44 }
45
46 fn ok_escaped() {
47     panic!("{{ why should this not be ok? }}");
48     panic!(" or {{ that ?");
49     panic!(" or }} this ?");
50     panic!(" {or {{ that ?");
51     panic!(" }or }} this ?");
52     panic!("{{ test }");
53     panic!("{case }}");
54 }
55
56 fn unimplemented() {
57     let a = 2;
58     unimplemented!();
59     let b = a + 2;
60 }
61
62 fn main() {
63     missing();
64     ok_single();
65     ok_multiple();
66     ok_bracket();
67     ok_inner();
68     ok_nomsg();
69     ok_escaped();
70     unimplemented();
71 }