1
1
error: only a `panic!` in `if`-then statement
2
- --> tests/ui/manual_assert.rs:32 :5
2
+ --> tests/ui/manual_assert.rs:30 :5
3
3
|
4
4
LL | / if !a.is_empty() {
5
5
LL | | panic!("qaqaq{:?}", a);
6
6
LL | | }
7
- | |_____^ help: try instead : `assert!(a.is_empty(), "qaqaq{:?}", a);`
7
+ | |_____^ help: replace `if`-then-`panic!` with `assert!` : `assert!(a.is_empty(), "qaqaq{:?}", a);`
8
8
|
9
9
= note: `-D clippy::manual-assert` implied by `-D warnings`
10
10
= help: to override `-D warnings` add `#[allow(clippy::manual_assert)]`
11
11
12
12
error: only a `panic!` in `if`-then statement
13
- --> tests/ui/manual_assert.rs:35 :5
13
+ --> tests/ui/manual_assert.rs:33 :5
14
14
|
15
15
LL | / if !a.is_empty() {
16
16
LL | | panic!("qwqwq");
17
17
LL | | }
18
- | |_____^ help: try instead : `assert!(a.is_empty(), "qwqwq");`
18
+ | |_____^ help: replace `if`-then-`panic!` with `assert!` : `assert!(a.is_empty(), "qwqwq");`
19
19
20
20
error: only a `panic!` in `if`-then statement
21
- --> tests/ui/manual_assert.rs:52 :5
21
+ --> tests/ui/manual_assert.rs:50 :5
22
22
|
23
23
LL | / if b.is_empty() {
24
24
LL | | panic!("panic1");
25
25
LL | | }
26
- | |_____^ help: try instead : `assert!(!b.is_empty(), "panic1");`
26
+ | |_____^ help: replace `if`-then-`panic!` with `assert!` : `assert!(!b.is_empty(), "panic1");`
27
27
28
28
error: only a `panic!` in `if`-then statement
29
- --> tests/ui/manual_assert.rs:55 :5
29
+ --> tests/ui/manual_assert.rs:53 :5
30
30
|
31
31
LL | / if b.is_empty() && a.is_empty() {
32
32
LL | | panic!("panic2");
33
33
LL | | }
34
- | |_____^ help: try instead : `assert!(!(b.is_empty() && a.is_empty()), "panic2");`
34
+ | |_____^ help: replace `if`-then-`panic!` with `assert!` : `assert!(!(b.is_empty() && a.is_empty()), "panic2");`
35
35
36
36
error: only a `panic!` in `if`-then statement
37
- --> tests/ui/manual_assert.rs:58 :5
37
+ --> tests/ui/manual_assert.rs:56 :5
38
38
|
39
39
LL | / if a.is_empty() && !b.is_empty() {
40
40
LL | | panic!("panic3");
41
41
LL | | }
42
- | |_____^ help: try instead : `assert!(!(a.is_empty() && !b.is_empty()), "panic3");`
42
+ | |_____^ help: replace `if`-then-`panic!` with `assert!` : `assert!(!(a.is_empty() && !b.is_empty()), "panic3");`
43
43
44
44
error: only a `panic!` in `if`-then statement
45
- --> tests/ui/manual_assert.rs:61 :5
45
+ --> tests/ui/manual_assert.rs:59 :5
46
46
|
47
47
LL | / if b.is_empty() || a.is_empty() {
48
48
LL | | panic!("panic4");
49
49
LL | | }
50
- | |_____^ help: try instead : `assert!(!(b.is_empty() || a.is_empty()), "panic4");`
50
+ | |_____^ help: replace `if`-then-`panic!` with `assert!` : `assert!(!(b.is_empty() || a.is_empty()), "panic4");`
51
51
52
52
error: only a `panic!` in `if`-then statement
53
- --> tests/ui/manual_assert.rs:64 :5
53
+ --> tests/ui/manual_assert.rs:62 :5
54
54
|
55
55
LL | / if a.is_empty() || !b.is_empty() {
56
56
LL | | panic!("panic5");
57
57
LL | | }
58
- | |_____^ help: try instead : `assert!(!(a.is_empty() || !b.is_empty()), "panic5");`
58
+ | |_____^ help: replace `if`-then-`panic!` with `assert!` : `assert!(!(a.is_empty() || !b.is_empty()), "panic5");`
59
59
60
60
error: only a `panic!` in `if`-then statement
61
- --> tests/ui/manual_assert.rs:67 :5
61
+ --> tests/ui/manual_assert.rs:65 :5
62
62
|
63
63
LL | / if a.is_empty() {
64
64
LL | | panic!("with expansion {}", one!())
65
65
LL | | }
66
- | |_____^ help: try instead : `assert!(!a.is_empty(), "with expansion {}", one!());`
66
+ | |_____^ help: replace `if`-then-`panic!` with `assert!` : `assert!(!a.is_empty(), "with expansion {}", one!());`
67
67
68
68
error: only a `panic!` in `if`-then statement
69
- --> tests/ui/manual_assert.rs:79 :5
69
+ --> tests/ui/manual_assert.rs:77 :5
70
70
|
71
71
LL | / if a > 2 {
72
72
LL | | // comment
@@ -77,19 +77,25 @@ LL | | panic!("panic with comment") // comment after `panic!`
77
77
LL | | }
78
78
| |_____^
79
79
|
80
- help: try instead
80
+ help: replace `if`-then-`panic!` with `assert!`
81
81
|
82
- LL | assert!(!(a > 2), "panic with comment");
82
+ LL ~ // comment
83
+ LL + /* this is a
84
+ LL + multiline
85
+ LL + comment */
86
+ LL + /// Doc comment
87
+ LL + // comment after `panic!`
88
+ LL + assert!(!(a > 2), "panic with comment");
83
89
|
84
90
85
91
error: only a `panic!` in `if`-then statement
86
- --> tests/ui/manual_assert.rs:93 :25
92
+ --> tests/ui/manual_assert.rs:91 :25
87
93
|
88
94
LL | const BAR: () = if N == 0 {
89
95
| _________________________^
90
96
LL | | panic!()
91
97
LL | | };
92
- | |_________^ help: try instead : `assert!(!(N == 0), )`
98
+ | |_________^ help: replace `if`-then-`panic!` with `assert!` : `assert!(!(N == 0), )`
93
99
94
100
error: aborting due to 10 previous errors
95
101
0 commit comments