]> git.lizzy.rs Git - rust.git/blob - src/tools/clippy/tests/ui/if_then_panic.fixed
Merge commit 'b7f3f7f6082679da2da9a0b3faf1b5adef3afd3b' into clippyup
[rust.git] / src / tools / clippy / tests / ui / if_then_panic.fixed
1 // run-rustfix
2 #![warn(clippy::if_then_panic)]
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     assert!(a.is_empty(), "qaqaq{:?}", a);
20     assert!(a.is_empty(), "qwqwq");
21     if a.len() == 3 {
22         println!("qwq");
23         println!("qwq");
24         println!("qwq");
25     }
26     if let Some(b) = c {
27         panic!("orz {}", b);
28     }
29     if a.len() == 3 {
30         panic!("qaqaq");
31     } else {
32         println!("qwq");
33     }
34     let b = vec![1, 2, 3];
35     assert!(!b.is_empty(), "panic1");
36     assert!(!(b.is_empty() && a.is_empty()), "panic2");
37     assert!(!(a.is_empty() && !b.is_empty()), "panic3");
38     assert!(!(b.is_empty() || a.is_empty()), "panic4");
39     assert!(!(a.is_empty() || !b.is_empty()), "panic5");
40 }