mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-30 16:39:26 +00:00
210 lines
8.1 KiB
Text
210 lines
8.1 KiB
Text
error: called `map(f)` on an Option value where `f` is a unit function
|
|
--> $DIR/option_map_unit_fn.rs:44:5
|
|
|
|
|
44 | x.field.map(do_nothing);
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^-
|
|
| |
|
|
| help: try this: `if let Some(x_field) = x.field { do_nothing(...) }`
|
|
|
|
|
= note: `-D clippy::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:46:5
|
|
|
|
|
46 | x.field.map(do_nothing);
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^-
|
|
| |
|
|
| help: try this: `if let Some(x_field) = x.field { do_nothing(...) }`
|
|
|
|
error: called `map(f)` on an Option value where `f` is a unit function
|
|
--> $DIR/option_map_unit_fn.rs:48:5
|
|
|
|
|
48 | x.field.map(diverge);
|
|
| ^^^^^^^^^^^^^^^^^^^^-
|
|
| |
|
|
| help: try this: `if let Some(x_field) = x.field { diverge(...) }`
|
|
|
|
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| 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:56:5
|
|
|
|
|
56 | 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:59:5
|
|
|
|
|
59 | 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:61:5
|
|
|
|
|
61 | 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:63:5
|
|
|
|
|
63 | 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:65:5
|
|
|
|
|
65 | 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:68:5
|
|
|
|
|
68 | 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:70:5
|
|
|
|
|
70 | 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:72:5
|
|
|
|
|
72 | 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:74:5
|
|
|
|
|
74 | 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:79:5
|
|
|
|
|
79 | 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:81:5
|
|
|
|
|
81 | 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:83:5
|
|
|
|
|
83 | 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:86:5
|
|
|
|
|
86 | 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:89:5
|
|
|
|
|
89 | 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:91:5
|
|
|
|
|
91 | x.field.map(|value| if value > 0 { 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:95:5
|
|
|
|
|
95 | x.field.map(|value| {
|
|
| _____^
|
|
| |_____|
|
|
| ||
|
|
96 | || do_nothing(value);
|
|
97 | || do_nothing(value)
|
|
98 | || });
|
|
| ||______^- 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:99:5
|
|
|
|
|
99 | 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 function
|
|
--> $DIR/option_map_unit_fn.rs:102:5
|
|
|
|
|
102 | Some(42).map(diverge);
|
|
| ^^^^^^^^^^^^^^^^^^^^^-
|
|
| |
|
|
| help: try this: `if let Some(_) = Some(42) { diverge(...) }`
|
|
|
|
error: called `map(f)` on an Option value where `f` is a unit function
|
|
--> $DIR/option_map_unit_fn.rs:103:5
|
|
|
|
|
103 | "12".parse::<i32>().ok().map(diverge);
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
|
|
| |
|
|
| help: try this: `if let Some(_) = "12".parse::<i32>().ok() { diverge(...) }`
|
|
|
|
error: called `map(f)` on an Option value where `f` is a unit function
|
|
--> $DIR/option_map_unit_fn.rs:104:5
|
|
|
|
|
104 | Some(plus_one(1)).map(do_nothing);
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
|
|
| |
|
|
| help: try this: `if let Some(_) = Some(plus_one(1)) { do_nothing(...) }`
|
|
|
|
error: called `map(f)` on an Option value where `f` is a unit function
|
|
--> $DIR/option_map_unit_fn.rs:108:5
|
|
|
|
|
108 | y.map(do_nothing);
|
|
| ^^^^^^^^^^^^^^^^^-
|
|
| |
|
|
| help: try this: `if let Some(_y) = y { do_nothing(...) }`
|
|
|
|
error: aborting due to 25 previous errors
|
|
|