11error: only a `panic!` in `if`-then statement
2- --> tests/ui/manual_assert.rs:32 :5
2+ --> tests/ui/manual_assert.rs:30 :5
33 |
44LL | / if !a.is_empty() {
55LL | |
99 |
1010 = note: `-D clippy::manual-assert` implied by `-D warnings`
1111 = help: to override `-D warnings` add `#[allow(clippy::manual_assert)]`
12- help: try instead
12+ help: replace `if`-then-`panic!` with `assert!`
1313 |
1414LL - if !a.is_empty() {
1515LL -
@@ -19,15 +19,15 @@ LL + assert!(a.is_empty(), "qaqaq{:?}", a);
1919 |
2020
2121error: only a `panic!` in `if`-then statement
22- --> tests/ui/manual_assert.rs:36 :5
22+ --> tests/ui/manual_assert.rs:33 :5
2323 |
2424LL | / if !a.is_empty() {
2525LL | |
2626LL | | panic!("qwqwq");
2727LL | | }
2828 | |_____^
2929 |
30- help: try instead
30+ help: replace `if`-then-`panic!` with `assert!`
3131 |
3232LL - if !a.is_empty() {
3333LL -
@@ -37,15 +37,15 @@ LL + assert!(a.is_empty(), "qwqwq");
3737 |
3838
3939error: only a `panic!` in `if`-then statement
40- --> tests/ui/manual_assert.rs:54 :5
40+ --> tests/ui/manual_assert.rs:50 :5
4141 |
4242LL | / if b.is_empty() {
4343LL | |
4444LL | | panic!("panic1");
4545LL | | }
4646 | |_____^
4747 |
48- help: try instead
48+ help: replace `if`-then-`panic!` with `assert!`
4949 |
5050LL - if b.is_empty() {
5151LL -
@@ -55,15 +55,31 @@ LL + assert!(!b.is_empty(), "panic1");
5555 |
5656
5757error: 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
5975 |
6076LL | / if b.is_empty() && a.is_empty() {
6177LL | |
6278LL | | panic!("panic2");
6379LL | | }
6480 | |_____^
6581 |
66- help: try instead
82+ help: replace `if`-then-`panic!` with `assert!`
6783 |
6884LL - if b.is_empty() && a.is_empty() {
6985LL -
@@ -81,7 +97,7 @@ LL | | panic!("panic3");
8197LL | | }
8298 | |_____^
8399 |
84- help: try instead
100+ help: replace `if`-then-`panic!` with `assert!`
85101 |
86102LL - if a.is_empty() && !b.is_empty() {
87103LL -
@@ -91,15 +107,15 @@ LL + assert!(!(a.is_empty() && !b.is_empty()), "panic3");
91107 |
92108
93109error: only a `panic!` in `if`-then statement
94- --> tests/ui/manual_assert.rs:66 :5
110+ --> tests/ui/manual_assert.rs:59 :5
95111 |
96112LL | / if b.is_empty() || a.is_empty() {
97113LL | |
98114LL | | panic!("panic4");
99115LL | | }
100116 | |_____^
101117 |
102- help: try instead
118+ help: replace `if`-then-`panic!` with `assert!`
103119 |
104120LL - if b.is_empty() || a.is_empty() {
105121LL -
@@ -109,15 +125,15 @@ LL + assert!(!(b.is_empty() || a.is_empty()), "panic4");
109125 |
110126
111127error: only a `panic!` in `if`-then statement
112- --> tests/ui/manual_assert.rs:70 :5
128+ --> tests/ui/manual_assert.rs:62 :5
113129 |
114130LL | / if a.is_empty() || !b.is_empty() {
115131LL | |
116132LL | | panic!("panic5");
117133LL | | }
118134 | |_____^
119135 |
120- help: try instead
136+ help: replace `if`-then-`panic!` with `assert!`
121137 |
122138LL - if a.is_empty() || !b.is_empty() {
123139LL -
@@ -127,15 +143,15 @@ LL + assert!(!(a.is_empty() || !b.is_empty()), "panic5");
127143 |
128144
129145error: only a `panic!` in `if`-then statement
130- --> tests/ui/manual_assert.rs:74 :5
146+ --> tests/ui/manual_assert.rs:65 :5
131147 |
132148LL | / if a.is_empty() {
133149LL | |
134150LL | | panic!("with expansion {}", one!())
135151LL | | }
136152 | |_____^
137153 |
138- help: try instead
154+ help: replace `if`-then-`panic!` with `assert!`
139155 |
140156LL - if a.is_empty() {
141157LL -
@@ -145,7 +161,7 @@ LL + assert!(!a.is_empty(), "with expansion {}", one!());
145161 |
146162
147163error: only a `panic!` in `if`-then statement
148- --> tests/ui/manual_assert.rs:87 :5
164+ --> tests/ui/manual_assert.rs:77 :5
149165 |
150166LL | / if a > 2 {
151167LL | |
@@ -156,22 +172,19 @@ LL | | panic!("panic with comment") // comment after `panic!`
156172LL | | }
157173 | |_____^
158174 |
159- help: try instead
175+ help: replace `if`-then-`panic!` with `assert!`
160176 |
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");
171184 |
172185
173186error: only a `panic!` in `if`-then statement
174- --> tests/ui/manual_assert.rs:102 :25
187+ --> tests/ui/manual_assert.rs:91 :25
175188 |
176189LL | const BAR: () = if N == 0 {
177190 | _________________________^
@@ -180,13 +193,13 @@ LL | | panic!()
180193LL | | };
181194 | |_________^
182195 |
183- help: try instead
196+ help: replace `if`-then-`panic!` with `assert!`
184197 |
185198LL - const BAR: () = if N == 0 {
186199LL -
187200LL - panic!()
188201LL - };
189- LL + const BAR: () = assert!(N != 0 , );
202+ LL + const BAR: () = assert!(!(N == 0) , );
190203 |
191204
192205error: only a `panic!` in `if`-then statement
@@ -198,7 +211,7 @@ LL | | panic!("SSSE3 is not supported");
198211LL | | }
199212 | |_____^
200213 |
201- help: try instead
214+ help: replace `if`-then-`panic!` with `assert!`
202215 |
203216LL - if !is_x86_feature_detected!("ssse3") {
204217LL -
0 commit comments