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 | |
9
9
|
10
10
= note: `-D clippy::manual-assert` implied by `-D warnings`
11
11
= help: to override `-D warnings` add `#[allow(clippy::manual_assert)]`
12
- help: try instead
12
+ help: replace `if`-then-`panic!` with `assert!`
13
13
|
14
14
LL - if !a.is_empty() {
15
15
LL -
@@ -19,15 +19,15 @@ LL + assert!(a.is_empty(), "qaqaq{:?}", a);
19
19
|
20
20
21
21
error: only a `panic!` in `if`-then statement
22
- --> tests/ui/manual_assert.rs:36 :5
22
+ --> tests/ui/manual_assert.rs:33 :5
23
23
|
24
24
LL | / if !a.is_empty() {
25
25
LL | |
26
26
LL | | panic!("qwqwq");
27
27
LL | | }
28
28
| |_____^
29
29
|
30
- help: try instead
30
+ help: replace `if`-then-`panic!` with `assert!`
31
31
|
32
32
LL - if !a.is_empty() {
33
33
LL -
@@ -37,15 +37,15 @@ LL + assert!(a.is_empty(), "qwqwq");
37
37
|
38
38
39
39
error: only a `panic!` in `if`-then statement
40
- --> tests/ui/manual_assert.rs:54 :5
40
+ --> tests/ui/manual_assert.rs:50 :5
41
41
|
42
42
LL | / if b.is_empty() {
43
43
LL | |
44
44
LL | | panic!("panic1");
45
45
LL | | }
46
46
| |_____^
47
47
|
48
- help: try instead
48
+ help: replace `if`-then-`panic!` with `assert!`
49
49
|
50
50
LL - if b.is_empty() {
51
51
LL -
@@ -55,15 +55,31 @@ LL + assert!(!b.is_empty(), "panic1");
55
55
|
56
56
57
57
error: only a `panic!` in `if`-then statement
58
- --> tests/ui/manual_assert.rs:58:5
58
+ --> tests/ui/manual_assert.rs:53:5
59
+ |
60
+ LL | / if b.is_empty() && a.is_empty() {
61
+ LL | | panic!("panic2");
62
+ LL | | }
63
+ | |_____^
64
+ |
65
+ help: replace `if`-then-`panic!` with `assert!`
66
+ |
67
+ LL - if b.is_empty() && a.is_empty() {
68
+ LL - panic!("panic2");
69
+ LL - }
70
+ LL + assert!(!(b.is_empty() && a.is_empty()), "panic2");
71
+ |
72
+
73
+ error: only a `panic!` in `if`-then statement
74
+ --> tests/ui/manual_assert.rs:56:5
59
75
|
60
76
LL | / if b.is_empty() && a.is_empty() {
61
77
LL | |
62
78
LL | | panic!("panic2");
63
79
LL | | }
64
80
| |_____^
65
81
|
66
- help: try instead
82
+ help: replace `if`-then-`panic!` with `assert!`
67
83
|
68
84
LL - if b.is_empty() && a.is_empty() {
69
85
LL -
@@ -81,7 +97,7 @@ LL | | panic!("panic3");
81
97
LL | | }
82
98
| |_____^
83
99
|
84
- help: try instead
100
+ help: replace `if`-then-`panic!` with `assert!`
85
101
|
86
102
LL - if a.is_empty() && !b.is_empty() {
87
103
LL -
@@ -91,15 +107,15 @@ LL + assert!(!(a.is_empty() && !b.is_empty()), "panic3");
91
107
|
92
108
93
109
error: only a `panic!` in `if`-then statement
94
- --> tests/ui/manual_assert.rs:66 :5
110
+ --> tests/ui/manual_assert.rs:59 :5
95
111
|
96
112
LL | / if b.is_empty() || a.is_empty() {
97
113
LL | |
98
114
LL | | panic!("panic4");
99
115
LL | | }
100
116
| |_____^
101
117
|
102
- help: try instead
118
+ help: replace `if`-then-`panic!` with `assert!`
103
119
|
104
120
LL - if b.is_empty() || a.is_empty() {
105
121
LL -
@@ -109,15 +125,15 @@ LL + assert!(!(b.is_empty() || a.is_empty()), "panic4");
109
125
|
110
126
111
127
error: only a `panic!` in `if`-then statement
112
- --> tests/ui/manual_assert.rs:70 :5
128
+ --> tests/ui/manual_assert.rs:62 :5
113
129
|
114
130
LL | / if a.is_empty() || !b.is_empty() {
115
131
LL | |
116
132
LL | | panic!("panic5");
117
133
LL | | }
118
134
| |_____^
119
135
|
120
- help: try instead
136
+ help: replace `if`-then-`panic!` with `assert!`
121
137
|
122
138
LL - if a.is_empty() || !b.is_empty() {
123
139
LL -
@@ -127,15 +143,15 @@ LL + assert!(!(a.is_empty() || !b.is_empty()), "panic5");
127
143
|
128
144
129
145
error: only a `panic!` in `if`-then statement
130
- --> tests/ui/manual_assert.rs:74 :5
146
+ --> tests/ui/manual_assert.rs:65 :5
131
147
|
132
148
LL | / if a.is_empty() {
133
149
LL | |
134
150
LL | | panic!("with expansion {}", one!())
135
151
LL | | }
136
152
| |_____^
137
153
|
138
- help: try instead
154
+ help: replace `if`-then-`panic!` with `assert!`
139
155
|
140
156
LL - if a.is_empty() {
141
157
LL -
@@ -145,7 +161,7 @@ LL + assert!(!a.is_empty(), "with expansion {}", one!());
145
161
|
146
162
147
163
error: only a `panic!` in `if`-then statement
148
- --> tests/ui/manual_assert.rs:87 :5
164
+ --> tests/ui/manual_assert.rs:77 :5
149
165
|
150
166
LL | / if a > 2 {
151
167
LL | |
@@ -156,22 +172,19 @@ LL | | panic!("panic with comment") // comment after `panic!`
156
172
LL | | }
157
173
| |_____^
158
174
|
159
- help: try instead
175
+ help: replace `if`-then-`panic!` with `assert!`
160
176
|
161
- LL - if a > 2 {
162
- LL -
163
- LL - // comment
164
- LL - /* this is a
165
- LL - multiline
166
- LL - comment */
167
- LL - /// Doc comment
168
- LL - panic!("panic with comment") // comment after `panic!`
169
- LL - }
170
- LL + assert!(a <= 2, "panic with comment");
177
+ LL ~ // comment
178
+ LL + /* this is a
179
+ LL + multiline
180
+ LL + comment */
181
+ LL + /// Doc comment
182
+ LL + // comment after `panic!`
183
+ LL + assert!(!(a > 2), "panic with comment");
171
184
|
172
185
173
186
error: only a `panic!` in `if`-then statement
174
- --> tests/ui/manual_assert.rs:102 :25
187
+ --> tests/ui/manual_assert.rs:91 :25
175
188
|
176
189
LL | const BAR: () = if N == 0 {
177
190
| _________________________^
@@ -180,13 +193,13 @@ LL | | panic!()
180
193
LL | | };
181
194
| |_________^
182
195
|
183
- help: try instead
196
+ help: replace `if`-then-`panic!` with `assert!`
184
197
|
185
198
LL - const BAR: () = if N == 0 {
186
199
LL -
187
200
LL - panic!()
188
201
LL - };
189
- LL + const BAR: () = assert!(N != 0 , );
202
+ LL + const BAR: () = assert!(!(N == 0) , );
190
203
|
191
204
192
205
error: only a `panic!` in `if`-then statement
@@ -198,7 +211,7 @@ LL | | panic!("SSSE3 is not supported");
198
211
LL | | }
199
212
| |_____^
200
213
|
201
- help: try instead
214
+ help: replace `if`-then-`panic!` with `assert!`
202
215
|
203
216
LL - if !is_x86_feature_detected!("ssse3") {
204
217
LL -
0 commit comments