@@ -271,6 +271,57 @@ LL | if result.is_ok() {
271
271
LL | result.as_ref().unwrap();
272
272
| ^^^^^^^^^^^^^^^^^^^^^^^^
273
273
274
+ error: called `unwrap` on `x` after checking its variant with `is_some`
275
+ --> tests/ui/checked_unwrap/simple_conditionals.rs:246:17
276
+ |
277
+ LL | if x.is_some() {
278
+ | -------------- help: try: `if let Some(<item>) = x`
279
+ LL | _ = x.unwrap();
280
+ | ^^^^^^^^^^
281
+
282
+ error: this call to `unwrap()` will always panic
283
+ --> tests/ui/checked_unwrap/simple_conditionals.rs:249:17
284
+ |
285
+ LL | if x.is_some() {
286
+ | ----------- because of this check
287
+ ...
288
+ LL | _ = x.unwrap();
289
+ | ^^^^^^^^^^
290
+
291
+ error: called `unwrap` on `r` after checking its variant with `is_ok`
292
+ --> tests/ui/checked_unwrap/simple_conditionals.rs:255:17
293
+ |
294
+ LL | if r.is_ok() {
295
+ | ------------ help: try: `if let Ok(<item>) = &r`
296
+ LL | _ = r.as_ref().unwrap();
297
+ | ^^^^^^^^^^^^^^^^^^^
298
+
299
+ error: this call to `unwrap()` will always panic
300
+ --> tests/ui/checked_unwrap/simple_conditionals.rs:258:17
301
+ |
302
+ LL | if r.is_ok() {
303
+ | --------- because of this check
304
+ ...
305
+ LL | _ = r.as_ref().unwrap();
306
+ | ^^^^^^^^^^^^^^^^^^^
307
+
308
+ error: called `unwrap` on `x` after checking its variant with `is_some`
309
+ --> tests/ui/checked_unwrap/simple_conditionals.rs:267:17
310
+ |
311
+ LL | if x.is_some() {
312
+ | -------------- help: try: `if let Some(<item>) = x`
313
+ LL | _ = x.unwrap();
314
+ | ^^^^^^^^^^
315
+
316
+ error: this call to `unwrap()` will always panic
317
+ --> tests/ui/checked_unwrap/simple_conditionals.rs:270:17
318
+ |
319
+ LL | if x.is_some() {
320
+ | ----------- because of this check
321
+ ...
322
+ LL | _ = x.unwrap();
323
+ | ^^^^^^^^^^
324
+
274
325
error: creating a shared reference to mutable static
275
326
--> tests/ui/checked_unwrap/simple_conditionals.rs:183:12
276
327
|
@@ -281,5 +332,5 @@ LL | if X.is_some() {
281
332
= note: shared references to mutable statics are dangerous; it's undefined behavior if the static is mutated or if a mutable reference is created for it while the shared reference lives
282
333
= note: `#[deny(static_mut_refs)]` on by default
283
334
284
- error: aborting due to 30 previous errors
335
+ error: aborting due to 36 previous errors
285
336
0 commit comments