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