]> git.lizzy.rs Git - rust.git/blob - tests/ui/manual_assert.rs
Merge remote-tracking branch 'upstream/beta' into backport_remerge
[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 fn main() {
10     let a = vec![1, 2, 3];
11     let c = Some(2);
12     if !a.is_empty()
13         && a.len() == 3
14         && c != None
15         && !a.is_empty()
16         && a.len() == 3
17         && !a.is_empty()
18         && a.len() == 3
19         && !a.is_empty()
20         && a.len() == 3
21     {
22         panic!("qaqaq{:?}", a);
23     }
24     if !a.is_empty() {
25         panic!("qaqaq{:?}", a);
26     }
27     if !a.is_empty() {
28         panic!("qwqwq");
29     }
30     if a.len() == 3 {
31         println!("qwq");
32         println!("qwq");
33         println!("qwq");
34     }
35     if let Some(b) = c {
36         panic!("orz {}", b);
37     }
38     if a.len() == 3 {
39         panic!("qaqaq");
40     } else {
41         println!("qwq");
42     }
43     let b = vec![1, 2, 3];
44     if b.is_empty() {
45         panic!("panic1");
46     }
47     if b.is_empty() && a.is_empty() {
48         panic!("panic2");
49     }
50     if a.is_empty() && !b.is_empty() {
51         panic!("panic3");
52     }
53     if b.is_empty() || a.is_empty() {
54         panic!("panic4");
55     }
56     if a.is_empty() || !b.is_empty() {
57         panic!("panic5");
58     }
59 }