|
1 | | -error[E0425]: cannot find value `x` in this scope |
2 | | - --> tests/ui/option_map_unit_fn_unfixable.rs:16:5 |
| 1 | +error: called `map(f)` on an `Option` value where `f` is a closure that returns the unit type `()` |
| 2 | + --> tests/ui/option_map_unit_fn_unfixable.rs:23:5 |
3 | 3 | | |
4 | 4 | LL | x.field.map(|value| { do_nothing(value); do_nothing(value) }); |
5 | | - | ^ not found in this scope |
| 5 | + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- |
| 6 | + | | |
| 7 | + | help: try: `if let Some(value) = x.field { ... }` |
| 8 | + | |
| 9 | + = note: `-D clippy::option-map-unit-fn` implied by `-D warnings` |
| 10 | + = help: to override `-D warnings` add `#[allow(clippy::option_map_unit_fn)]` |
6 | 11 |
|
7 | | -error[E0425]: cannot find value `x` in this scope |
8 | | - --> tests/ui/option_map_unit_fn_unfixable.rs:19:5 |
| 12 | +error: called `map(f)` on an `Option` value where `f` is a closure that returns the unit type `()` |
| 13 | + --> tests/ui/option_map_unit_fn_unfixable.rs:26:5 |
9 | 14 | | |
10 | 15 | LL | x.field.map(|value| if value > 0 { do_nothing(value); do_nothing(value) }); |
11 | | - | ^ not found in this scope |
| 16 | + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- |
| 17 | + | | |
| 18 | + | help: try: `if let Some(value) = x.field { ... }` |
12 | 19 |
|
13 | | -error[E0425]: cannot find value `x` in this scope |
14 | | - --> tests/ui/option_map_unit_fn_unfixable.rs:24:5 |
| 20 | +error: called `map(f)` on an `Option` value where `f` is a closure that returns the unit type `()` |
| 21 | + --> tests/ui/option_map_unit_fn_unfixable.rs:31:5 |
| 22 | + | |
| 23 | +LL | // x.field.map(|value| { |
| 24 | +LL | || do_nothing(value); |
| 25 | +LL | || do_nothing(value) |
| 26 | +LL | || }); |
| 27 | + | ||______^- help: try: `if let Some(value) = x.field { ... }` |
| 28 | + | |______| |
15 | 29 | | |
16 | | -LL | x.field.map(|value| { |
17 | | - | ^ not found in this scope |
18 | 30 |
|
19 | | -error[E0425]: cannot find value `x` in this scope |
20 | | - --> tests/ui/option_map_unit_fn_unfixable.rs:29:5 |
| 31 | +error: called `map(f)` on an `Option` value where `f` is a closure that returns the unit type `()` |
| 32 | + --> tests/ui/option_map_unit_fn_unfixable.rs:36:5 |
21 | 33 | | |
22 | 34 | LL | x.field.map(|value| { do_nothing(value); do_nothing(value); }); |
23 | | - | ^ not found in this scope |
| 35 | + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- |
| 36 | + | | |
| 37 | + | help: try: `if let Some(value) = x.field { ... }` |
| 38 | + |
| 39 | +error: called `map(f)` on an `Option` value where `f` is a function that returns the unit type `()` |
| 40 | + --> tests/ui/option_map_unit_fn_unfixable.rs:40:5 |
| 41 | + | |
| 42 | +LL | Some(42).map(diverge); |
| 43 | + | ^^^^^^^^^^^^^^^^^^^^^- |
| 44 | + | | |
| 45 | + | help: try: `if let Some(a) = Some(42) { diverge(a) }` |
| 46 | + |
| 47 | +error: called `map(f)` on an `Option` value where `f` is a function that returns the unit type `()` |
| 48 | + --> tests/ui/option_map_unit_fn_unfixable.rs:42:5 |
| 49 | + | |
| 50 | +LL | "12".parse::<i32>().ok().map(diverge); |
| 51 | + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- |
| 52 | + | | |
| 53 | + | help: try: `if let Some(a) = "12".parse::<i32>().ok() { diverge(a) }` |
| 54 | + |
| 55 | +error: called `map(f)` on an `Option` value where `f` is a function that returns the unit type `()` |
| 56 | + --> tests/ui/option_map_unit_fn_unfixable.rs:44:5 |
| 57 | + | |
| 58 | +LL | Some(plus_one(1)).map(do_nothing); |
| 59 | + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- |
| 60 | + | | |
| 61 | + | help: try: `if let Some(a) = Some(plus_one(1)) { do_nothing(a) }` |
| 62 | + |
| 63 | +error: called `map(f)` on an `Option` value where `f` is a function that returns the unit type `()` |
| 64 | + --> tests/ui/option_map_unit_fn_unfixable.rs:49:5 |
| 65 | + | |
| 66 | +LL | y.map(do_nothing); |
| 67 | + | ^^^^^^^^^^^^^^^^^- |
| 68 | + | | |
| 69 | + | help: try: `if let Some(_y) = y { do_nothing(_y) }` |
24 | 70 |
|
25 | | -error: aborting due to 4 previous errors |
| 71 | +error: aborting due to 8 previous errors |
26 | 72 |
|
27 | | -For more information about this error, try `rustc --explain E0425`. |
|
0 commit comments