mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-15 01:17:16 +00:00
194 lines
7.5 KiB
Text
194 lines
7.5 KiB
Text
error: called `map(f)` on an Result value where `f` is a unit function
|
|
--> $DIR/result_map_unit_fn.rs:35:5
|
|
|
|
|
35 | x.field.map(do_nothing);
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^-
|
|
| |
|
|
| help: try this: `if let Ok(x_field) = x.field { do_nothing(...) }`
|
|
|
|
|
= note: `-D clippy::result-map-unit-fn` implied by `-D warnings`
|
|
|
|
error: called `map(f)` on an Result value where `f` is a unit function
|
|
--> $DIR/result_map_unit_fn.rs:37:5
|
|
|
|
|
37 | x.field.map(do_nothing);
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^-
|
|
| |
|
|
| help: try this: `if let Ok(x_field) = x.field { do_nothing(...) }`
|
|
|
|
error: called `map(f)` on an Result value where `f` is a unit function
|
|
--> $DIR/result_map_unit_fn.rs:39:5
|
|
|
|
|
39 | x.field.map(diverge);
|
|
| ^^^^^^^^^^^^^^^^^^^^-
|
|
| |
|
|
| help: try this: `if let Ok(x_field) = x.field { diverge(...) }`
|
|
|
|
error: called `map(f)` on an Result value where `f` is a unit closure
|
|
--> $DIR/result_map_unit_fn.rs:45:5
|
|
|
|
|
45 | x.field.map(|value| x.do_result_nothing(value + captured));
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
|
|
| |
|
|
| help: try this: `if let Ok(value) = x.field { x.do_result_nothing(value + captured) }`
|
|
|
|
error: called `map(f)` on an Result value where `f` is a unit closure
|
|
--> $DIR/result_map_unit_fn.rs:47:5
|
|
|
|
|
47 | x.field.map(|value| { x.do_result_plus_one(value + captured); });
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
|
|
| |
|
|
| help: try this: `if let Ok(value) = x.field { x.do_result_plus_one(value + captured); }`
|
|
|
|
error: called `map(f)` on an Result value where `f` is a unit closure
|
|
--> $DIR/result_map_unit_fn.rs:50:5
|
|
|
|
|
50 | x.field.map(|value| do_nothing(value + captured));
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
|
|
| |
|
|
| help: try this: `if let Ok(value) = x.field { do_nothing(value + captured) }`
|
|
|
|
error: called `map(f)` on an Result value where `f` is a unit closure
|
|
--> $DIR/result_map_unit_fn.rs:52:5
|
|
|
|
|
52 | x.field.map(|value| { do_nothing(value + captured) });
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
|
|
| |
|
|
| help: try this: `if let Ok(value) = x.field { do_nothing(value + captured) }`
|
|
|
|
error: called `map(f)` on an Result value where `f` is a unit closure
|
|
--> $DIR/result_map_unit_fn.rs:54:5
|
|
|
|
|
54 | x.field.map(|value| { do_nothing(value + captured); });
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
|
|
| |
|
|
| help: try this: `if let Ok(value) = x.field { do_nothing(value + captured); }`
|
|
|
|
error: called `map(f)` on an Result value where `f` is a unit closure
|
|
--> $DIR/result_map_unit_fn.rs:56:5
|
|
|
|
|
56 | x.field.map(|value| { { do_nothing(value + captured); } });
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
|
|
| |
|
|
| help: try this: `if let Ok(value) = x.field { do_nothing(value + captured); }`
|
|
|
|
error: called `map(f)` on an Result value where `f` is a unit closure
|
|
--> $DIR/result_map_unit_fn.rs:59:5
|
|
|
|
|
59 | x.field.map(|value| diverge(value + captured));
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
|
|
| |
|
|
| help: try this: `if let Ok(value) = x.field { diverge(value + captured) }`
|
|
|
|
error: called `map(f)` on an Result value where `f` is a unit closure
|
|
--> $DIR/result_map_unit_fn.rs:61:5
|
|
|
|
|
61 | x.field.map(|value| { diverge(value + captured) });
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
|
|
| |
|
|
| help: try this: `if let Ok(value) = x.field { diverge(value + captured) }`
|
|
|
|
error: called `map(f)` on an Result value where `f` is a unit closure
|
|
--> $DIR/result_map_unit_fn.rs:63:5
|
|
|
|
|
63 | x.field.map(|value| { diverge(value + captured); });
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
|
|
| |
|
|
| help: try this: `if let Ok(value) = x.field { diverge(value + captured); }`
|
|
|
|
error: called `map(f)` on an Result value where `f` is a unit closure
|
|
--> $DIR/result_map_unit_fn.rs:65:5
|
|
|
|
|
65 | x.field.map(|value| { { diverge(value + captured); } });
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
|
|
| |
|
|
| help: try this: `if let Ok(value) = x.field { diverge(value + captured); }`
|
|
|
|
error: called `map(f)` on an Result value where `f` is a unit closure
|
|
--> $DIR/result_map_unit_fn.rs:70:5
|
|
|
|
|
70 | x.field.map(|value| { let y = plus_one(value + captured); });
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
|
|
| |
|
|
| help: try this: `if let Ok(value) = x.field { let y = plus_one(value + captured); }`
|
|
|
|
error: called `map(f)` on an Result value where `f` is a unit closure
|
|
--> $DIR/result_map_unit_fn.rs:72:5
|
|
|
|
|
72 | x.field.map(|value| { plus_one(value + captured); });
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
|
|
| |
|
|
| help: try this: `if let Ok(value) = x.field { plus_one(value + captured); }`
|
|
|
|
error: called `map(f)` on an Result value where `f` is a unit closure
|
|
--> $DIR/result_map_unit_fn.rs:74:5
|
|
|
|
|
74 | x.field.map(|value| { { plus_one(value + captured); } });
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
|
|
| |
|
|
| help: try this: `if let Ok(value) = x.field { plus_one(value + captured); }`
|
|
|
|
error: called `map(f)` on an Result value where `f` is a unit closure
|
|
--> $DIR/result_map_unit_fn.rs:77:5
|
|
|
|
|
77 | x.field.map(|ref value| { do_nothing(value + captured) });
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
|
|
| |
|
|
| help: try this: `if let Ok(ref value) = x.field { do_nothing(value + captured) }`
|
|
|
|
error: called `map(f)` on an Result value where `f` is a unit closure
|
|
--> $DIR/result_map_unit_fn.rs:80:5
|
|
|
|
|
80 | x.field.map(|value| { do_nothing(value); do_nothing(value) });
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
|
|
| |
|
|
| help: try this: `if let Ok(value) = x.field { ... }`
|
|
|
|
error: called `map(f)` on an Result value where `f` is a unit closure
|
|
--> $DIR/result_map_unit_fn.rs:82:5
|
|
|
|
|
82 | x.field.map(|value| if value > 0 { do_nothing(value); do_nothing(value) });
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
|
|
| |
|
|
| help: try this: `if let Ok(value) = x.field { ... }`
|
|
|
|
error: called `map(f)` on an Result value where `f` is a unit closure
|
|
--> $DIR/result_map_unit_fn.rs:86:5
|
|
|
|
|
86 | x.field.map(|value| {
|
|
| _____^
|
|
| |_____|
|
|
| ||
|
|
87 | || do_nothing(value);
|
|
88 | || do_nothing(value)
|
|
89 | || });
|
|
| ||______^- help: try this: `if let Ok(value) = x.field { ... }`
|
|
| |_______|
|
|
|
|
|
|
|
error: called `map(f)` on an Result value where `f` is a unit closure
|
|
--> $DIR/result_map_unit_fn.rs:90:5
|
|
|
|
|
90 | x.field.map(|value| { do_nothing(value); do_nothing(value); });
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
|
|
| |
|
|
| help: try this: `if let Ok(value) = x.field { ... }`
|
|
|
|
error: called `map(f)` on an Result value where `f` is a unit function
|
|
--> $DIR/result_map_unit_fn.rs:94:5
|
|
|
|
|
94 | "12".parse::<i32>().map(diverge);
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
|
|
| |
|
|
| help: try this: `if let Ok(_) = "12".parse::<i32>() { diverge(...) }`
|
|
|
|
error: called `map(f)` on an Result value where `f` is a unit function
|
|
--> $DIR/result_map_unit_fn.rs:100:5
|
|
|
|
|
100 | y.map(do_nothing);
|
|
| ^^^^^^^^^^^^^^^^^-
|
|
| |
|
|
| help: try this: `if let Ok(_y) = y { do_nothing(...) }`
|
|
|
|
error: aborting due to 23 previous errors
|
|
|