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