]> git.lizzy.rs Git - rust.git/blob - tests/ui/match_bool.rs
Merge pull request #2984 from flip1995/single_char_pattern
[rust.git] / tests / ui / match_bool.rs
1 fn match_bool() {
2     let test: bool = true;
3
4     match test {
5         true => 0,
6         false => 42,
7     };
8
9     let option = 1;
10     match option == 1 {
11         true => 1,
12         false => 0,
13     };
14
15     match test {
16         true => (),
17         false => { println!("Noooo!"); }
18     };
19
20     match test {
21         false => { println!("Noooo!"); }
22         _ => (),
23     };
24
25     match test && test {
26         false => { println!("Noooo!"); }
27         _ => (),
28     };
29
30     match test {
31         false => { println!("Noooo!"); }
32         true => { println!("Yes!"); }
33     };
34
35     // Not linted
36     match option {
37         1 ... 10 => 1,
38         11 ... 20 => 2,
39         _ => 3,
40     };
41 }
42
43 fn main() {
44 }