Skip to content

Commit abb7155

Browse files
committed
add test case for result_map_or_into_option
1 parent 2776076 commit abb7155

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

tests/ui/option_map_or_none.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
fn main() {
66
let opt = Some(1);
7+
let r: Result<i32, i32> = Ok(1);
78
let bar = |_| Some(1);
89

910
// Check `OPTION_MAP_OR_NONE`.
@@ -21,4 +22,7 @@ fn main() {
2122
let height = x;
2223
Some(offset + height)
2324
});
25+
26+
// Check `RESULT_MAP_OR_INTO_OPTION`.
27+
let _: Option<i32> = r.map_or(None, Some);
2428
}

0 commit comments

Comments
 (0)