mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-12-24 12:03:28 +00:00
35 lines
1.4 KiB
Text
35 lines
1.4 KiB
Text
error: unused "map closure" when calling `Result::map_or_else` value
|
|
--> tests/ui/unnecessary_result_map_or_else.rs:6:5
|
|
|
|
|
LL | x.map_or_else(|err| err, |n| n);
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `unwrap_or_else`: `x.unwrap_or_else(|err| err)`
|
|
|
|
|
= note: `-D clippy::unnecessary-result-map-or-else` implied by `-D warnings`
|
|
= help: to override `-D warnings` add `#[allow(clippy::unnecessary_result_map_or_else)]`
|
|
|
|
error: unused "map closure" when calling `Result::map_or_else` value
|
|
--> tests/ui/unnecessary_result_map_or_else.rs:10:5
|
|
|
|
|
LL | x.map_or_else(|err: ()| err, |n: ()| n);
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `unwrap_or_else`: `x.unwrap_or_else(|err: ()| err)`
|
|
|
|
error: unused "map closure" when calling `Result::map_or_else` value
|
|
--> tests/ui/unnecessary_result_map_or_else.rs:15:19
|
|
|
|
|
LL | let y: &str = x.map_or_else(|err| err, |n| n);
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `unwrap_or_else`: `x.unwrap_or_else(|err| err)`
|
|
|
|
error: unused "map closure" when calling `Result::map_or_else` value
|
|
--> tests/ui/unnecessary_result_map_or_else.rs:19:5
|
|
|
|
|
LL | / x.map_or_else(
|
|
LL | |
|
|
LL | | |err| err,
|
|
LL | | |n| {
|
|
... |
|
|
LL | | },
|
|
LL | | );
|
|
| |_____^ help: consider using `unwrap_or_else`: `x.unwrap_or_else(|err| err)`
|
|
|
|
error: aborting due to 4 previous errors
|
|
|