]> git.lizzy.rs Git - rust.git/blob - tests/ui/manual_assert.rs
Auto merge of #93893 - oli-obk:sad_revert, r=oli-obk
[rust.git] / tests / ui / manual_assert.rs
1 // revisions: edition2018 edition2021
2 // [edition2018] edition:2018
3 // [edition2021] edition:2021
4 // run-rustfix
5
6 #![warn(clippy::manual_assert)]
7 #![allow(clippy::nonminimal_bool)]
8
9 macro_rules! one {
10     () => {
11         1
12     };
13 }
14
15 fn main() {
16     let a = vec![1, 2, 3];
17     let c = Some(2);
18     if !a.is_empty()
19         && a.len() == 3
20         && c != None
21         && !a.is_empty()
22         && a.len() == 3
23         && !a.is_empty()
24         && a.len() == 3
25         && !a.is_empty()
26         && a.len() == 3
27     {
28         panic!("qaqaq{:?}", a);
29     }
30     if !a.is_empty() {
31         panic!("qaqaq{:?}", a);
32     }
33     if !a.is_empty() {
34         panic!("qwqwq");
35     }
36     if a.len() == 3 {
37         println!("qwq");
38         println!("qwq");
39         println!("qwq");
40     }
41     if let Some(b) = c {
42         panic!("orz {}", b);
43     }
44     if a.len() == 3 {
45         panic!("qaqaq");
46     } else {
47         println!("qwq");
48     }
49     let b = vec![1, 2, 3];
50     if b.is_empty() {
51         panic!("panic1");
52     }
53     if b.is_empty() && a.is_empty() {
54         panic!("panic2");
55     }
56     if a.is_empty() && !b.is_empty() {
57         panic!("panic3");
58     }
59     if b.is_empty() || a.is_empty() {
60         panic!("panic4");
61     }
62     if a.is_empty() || !b.is_empty() {
63         panic!("panic5");
64     }
65     if a.is_empty() {
66         panic!("with expansion {}", one!())
67     }
68 }