mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-04 20:54:13 +00:00
91d8a804d3
Result<T, E> has an `ok()` method that adapts a Result<T,E> into an Option<T>. It's possible to get around this adapter by writing Result<T,E>.map_or(None, Some). This lint is implemented as a new variant of the existing [`option_map_none` lint](https://github.com/rust-lang/rust-clippy/pull/2128)
11 lines
405 B
Plaintext
11 lines
405 B
Plaintext
error: called `map_or(None, Some)` on a `Result` value. This can be done more directly by calling `ok()` instead
|
|
--> $DIR/result_map_or_into_option.rs:7:13
|
|
|
|
|
LL | let _ = opt.map_or(None, Some);
|
|
| ^^^^^^^^^^^^^^^^^^^^^^ help: try using `ok` instead: `opt.ok()`
|
|
|
|
|
= note: `-D clippy::result-map-or-into-option` implied by `-D warnings`
|
|
|
|
error: aborting due to previous error
|
|
|