2021-11-13 13:38:28 +00:00
|
|
|
error: called `map_or(None, ..)` on an `Option` value. This can be done more directly by calling `map(..)` instead
|
2023-07-27 11:40:22 +00:00
|
|
|
--> $DIR/option_map_or_none.rs:10:26
|
2019-04-18 06:12:59 +00:00
|
|
|
|
|
2021-11-15 17:53:35 +00:00
|
|
|
LL | let _: Option<i32> = opt.map_or(None, |x| Some(x + 1));
|
2021-11-15 17:06:31 +00:00
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using `map` instead: `opt.map(|x| x + 1)`
|
2019-04-18 06:12:59 +00:00
|
|
|
|
|
|
|
|
= note: `-D clippy::option-map-or-none` implied by `-D warnings`
|
|
|
|
|
2021-11-13 13:38:28 +00:00
|
|
|
error: called `map_or(None, ..)` on an `Option` value. This can be done more directly by calling `map(..)` instead
|
2023-07-27 11:40:22 +00:00
|
|
|
--> $DIR/option_map_or_none.rs:13:26
|
2019-04-18 06:12:59 +00:00
|
|
|
|
|
2021-11-15 17:53:35 +00:00
|
|
|
LL | let _: Option<i32> = opt.map_or(None, |x| {
|
2021-11-15 17:06:31 +00:00
|
|
|
| __________________________^
|
2019-04-18 06:12:59 +00:00
|
|
|
LL | | Some(x + 1)
|
|
|
|
LL | | });
|
2021-11-15 17:29:02 +00:00
|
|
|
| |_________________________^ help: try using `map` instead: `opt.map(|x| x + 1)`
|
2019-04-18 06:12:59 +00:00
|
|
|
|
2021-11-15 17:06:31 +00:00
|
|
|
error: called `map_or(None, ..)` on an `Option` value. This can be done more directly by calling `and_then(..)` instead
|
2023-07-27 11:40:22 +00:00
|
|
|
--> $DIR/option_map_or_none.rs:17:26
|
2021-11-15 06:47:57 +00:00
|
|
|
|
|
2021-11-15 17:53:35 +00:00
|
|
|
LL | let _: Option<i32> = opt.map_or(None, bar);
|
2021-11-15 06:47:57 +00:00
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^ help: try using `and_then` instead: `opt.and_then(bar)`
|
|
|
|
|
2021-11-17 15:43:49 +00:00
|
|
|
error: called `map_or(None, ..)` on an `Option` value. This can be done more directly by calling `and_then(..)` instead
|
2023-07-27 11:40:22 +00:00
|
|
|
--> $DIR/option_map_or_none.rs:18:26
|
2021-11-17 15:43:49 +00:00
|
|
|
|
|
|
|
|
LL | let _: Option<i32> = opt.map_or(None, |x| {
|
|
|
|
| __________________________^
|
|
|
|
LL | | let offset = 0;
|
|
|
|
LL | | let height = x;
|
|
|
|
LL | | Some(offset + height)
|
|
|
|
LL | | });
|
|
|
|
| |______^
|
|
|
|
|
|
|
|
|
help: try using `and_then` instead
|
|
|
|
|
|
|
|
|
LL ~ let _: Option<i32> = opt.and_then(|x| {
|
|
|
|
LL + let offset = 0;
|
|
|
|
LL + let height = x;
|
|
|
|
LL + Some(offset + height)
|
|
|
|
LL ~ });
|
|
|
|
|
|
|
|
|
|
2021-11-19 07:17:17 +00:00
|
|
|
error: called `map_or(None, Some)` on a `Result` value. This can be done more directly by calling `ok()` instead
|
2023-07-27 11:40:22 +00:00
|
|
|
--> $DIR/option_map_or_none.rs:25:26
|
2021-11-19 07:17:17 +00:00
|
|
|
|
|
|
|
|
LL | let _: Option<i32> = r.map_or(None, Some);
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^ help: try using `ok` instead: `r.ok()`
|
|
|
|
|
|
|
|
|
= note: `-D clippy::result-map-or-into-option` implied by `-D warnings`
|
|
|
|
|
|
|
|
error: aborting due to 5 previous errors
|
2019-04-18 06:12:59 +00:00
|
|
|
|