summaryrefslogtreecommitdiffstats
path: root/src/tools/clippy/tests/ui/result_map_or_into_option.fixed
diff options
context:
space:
mode:
Diffstat (limited to 'src/tools/clippy/tests/ui/result_map_or_into_option.fixed')
-rw-r--r--src/tools/clippy/tests/ui/result_map_or_into_option.fixed7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/tools/clippy/tests/ui/result_map_or_into_option.fixed b/src/tools/clippy/tests/ui/result_map_or_into_option.fixed
index fb2db6cf5..cf42b24b2 100644
--- a/src/tools/clippy/tests/ui/result_map_or_into_option.fixed
+++ b/src/tools/clippy/tests/ui/result_map_or_into_option.fixed
@@ -3,6 +3,12 @@
fn main() {
let opt: Result<u32, &str> = Ok(1);
let _ = opt.ok();
+ //~^ ERROR: called `map_or(None, Some)` on a `Result` value
+ let _ = opt.ok();
+ //~^ ERROR: called `map_or_else(|_| None, Some)` on a `Result` value
+ #[rustfmt::skip]
+ let _ = opt.ok();
+ //~^ ERROR: called `map_or_else(|_| None, Some)` on a `Result` value
let rewrap = |s: u32| -> Option<u32> { Some(s) };
@@ -14,4 +20,5 @@ fn main() {
// return should not emit the lint
let opt: Result<u32, &str> = Ok(1);
_ = opt.map_or(None, |_x| Some(1));
+ let _ = opt.map_or_else(|a| a.parse::<u32>().ok(), Some);
}