rust/tests/ui/option_map_unit_fn.stderr

211 lines
8.1 KiB
Plaintext
Raw Normal View History

2018-04-09 08:20:46 +02:00
error: called `map(f)` on an Option value where `f` is a unit function
--> $DIR/option_map_unit_fn.rs:32:5
2018-04-09 08:20:46 +02:00
|
2018-12-27 16:57:55 +01:00
LL | x.field.map(do_nothing);
2018-04-09 08:20:46 +02:00
| ^^^^^^^^^^^^^^^^^^^^^^^-
| |
| help: try this: `if let Some(x_field) = x.field { do_nothing(...) }`
2018-04-09 08:20:46 +02:00
|
= note: `-D clippy::option-map-unit-fn` implied by `-D warnings`
2018-04-09 08:20:46 +02:00
error: called `map(f)` on an Option value where `f` is a unit function
--> $DIR/option_map_unit_fn.rs:34:5
2018-04-09 08:20:46 +02:00
|
2018-12-27 16:57:55 +01:00
LL | x.field.map(do_nothing);
2018-04-09 08:20:46 +02:00
| ^^^^^^^^^^^^^^^^^^^^^^^-
| |
| help: try this: `if let Some(x_field) = x.field { do_nothing(...) }`
2018-04-09 08:20:46 +02:00
error: called `map(f)` on an Option value where `f` is a unit function
--> $DIR/option_map_unit_fn.rs:36:5
2018-04-09 08:20:46 +02:00
|
2018-12-27 16:57:55 +01:00
LL | x.field.map(diverge);
2018-04-09 08:20:46 +02:00
| ^^^^^^^^^^^^^^^^^^^^-
| |
| help: try this: `if let Some(x_field) = x.field { diverge(...) }`
2018-04-09 08:20:46 +02:00
error: called `map(f)` on an Option value where `f` is a unit closure
--> $DIR/option_map_unit_fn.rs:42:5
2018-04-09 08:20:46 +02:00
|
2018-12-27 16:57:55 +01:00
LL | x.field.map(|value| x.do_option_nothing(value + captured));
2018-04-09 08:20:46 +02:00
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
| |
| 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:44:5
2018-04-09 08:20:46 +02:00
|
2018-12-27 16:57:55 +01:00
LL | 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); }`
2018-04-09 08:20:46 +02:00
error: called `map(f)` on an Option value where `f` is a unit closure
--> $DIR/option_map_unit_fn.rs:47:5
2018-04-09 08:20:46 +02:00
|
2018-12-27 16:57:55 +01:00
LL | x.field.map(|value| do_nothing(value + captured));
2018-04-09 08:20:46 +02:00
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
| |
| 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:49:5
2018-04-09 08:20:46 +02:00
|
2018-12-27 16:57:55 +01:00
LL | x.field.map(|value| { do_nothing(value + captured) });
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
2018-04-09 08:20:46 +02:00
| |
| 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:51:5
2018-04-09 08:20:46 +02:00
|
2018-12-27 16:57:55 +01:00
LL | x.field.map(|value| { do_nothing(value + captured); });
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
| |
| help: try this: `if let Some(value) = x.field { do_nothing(value + captured); }`
2018-04-09 08:20:46 +02:00
error: called `map(f)` on an Option value where `f` is a unit closure
--> $DIR/option_map_unit_fn.rs:53:5
2018-04-09 08:20:46 +02:00
|
2018-12-27 16:57:55 +01:00
LL | x.field.map(|value| { { do_nothing(value + captured); } });
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
| |
| help: try this: `if let Some(value) = x.field { do_nothing(value + captured); }`
2018-04-09 08:20:46 +02:00
error: called `map(f)` on an Option value where `f` is a unit closure
--> $DIR/option_map_unit_fn.rs:56:5
2018-04-09 08:20:46 +02:00
|
2018-12-27 16:57:55 +01:00
LL | x.field.map(|value| diverge(value + captured));
2018-04-09 08:20:46 +02:00
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
| |
| 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:58:5
2018-04-09 08:20:46 +02:00
|
2018-12-27 16:57:55 +01:00
LL | x.field.map(|value| { diverge(value + captured) });
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
2018-04-09 08:20:46 +02:00
| |
| 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:60:5
2018-04-09 08:20:46 +02:00
|
2018-12-27 16:57:55 +01:00
LL | x.field.map(|value| { diverge(value + captured); });
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
| |
| help: try this: `if let Some(value) = x.field { diverge(value + captured); }`
2018-04-09 08:20:46 +02:00
error: called `map(f)` on an Option value where `f` is a unit closure
--> $DIR/option_map_unit_fn.rs:62:5
2018-04-09 08:20:46 +02:00
|
2018-12-27 16:57:55 +01:00
LL | x.field.map(|value| { { diverge(value + captured); } });
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
| |
| help: try this: `if let Some(value) = x.field { diverge(value + captured); }`
2018-04-09 08:20:46 +02:00
error: called `map(f)` on an Option value where `f` is a unit closure
--> $DIR/option_map_unit_fn.rs:67:5
2018-04-09 08:20:46 +02:00
|
2018-12-27 16:57:55 +01:00
LL | 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); }`
2018-04-09 08:20:46 +02:00
error: called `map(f)` on an Option value where `f` is a unit closure
--> $DIR/option_map_unit_fn.rs:69:5
2018-04-09 08:20:46 +02:00
|
2018-12-27 16:57:55 +01:00
LL | x.field.map(|value| { plus_one(value + captured); });
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
| |
| help: try this: `if let Some(value) = x.field { plus_one(value + captured); }`
2018-04-09 08:20:46 +02:00
error: called `map(f)` on an Option value where `f` is a unit closure
--> $DIR/option_map_unit_fn.rs:71:5
2018-04-09 08:20:46 +02:00
|
2018-12-27 16:57:55 +01:00
LL | x.field.map(|value| { { plus_one(value + captured); } });
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
| |
| help: try this: `if let Some(value) = x.field { plus_one(value + captured); }`
2018-04-09 08:20:46 +02:00
error: called `map(f)` on an Option value where `f` is a unit closure
--> $DIR/option_map_unit_fn.rs:74:5
2018-04-09 08:20:46 +02:00
|
2018-12-27 16:57:55 +01:00
LL | x.field.map(|ref value| { do_nothing(value + captured) });
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
2018-04-09 08:20:46 +02:00
| |
| 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:77:5
|
2018-12-27 16:57:55 +01:00
LL | x.field.map(|value| { do_nothing(value); do_nothing(value) });
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
| |
| help: try this: `if let Some(value) = x.field { ... }`
2018-04-09 08:20:46 +02:00
error: called `map(f)` on an Option value where `f` is a unit closure
--> $DIR/option_map_unit_fn.rs:79:5
|
2018-12-27 16:57:55 +01:00
LL | x.field.map(|value| if value > 0 { do_nothing(value); do_nothing(value) });
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
| |
| help: try this: `if let Some(value) = x.field { ... }`
2018-04-09 08:20:46 +02:00
error: called `map(f)` on an Option value where `f` is a unit closure
--> $DIR/option_map_unit_fn.rs:83:5
|
2018-12-27 16:57:55 +01:00
LL | x.field.map(|value| {
| _____^
| |_____|
| ||
2018-12-27 16:57:55 +01:00
LL | || do_nothing(value);
LL | || do_nothing(value)
LL | || });
| ||______^- 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:87:5
|
2018-12-27 16:57:55 +01:00
LL | 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:90:5
|
2018-12-27 16:57:55 +01:00
LL | 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:91:5
2018-12-27 16:57:55 +01:00
|
LL | "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:92:5
2018-12-27 16:57:55 +01:00
|
LL | 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:96:5
2018-12-27 16:57:55 +01:00
|
LL | y.map(do_nothing);
| ^^^^^^^^^^^^^^^^^-
| |
| help: try this: `if let Some(_y) = y { do_nothing(...) }`
error: aborting due to 25 previous errors
2018-04-09 08:20:46 +02:00