blob: 9f80ec1bbbd0756a83d595d70f8d746d4c9f7ed1 [file] [log] [blame]
error: called `map(f)` on an `Result` value where `f` is a closure that returns the unit type `()`
--> tests/ui/result_map_unit_fn_unfixable.rs:24:5
|
LL | x.field.map(|value| { do_nothing(value); do_nothing(value) });
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: `-D clippy::result-map-unit-fn` implied by `-D warnings`
= help: to override `-D warnings` add `#[allow(clippy::result_map_unit_fn)]`
help: use `if let` instead
|
LL - x.field.map(|value| { do_nothing(value); do_nothing(value) });
LL + if let Ok(value) = x.field { ... }
|
error: called `map(f)` on an `Result` value where `f` is a closure that returns the unit type `()`
--> tests/ui/result_map_unit_fn_unfixable.rs:29:5
|
LL | x.field.map(|value| if value > 0 { do_nothing(value); do_nothing(value) });
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
help: use `if let` instead
|
LL - x.field.map(|value| if value > 0 { do_nothing(value); do_nothing(value) });
LL + if let Ok(value) = x.field { ... }
|
error: called `map(f)` on an `Result` value where `f` is a closure that returns the unit type `()`
--> tests/ui/result_map_unit_fn_unfixable.rs:35:5
|
LL | / x.field.map(|value| {
LL | |
LL | |
LL | | do_nothing(value);
LL | | do_nothing(value)
LL | | });
| |______^
|
help: use `if let` instead
|
LL - x.field.map(|value| {
LL -
LL -
LL - do_nothing(value);
LL - do_nothing(value)
LL - });
LL + if let Ok(value) = x.field { ... }
|
error: called `map(f)` on an `Result` value where `f` is a closure that returns the unit type `()`
--> tests/ui/result_map_unit_fn_unfixable.rs:41:5
|
LL | x.field.map(|value| { do_nothing(value); do_nothing(value); });
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
help: use `if let` instead
|
LL - x.field.map(|value| { do_nothing(value); do_nothing(value); });
LL + if let Ok(value) = x.field { ... }
|
error: called `map(f)` on an `Result` value where `f` is a function that returns the unit type `()`
--> tests/ui/result_map_unit_fn_unfixable.rs:47:5
|
LL | "12".parse::<i32>().map(diverge);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
help: use `if let` instead
|
LL - "12".parse::<i32>().map(diverge);
LL + if let Ok(a) = "12".parse::<i32>() { diverge(a) }
|
error: called `map(f)` on an `Result` value where `f` is a function that returns the unit type `()`
--> tests/ui/result_map_unit_fn_unfixable.rs:55:5
|
LL | y.map(do_nothing);
| ^^^^^^^^^^^^^^^^^
|
help: use `if let` instead
|
LL - y.map(do_nothing);
LL + if let Ok(_y) = y { do_nothing(_y) }
|
error: aborting due to 6 previous errors