]> git.lizzy.rs Git - rust.git/blob - tests/ui/manual_assert.edition2018.fixed
Use Span::from_expansion instead of in_macro
[rust.git] / 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 fn main() {
10     let a = vec![1, 2, 3];
11     let c = Some(2);
12     if !a.is_empty()
13         && a.len() == 3
14         && c != None
15         && !a.is_empty()
16         && a.len() == 3
17         && !a.is_empty()
18         && a.len() == 3
19         && !a.is_empty()
20         && a.len() == 3
21     {
22         panic!("qaqaq{:?}", a);
23     }
24     assert!(a.is_empty(), "qaqaq{:?}", a);
25     assert!(a.is_empty(), "qwqwq");
26     if a.len() == 3 {
27         println!("qwq");
28         println!("qwq");
29         println!("qwq");
30     }
31     if let Some(b) = c {
32         panic!("orz {}", b);
33     }
34     if a.len() == 3 {
35         panic!("qaqaq");
36     } else {
37         println!("qwq");
38     }
39     let b = vec![1, 2, 3];
40     assert!(!b.is_empty(), "panic1");
41     assert!(!(b.is_empty() && a.is_empty()), "panic2");
42     assert!(!(a.is_empty() && !b.is_empty()), "panic3");
43     assert!(!(b.is_empty() || a.is_empty()), "panic4");
44     assert!(!(a.is_empty() || !b.is_empty()), "panic5");
45 }