rust-clippy/tests/ui/unnecessary_result_map_or_else.stderr
2024-01-23 16:12:56 +01:00

35 lines
1.4 KiB
Text

error: unused "map closure" when calling `Result::map_or_else` value
--> $DIR/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
--> $DIR/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
--> $DIR/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
--> $DIR/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