mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-12-18 00:53:31 +00:00
57 lines
2.2 KiB
Text
57 lines
2.2 KiB
Text
error: called `map(f)` on an `Result` value where `f` is a closure that returns the unit type `()`
|
|
--> $DIR/result_map_unit_fn_unfixable.rs:23:5
|
|
|
|
|
LL | x.field.map(|value| { do_nothing(value); do_nothing(value) });
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
|
|
| |
|
|
| help: try: `if let Ok(value) = x.field { ... }`
|
|
|
|
|
= note: `-D clippy::result-map-unit-fn` implied by `-D warnings`
|
|
= help: to override `-D warnings` add `#[allow(clippy::result_map_unit_fn)]`
|
|
|
|
error: called `map(f)` on an `Result` value where `f` is a closure that returns the unit type `()`
|
|
--> $DIR/result_map_unit_fn_unfixable.rs:27:5
|
|
|
|
|
LL | x.field.map(|value| if value > 0 { do_nothing(value); do_nothing(value) });
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
|
|
| |
|
|
| help: try: `if let Ok(value) = x.field { ... }`
|
|
|
|
error: called `map(f)` on an `Result` value where `f` is a closure that returns the unit type `()`
|
|
--> $DIR/result_map_unit_fn_unfixable.rs:32:5
|
|
|
|
|
LL | // x.field.map(|value| {
|
|
LL | ||
|
|
LL | || do_nothing(value);
|
|
LL | || do_nothing(value)
|
|
LL | || });
|
|
| ||______^- help: try: `if let Ok(value) = x.field { ... }`
|
|
| |______|
|
|
|
|
|
|
|
error: called `map(f)` on an `Result` value where `f` is a closure that returns the unit type `()`
|
|
--> $DIR/result_map_unit_fn_unfixable.rs:37:5
|
|
|
|
|
LL | x.field.map(|value| { do_nothing(value); do_nothing(value); });
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
|
|
| |
|
|
| help: try: `if let Ok(value) = x.field { ... }`
|
|
|
|
error: called `map(f)` on an `Result` value where `f` is a function that returns the unit type `()`
|
|
--> $DIR/result_map_unit_fn_unfixable.rs:42:5
|
|
|
|
|
LL | "12".parse::<i32>().map(diverge);
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
|
|
| |
|
|
| help: try: `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 `()`
|
|
--> $DIR/result_map_unit_fn_unfixable.rs:49:5
|
|
|
|
|
LL | y.map(do_nothing);
|
|
| ^^^^^^^^^^^^^^^^^-
|
|
| |
|
|
| help: try: `if let Ok(_y) = y { do_nothing(_y) }`
|
|
|
|
error: aborting due to 6 previous errors
|
|
|