mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-14 08:57:30 +00:00
156 lines
6.3 KiB
Text
156 lines
6.3 KiB
Text
error: called `map(f)` on an Option value where `f` is a unit function
|
|
--> $DIR/option_map_unit_fn.rs:33:5
|
|
|
|
|
33 | x.field.map(do_nothing);
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^-
|
|
| |
|
|
| help: try this: `if let Some(...) = x.field { do_nothing(...) }`
|
|
|
|
|
= note: `-D option-map-unit-fn` implied by `-D warnings`
|
|
|
|
error: called `map(f)` on an Option value where `f` is a unit function
|
|
--> $DIR/option_map_unit_fn.rs:35:5
|
|
|
|
|
35 | x.field.map(do_nothing);
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^-
|
|
| |
|
|
| help: try this: `if let Some(...) = x.field { do_nothing(...) }`
|
|
|
|
error: called `map(f)` on an Option value where `f` is a unit function
|
|
--> $DIR/option_map_unit_fn.rs:37:5
|
|
|
|
|
37 | x.field.map(diverge);
|
|
| ^^^^^^^^^^^^^^^^^^^^-
|
|
| |
|
|
| help: try this: `if let Some(...) = x.field { diverge(...) }`
|
|
|
|
error: called `map(f)` on an Option value where `f` is a unit closure
|
|
--> $DIR/option_map_unit_fn.rs:43:5
|
|
|
|
|
43 | x.field.map(|value| x.do_option_nothing(value + captured));
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
|
|
| |
|
|
| help: try this: `if let Some(value) = x.field { x.do_option_nothing(value + captured) }`
|
|
|
|
error: called `map(f)` on an Option value where `f` is a unit closure
|
|
--> $DIR/option_map_unit_fn.rs:45:5
|
|
|
|
|
45 | x.field.map(|value| { x.do_option_plus_one(value + captured); });
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
|
|
| |
|
|
| help: try this: `if let Some(value) = x.field { x.do_option_plus_one(value + captured); }`
|
|
|
|
error: called `map(f)` on an Option value where `f` is a unit closure
|
|
--> $DIR/option_map_unit_fn.rs:48:5
|
|
|
|
|
48 | x.field.map(|value| do_nothing(value + captured));
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
|
|
| |
|
|
| help: try this: `if let Some(value) = x.field { do_nothing(value + captured) }`
|
|
|
|
error: called `map(f)` on an Option value where `f` is a unit closure
|
|
--> $DIR/option_map_unit_fn.rs:50:5
|
|
|
|
|
50 | x.field.map(|value| { do_nothing(value + captured) });
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
|
|
| |
|
|
| help: try this: `if let Some(value) = x.field { do_nothing(value + captured) }`
|
|
|
|
error: called `map(f)` on an Option value where `f` is a unit closure
|
|
--> $DIR/option_map_unit_fn.rs:52:5
|
|
|
|
|
52 | x.field.map(|value| { do_nothing(value + captured); });
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
|
|
| |
|
|
| help: try this: `if let Some(value) = x.field { do_nothing(value + captured) }`
|
|
|
|
error: called `map(f)` on an Option value where `f` is a unit closure
|
|
--> $DIR/option_map_unit_fn.rs:54:5
|
|
|
|
|
54 | x.field.map(|value| { { do_nothing(value + captured); } });
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
|
|
| |
|
|
| help: try this: `if let Some(value) = x.field { do_nothing(value + captured) }`
|
|
|
|
error: called `map(f)` on an Option value where `f` is a unit closure
|
|
--> $DIR/option_map_unit_fn.rs:57:5
|
|
|
|
|
57 | x.field.map(|value| diverge(value + captured));
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
|
|
| |
|
|
| help: try this: `if let Some(value) = x.field { diverge(value + captured) }`
|
|
|
|
error: called `map(f)` on an Option value where `f` is a unit closure
|
|
--> $DIR/option_map_unit_fn.rs:59:5
|
|
|
|
|
59 | x.field.map(|value| { diverge(value + captured) });
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
|
|
| |
|
|
| help: try this: `if let Some(value) = x.field { diverge(value + captured) }`
|
|
|
|
error: called `map(f)` on an Option value where `f` is a unit closure
|
|
--> $DIR/option_map_unit_fn.rs:61:5
|
|
|
|
|
61 | x.field.map(|value| { diverge(value + captured); });
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
|
|
| |
|
|
| help: try this: `if let Some(value) = x.field { diverge(value + captured) }`
|
|
|
|
error: called `map(f)` on an Option value where `f` is a unit closure
|
|
--> $DIR/option_map_unit_fn.rs:63:5
|
|
|
|
|
63 | x.field.map(|value| { { diverge(value + captured); } });
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
|
|
| |
|
|
| help: try this: `if let Some(value) = x.field { diverge(value + captured) }`
|
|
|
|
error: called `map(f)` on an Option value where `f` is a unit closure
|
|
--> $DIR/option_map_unit_fn.rs:68:5
|
|
|
|
|
68 | x.field.map(|value| { let y = plus_one(value + captured); });
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
|
|
| |
|
|
| help: try this: `if let Some(value) = x.field { let y = plus_one(value + captured); }`
|
|
|
|
error: called `map(f)` on an Option value where `f` is a unit closure
|
|
--> $DIR/option_map_unit_fn.rs:70:5
|
|
|
|
|
70 | x.field.map(|value| { plus_one(value + captured); });
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
|
|
| |
|
|
| help: try this: `if let Some(value) = x.field { plus_one(value + captured); }`
|
|
|
|
error: called `map(f)` on an Option value where `f` is a unit closure
|
|
--> $DIR/option_map_unit_fn.rs:72:5
|
|
|
|
|
72 | x.field.map(|value| { { plus_one(value + captured); } });
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
|
|
| |
|
|
| help: try this: `if let Some(value) = x.field { plus_one(value + captured); }`
|
|
|
|
error: called `map(f)` on an Option value where `f` is a unit closure
|
|
--> $DIR/option_map_unit_fn.rs:75:5
|
|
|
|
|
75 | x.field.map(|ref value| { do_nothing(value + captured) });
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
|
|
| |
|
|
| help: try this: `if let Some(ref value) = x.field { do_nothing(value + captured) }`
|
|
|
|
error: called `map(f)` on an Option value where `f` is a unit closure
|
|
--> $DIR/option_map_unit_fn.rs:78:5
|
|
|
|
|
78 | x.field.map(|value| { do_nothing(value); do_nothing(value) });
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
|
|
| |
|
|
| help: try this: `if let Some(value) = x.field { ... }`
|
|
|
|
error: called `map(f)` on an Option value where `f` is a unit closure
|
|
--> $DIR/option_map_unit_fn.rs:80:5
|
|
|
|
|
80 | x.field.map(|value| if value > 0 { do_nothing(value); do_nothing(value) });
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
|
|
| |
|
|
| help: try this: `if let Some(value) = x.field { ... }`
|
|
|
|
error: aborting due to 19 previous errors
|
|
|