2020-09-10 15:47:07 +00:00
|
|
|
error: called `map(f)` on an `Result` value where `f` is a closure that returns the unit type `()`
|
2024-02-27 14:25:18 +00:00
|
|
|
--> tests/ui/result_map_unit_fn_unfixable.rs:23:5
|
2019-09-25 15:48:09 +00:00
|
|
|
|
|
|
|
|
LL | x.field.map(|value| { do_nothing(value); do_nothing(value) });
|
2020-04-13 13:26:53 +00:00
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
|
|
|
|
| |
|
2023-07-17 08:19:29 +00:00
|
|
|
| help: try: `if let Ok(value) = x.field { ... }`
|
2020-04-13 13:26:53 +00:00
|
|
|
|
|
|
|
|
= note: `-D clippy::result-map-unit-fn` implied by `-D warnings`
|
2023-08-01 12:02:21 +00:00
|
|
|
= help: to override `-D warnings` add `#[allow(clippy::result_map_unit_fn)]`
|
2019-09-25 15:48:09 +00:00
|
|
|
|
2020-09-10 15:47:07 +00:00
|
|
|
error: called `map(f)` on an `Result` value where `f` is a closure that returns the unit type `()`
|
2024-02-27 14:25:18 +00:00
|
|
|
--> tests/ui/result_map_unit_fn_unfixable.rs:27:5
|
2019-09-25 15:48:09 +00:00
|
|
|
|
|
|
|
|
LL | x.field.map(|value| if value > 0 { do_nothing(value); do_nothing(value) });
|
2020-04-13 13:26:53 +00:00
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
|
|
|
|
| |
|
2023-07-17 08:19:29 +00:00
|
|
|
| help: try: `if let Ok(value) = x.field { ... }`
|
2019-09-25 15:48:09 +00:00
|
|
|
|
2020-09-10 15:47:07 +00:00
|
|
|
error: called `map(f)` on an `Result` value where `f` is a closure that returns the unit type `()`
|
2024-02-27 14:25:18 +00:00
|
|
|
--> tests/ui/result_map_unit_fn_unfixable.rs:32:5
|
2019-09-25 15:48:09 +00:00
|
|
|
|
|
2022-12-27 19:03:59 +00:00
|
|
|
LL | // x.field.map(|value| {
|
2023-08-24 19:32:12 +00:00
|
|
|
LL | ||
|
2020-04-13 13:26:53 +00:00
|
|
|
LL | || do_nothing(value);
|
|
|
|
LL | || do_nothing(value)
|
|
|
|
LL | || });
|
2023-07-17 08:19:29 +00:00
|
|
|
| ||______^- help: try: `if let Ok(value) = x.field { ... }`
|
2022-11-28 08:41:31 +00:00
|
|
|
| |______|
|
2024-04-26 10:47:14 +00:00
|
|
|
|
|
2019-09-25 15:48:09 +00:00
|
|
|
|
2020-09-10 15:47:07 +00:00
|
|
|
error: called `map(f)` on an `Result` value where `f` is a closure that returns the unit type `()`
|
2024-02-27 14:25:18 +00:00
|
|
|
--> tests/ui/result_map_unit_fn_unfixable.rs:37:5
|
2019-09-25 15:48:09 +00:00
|
|
|
|
|
|
|
|
LL | x.field.map(|value| { do_nothing(value); do_nothing(value); });
|
2020-04-13 13:26:53 +00:00
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
|
|
|
|
| |
|
2023-07-17 08:19:29 +00:00
|
|
|
| help: try: `if let Ok(value) = x.field { ... }`
|
2020-04-13 13:26:53 +00:00
|
|
|
|
2020-09-10 15:47:07 +00:00
|
|
|
error: called `map(f)` on an `Result` value where `f` is a function that returns the unit type `()`
|
2024-02-27 14:25:18 +00:00
|
|
|
--> tests/ui/result_map_unit_fn_unfixable.rs:42:5
|
2020-04-13 13:26:53 +00:00
|
|
|
|
|
|
|
|
LL | "12".parse::<i32>().map(diverge);
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
|
|
|
|
| |
|
2023-07-17 08:19:29 +00:00
|
|
|
| help: try: `if let Ok(a) = "12".parse::<i32>() { diverge(a) }`
|
2020-04-13 13:26:53 +00:00
|
|
|
|
2020-09-10 15:47:07 +00:00
|
|
|
error: called `map(f)` on an `Result` value where `f` is a function that returns the unit type `()`
|
2024-02-27 14:25:18 +00:00
|
|
|
--> tests/ui/result_map_unit_fn_unfixable.rs:49:5
|
2020-04-13 13:26:53 +00:00
|
|
|
|
|
|
|
|
LL | y.map(do_nothing);
|
|
|
|
| ^^^^^^^^^^^^^^^^^-
|
|
|
|
| |
|
2023-07-17 08:19:29 +00:00
|
|
|
| help: try: `if let Ok(_y) = y { do_nothing(_y) }`
|
2019-09-25 15:48:09 +00:00
|
|
|
|
2020-04-13 13:26:53 +00:00
|
|
|
error: aborting due to 6 previous errors
|
2019-09-25 15:48:09 +00:00
|
|
|
|