|
1 |
| -error[E0425]: cannot find value `x` in this scope |
2 |
| - --> $DIR/result_map_unit_fn_unfixable.rs:17:5 |
| 1 | +error: called `map(f)` on an `Result` value where `f` is a closure that returns the unit type |
| 2 | + --> $DIR/result_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 this: `if let Ok(value) = x.field { ... }` |
| 8 | + | |
| 9 | + = note: `-D clippy::result-map-unit-fn` implied by `-D warnings` |
6 | 10 |
|
7 |
| -error[E0425]: cannot find value `x` in this scope |
8 |
| - --> $DIR/result_map_unit_fn_unfixable.rs:19:5 |
| 11 | +error: called `map(f)` on an `Result` value where `f` is a closure that returns the unit type |
| 12 | + --> $DIR/result_map_unit_fn_unfixable.rs:25:5 |
9 | 13 | |
|
10 | 14 | LL | x.field.map(|value| if value > 0 { do_nothing(value); do_nothing(value) });
|
11 |
| - | ^ not found in this scope |
| 15 | + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- |
| 16 | + | | |
| 17 | + | help: try this: `if let Ok(value) = x.field { ... }` |
12 | 18 |
|
13 |
| -error[E0425]: cannot find value `x` in this scope |
14 |
| - --> $DIR/result_map_unit_fn_unfixable.rs:23:5 |
| 19 | +error: called `map(f)` on an `Result` value where `f` is a closure that returns the unit type |
| 20 | + --> $DIR/result_map_unit_fn_unfixable.rs:29:5 |
15 | 21 | |
|
16 |
| -LL | x.field.map(|value| { |
17 |
| - | ^ not found in this scope |
| 22 | +LL | x.field.map(|value| { |
| 23 | + | _____^ |
| 24 | + | |_____| |
| 25 | + | || |
| 26 | +LL | || do_nothing(value); |
| 27 | +LL | || do_nothing(value) |
| 28 | +LL | || }); |
| 29 | + | ||______^- help: try this: `if let Ok(value) = x.field { ... }` |
| 30 | + | |_______| |
| 31 | + | |
18 | 32 |
|
19 |
| -error[E0425]: cannot find value `x` in this scope |
20 |
| - --> $DIR/result_map_unit_fn_unfixable.rs:27:5 |
| 33 | +error: called `map(f)` on an `Result` value where `f` is a closure that returns the unit type |
| 34 | + --> $DIR/result_map_unit_fn_unfixable.rs:33:5 |
21 | 35 | |
|
22 | 36 | LL | x.field.map(|value| { do_nothing(value); do_nothing(value); });
|
23 |
| - | ^ not found in this scope |
| 37 | + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- |
| 38 | + | | |
| 39 | + | help: try this: `if let Ok(value) = x.field { ... }` |
| 40 | + |
| 41 | +error: called `map(f)` on an `Result` value where `f` is a function that returns the unit type |
| 42 | + --> $DIR/result_map_unit_fn_unfixable.rs:37:5 |
| 43 | + | |
| 44 | +LL | "12".parse::<i32>().map(diverge); |
| 45 | + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- |
| 46 | + | | |
| 47 | + | help: try this: `if let Ok(a) = "12".parse::<i32>() { diverge(a) }` |
| 48 | + |
| 49 | +error: called `map(f)` on an `Result` value where `f` is a function that returns the unit type |
| 50 | + --> $DIR/result_map_unit_fn_unfixable.rs:43:5 |
| 51 | + | |
| 52 | +LL | y.map(do_nothing); |
| 53 | + | ^^^^^^^^^^^^^^^^^- |
| 54 | + | | |
| 55 | + | help: try this: `if let Ok(_y) = y { do_nothing(_y) }` |
24 | 56 |
|
25 |
| -error: aborting due to 4 previous errors |
| 57 | +error: aborting due to 6 previous errors |
26 | 58 |
|
27 |
| -For more information about this error, try `rustc --explain E0425`. |
|
0 commit comments