]> git.proxmox.com Git - rustc.git/blob - src/tools/clippy/tests/ui/manual_assert.edition2018.fixed
New upstream version 1.65.0+dfsg1
[rustc.git] / src / tools / clippy / tests / ui / manual_assert.edition2018.fixed
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 macro_rules! one {
10 () => {
11 1
12 };
13 }
14
15 fn main() {
16 let a = vec![1, 2, 3];
17 let c = Some(2);
18 if !a.is_empty()
19 && a.len() == 3
20 && c.is_some()
21 && !a.is_empty()
22 && a.len() == 3
23 && !a.is_empty()
24 && a.len() == 3
25 && !a.is_empty()
26 && a.len() == 3
27 {
28 panic!("qaqaq{:?}", a);
29 }
30 assert!(a.is_empty(), "qaqaq{:?}", a);
31 assert!(a.is_empty(), "qwqwq");
32 if a.len() == 3 {
33 println!("qwq");
34 println!("qwq");
35 println!("qwq");
36 }
37 if let Some(b) = c {
38 panic!("orz {}", b);
39 }
40 if a.len() == 3 {
41 panic!("qaqaq");
42 } else {
43 println!("qwq");
44 }
45 let b = vec![1, 2, 3];
46 assert!(!b.is_empty(), "panic1");
47 assert!(!(b.is_empty() && a.is_empty()), "panic2");
48 assert!(!(a.is_empty() && !b.is_empty()), "panic3");
49 assert!(!(b.is_empty() || a.is_empty()), "panic4");
50 assert!(!(a.is_empty() || !b.is_empty()), "panic5");
51 assert!(!a.is_empty(), "with expansion {}", one!());
52 }