]>
Commit | Line | Data |
---|---|---|
f20569fa XL |
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 | | | |
4 | LL | x.field.map(|value| { do_nothing(value); do_nothing(value) }); | |
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` | |
10 | ||
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 | |
13 | | | |
14 | LL | x.field.map(|value| if value > 0 { do_nothing(value); do_nothing(value) }); | |
15 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- | |
16 | | | | |
17 | | help: try this: `if let Ok(value) = x.field { ... }` | |
18 | ||
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 | |
21 | | | |
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 | | | |
32 | ||
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 | |
35 | | | |
36 | LL | x.field.map(|value| { do_nothing(value); do_nothing(value); }); | |
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) }` | |
56 | ||
57 | error: aborting due to 6 previous errors | |
58 |