2023-11-23 06:30:36 -06:00
|
|
|
error: called `map_or(None, ..)` on an `Option` value
|
2023-08-24 14:32:12 -05:00
|
|
|
--> $DIR/option_map_or_none.rs:10:26
|
2019-04-18 01:12:59 -05:00
|
|
|
|
|
2021-12-06 05:33:31 -06:00
|
|
|
LL | let _: Option<i32> = opt.map_or(None, |x| Some(x + 1));
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using `map` instead: `opt.map(|x| x + 1)`
|
2019-04-18 01:12:59 -05:00
|
|
|
|
|
|
|
|
= note: `-D clippy::option-map-or-none` implied by `-D warnings`
|
2023-08-01 07:02:21 -05:00
|
|
|
= help: to override `-D warnings` add `#[allow(clippy::option_map_or_none)]`
|
2019-04-18 01:12:59 -05:00
|
|
|
|
2023-11-23 06:30:36 -06:00
|
|
|
error: called `map_or(None, ..)` on an `Option` value
|
2023-08-24 14:32:12 -05:00
|
|
|
--> $DIR/option_map_or_none.rs:13:26
|
2019-04-18 01:12:59 -05:00
|
|
|
|
|
2021-12-06 05:33:31 -06:00
|
|
|
LL | let _: Option<i32> = opt.map_or(None, |x| {
|
|
|
|
| __________________________^
|
2019-04-18 01:12:59 -05:00
|
|
|
LL | | Some(x + 1)
|
|
|
|
LL | | });
|
2021-12-06 05:33:31 -06:00
|
|
|
| |_________________________^ help: try using `map` instead: `opt.map(|x| x + 1)`
|
|
|
|
|
2023-11-23 06:30:36 -06:00
|
|
|
error: called `map_or(None, ..)` on an `Option` value
|
2023-08-24 14:32:12 -05:00
|
|
|
--> $DIR/option_map_or_none.rs:17:26
|
2021-12-06 05:33:31 -06:00
|
|
|
|
|
|
|
|
LL | let _: Option<i32> = opt.map_or(None, bar);
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^ help: try using `and_then` instead: `opt.and_then(bar)`
|
|
|
|
|
2023-11-23 06:30:36 -06:00
|
|
|
error: called `map_or(None, ..)` on an `Option` value
|
2023-08-24 14:32:12 -05:00
|
|
|
--> $DIR/option_map_or_none.rs:18:26
|
2021-12-06 05:33:31 -06:00
|
|
|
|
|
|
|
|
LL | let _: Option<i32> = opt.map_or(None, |x| {
|
|
|
|
| __________________________^
|
|
|
|
LL | | let offset = 0;
|
|
|
|
LL | | let height = x;
|
|
|
|
LL | | Some(offset + height)
|
|
|
|
LL | | });
|
|
|
|
| |______^
|
2019-10-26 14:53:42 -05:00
|
|
|
|
|
2020-01-06 00:36:33 -06:00
|
|
|
help: try using `and_then` instead
|
2019-04-18 01:12:59 -05:00
|
|
|
|
|
2021-12-06 05:33:31 -06:00
|
|
|
LL ~ let _: Option<i32> = opt.and_then(|x| {
|
|
|
|
LL + let offset = 0;
|
|
|
|
LL + let height = x;
|
|
|
|
LL + Some(offset + height)
|
|
|
|
LL ~ });
|
|
|
|
|
|
|
|
|
|
2023-11-23 06:30:36 -06:00
|
|
|
error: called `map_or(None, Some)` on a `Result` value
|
2023-08-24 14:32:12 -05:00
|
|
|
--> $DIR/option_map_or_none.rs:25:26
|
2021-12-06 05:33:31 -06:00
|
|
|
|
|
|
|
|
LL | let _: Option<i32> = r.map_or(None, Some);
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^ help: try using `ok` instead: `r.ok()`
|
2019-04-18 01:12:59 -05:00
|
|
|
|
|
2021-12-06 05:33:31 -06:00
|
|
|
= note: `-D clippy::result-map-or-into-option` implied by `-D warnings`
|
2023-08-01 07:02:21 -05:00
|
|
|
= help: to override `-D warnings` add `#[allow(clippy::result_map_or_into_option)]`
|
2019-04-18 01:12:59 -05:00
|
|
|
|
2021-12-06 05:33:31 -06:00
|
|
|
error: aborting due to 5 previous errors
|
2019-04-18 01:12:59 -05:00
|
|
|
|