]> git.lizzy.rs Git - rust.git/blob - src/tools/clippy/tests/ui/match_bool.rs
Auto merge of #84620 - Dylan-DPC:rollup-wkv97im, r=Dylan-DPC
[rust.git] / src / tools / clippy / tests / ui / match_bool.rs
1 #![deny(clippy::match_bool)]
2
3 fn match_bool() {
4     let test: bool = true;
5
6     match test {
7         true => 0,
8         false => 42,
9     };
10
11     let option = 1;
12     match option == 1 {
13         true => 1,
14         false => 0,
15     };
16
17     match test {
18         true => (),
19         false => {
20             println!("Noooo!");
21         },
22     };
23
24     match test {
25         false => {
26             println!("Noooo!");
27         },
28         _ => (),
29     };
30
31     match test && test {
32         false => {
33             println!("Noooo!");
34         },
35         _ => (),
36     };
37
38     match test {
39         false => {
40             println!("Noooo!");
41         },
42         true => {
43             println!("Yes!");
44         },
45     };
46
47     // Not linted
48     match option {
49         1..=10 => 1,
50         11..=20 => 2,
51         _ => 3,
52     };
53 }
54
55 fn main() {}