|
| 1 | +warning: for loop over an `Option`. This is more readably written as an `if let` statement |
| 2 | + --> $DIR/for_loop_over_fallibles.rs:5:14 |
| 3 | + | |
| 4 | +LL | for _ in Some(1) {} |
| 5 | + | ^^^^^^^ |
| 6 | + | |
| 7 | + = note: `#[warn(for_loop_over_fallibles)]` on by default |
| 8 | +help: to check pattern in a loop use `while let` |
| 9 | + | |
| 10 | +LL | while let Some(_) = Some(1) {} |
| 11 | + | ~~~~~~~~~~~~~~~ ~~~ |
| 12 | +help: consider using `if let` to clear intent |
| 13 | + | |
| 14 | +LL | if let Some(_) = Some(1) {} |
| 15 | + | ~~~~~~~~~~~~ ~~~ |
| 16 | + |
| 17 | +warning: for loop over a `Result`. This is more readably written as an `if let` statement |
| 18 | + --> $DIR/for_loop_over_fallibles.rs:9:14 |
| 19 | + | |
| 20 | +LL | for _ in Ok::<_, ()>(1) {} |
| 21 | + | ^^^^^^^^^^^^^^ |
| 22 | + | |
| 23 | +help: to check pattern in a loop use `while let` |
| 24 | + | |
| 25 | +LL | while let Ok(_) = Ok::<_, ()>(1) {} |
| 26 | + | ~~~~~~~~~~~~~ ~~~ |
| 27 | +help: consider using `if let` to clear intent |
| 28 | + | |
| 29 | +LL | if let Ok(_) = Ok::<_, ()>(1) {} |
| 30 | + | ~~~~~~~~~~ ~~~ |
| 31 | + |
| 32 | +warning: for loop over an `Option`. This is more readably written as an `if let` statement |
| 33 | + --> $DIR/for_loop_over_fallibles.rs:15:14 |
| 34 | + | |
| 35 | +LL | for _ in [0; 0].iter().next() {} |
| 36 | + | ^^^^^^^^^^^^^^^^^^^^ |
| 37 | + | |
| 38 | +help: to iterate over `[0; 0].iter()` remove the call to `next` |
| 39 | + | |
| 40 | +LL - for _ in [0; 0].iter().next() {} |
| 41 | +LL + for _ in [0; 0].iter() {} |
| 42 | + | |
| 43 | +help: consider using `if let` to clear intent |
| 44 | + | |
| 45 | +LL | if let Some(_) = [0; 0].iter().next() {} |
| 46 | + | ~~~~~~~~~~~~ ~~~ |
| 47 | + |
| 48 | +warning: for loop over a `Result`. This is more readably written as an `if let` statement |
| 49 | + --> $DIR/for_loop_over_fallibles.rs:21:14 |
| 50 | + | |
| 51 | +LL | for _ in Ok::<_, ()>([0; 0].iter()) {} |
| 52 | + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 53 | + | |
| 54 | +help: to check pattern in a loop use `while let` |
| 55 | + | |
| 56 | +LL | while let Ok(_) = Ok::<_, ()>([0; 0].iter()) {} |
| 57 | + | ~~~~~~~~~~~~~ ~~~ |
| 58 | +help: consider using `if let` to clear intent |
| 59 | + | |
| 60 | +LL | if let Ok(_) = Ok::<_, ()>([0; 0].iter()) {} |
| 61 | + | ~~~~~~~~~~ ~~~ |
| 62 | + |
| 63 | +warning: for loop over a `Result`. This is more readably written as an `if let` statement |
| 64 | + --> $DIR/for_loop_over_fallibles.rs:29:14 |
| 65 | + | |
| 66 | +LL | for _ in Ok::<_, ()>([0; 0].iter()) {} |
| 67 | + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 68 | + | |
| 69 | +help: to check pattern in a loop use `while let` |
| 70 | + | |
| 71 | +LL | while let Ok(_) = Ok::<_, ()>([0; 0].iter()) {} |
| 72 | + | ~~~~~~~~~~~~~ ~~~ |
| 73 | +help: consider unwrapping the `Result` with `?` to iterate over its contents |
| 74 | + | |
| 75 | +LL | for _ in Ok::<_, ()>([0; 0].iter())? {} |
| 76 | + | + |
| 77 | +help: consider using `if let` to clear intent |
| 78 | + | |
| 79 | +LL | if let Ok(_) = Ok::<_, ()>([0; 0].iter()) {} |
| 80 | + | ~~~~~~~~~~ ~~~ |
| 81 | + |
| 82 | +warning: for loop over a `Result`. This is more readably written as an `if let` statement |
| 83 | + --> $DIR/for_loop_over_fallibles.rs:36:14 |
| 84 | + | |
| 85 | +LL | for _ in Ok::<_, ()>([0; 0]) {} |
| 86 | + | ^^^^^^^^^^^^^^^^^^^ |
| 87 | + | |
| 88 | +help: to check pattern in a loop use `while let` |
| 89 | + | |
| 90 | +LL | while let Ok(_) = Ok::<_, ()>([0; 0]) {} |
| 91 | + | ~~~~~~~~~~~~~ ~~~ |
| 92 | +help: consider unwrapping the `Result` with `?` to iterate over its contents |
| 93 | + | |
| 94 | +LL | for _ in Ok::<_, ()>([0; 0])? {} |
| 95 | + | + |
| 96 | +help: consider using `if let` to clear intent |
| 97 | + | |
| 98 | +LL | if let Ok(_) = Ok::<_, ()>([0; 0]) {} |
| 99 | + | ~~~~~~~~~~ ~~~ |
| 100 | + |
| 101 | +warning: 6 warnings emitted |
| 102 | + |
0 commit comments