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