]> git.lizzy.rs Git - rust.git/blob - tests/ui/manual_assert.edition2018.fixed
Auto merge of #7906 - smoelius:master, r=camsteffen
[rust.git] / tests / ui / manual_assert.edition2018.fixed
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     assert!(a.is_empty(), "qaqaq{:?}", a);
23     assert!(a.is_empty(), "qwqwq");
24     if a.len() == 3 {
25         println!("qwq");
26         println!("qwq");
27         println!("qwq");
28     }
29     if let Some(b) = c {
30         panic!("orz {}", b);
31     }
32     if a.len() == 3 {
33         panic!("qaqaq");
34     } else {
35         println!("qwq");
36     }
37     let b = vec![1, 2, 3];
38     assert!(!b.is_empty(), "panic1");
39     assert!(!(b.is_empty() && a.is_empty()), "panic2");
40     assert!(!(a.is_empty() && !b.is_empty()), "panic3");
41     assert!(!(b.is_empty() || a.is_empty()), "panic4");
42     assert!(!(a.is_empty() || !b.is_empty()), "panic5");
43 }