]> git.lizzy.rs Git - rust.git/blob - tests/ui/else_if_without_else.rs
Adapt the *.stderr files of the ui-tests to the tool_lints
[rust.git] / tests / ui / else_if_without_else.rs
1 #![feature(tool_lints)]
2
3 #![warn(clippy::all)]
4 #![warn(clippy::else_if_without_else)]
5
6 fn bla1() -> bool { unimplemented!() }
7 fn bla2() -> bool { unimplemented!() }
8 fn bla3() -> bool { unimplemented!() }
9
10 fn main() {
11     if bla1() {
12         println!("if");
13     }
14
15     if bla1() {
16         println!("if");
17     } else {
18         println!("else");
19     }
20
21     if bla1() {
22         println!("if");
23     } else if bla2() {
24         println!("else if");
25     } else {
26         println!("else")
27     }
28
29     if bla1() {
30         println!("if");
31     } else if bla2() {
32         println!("else if 1");
33     } else if bla3() {
34         println!("else if 2");
35     } else {
36         println!("else")
37     }
38
39     if bla1() {
40         println!("if");
41     } else if bla2() { //~ ERROR else if without else
42         println!("else if");
43     }
44
45     if bla1() {
46         println!("if");
47     } else if bla2() {
48         println!("else if 1");
49     } else if bla3() { //~ ERROR else if without else
50         println!("else if 2");
51     }
52 }