mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-26 22:50:56 +00:00
add test case for result_map_or_into_option
This commit is contained in:
parent
2776076efa
commit
abb7155387
1 changed files with 4 additions and 0 deletions
|
@ -4,6 +4,7 @@
|
|||
|
||||
fn main() {
|
||||
let opt = Some(1);
|
||||
let r: Result<i32, i32> = Ok(1);
|
||||
let bar = |_| Some(1);
|
||||
|
||||
// Check `OPTION_MAP_OR_NONE`.
|
||||
|
@ -21,4 +22,7 @@ fn main() {
|
|||
let height = x;
|
||||
Some(offset + height)
|
||||
});
|
||||
|
||||
// Check `RESULT_MAP_OR_INTO_OPTION`.
|
||||
let _: Option<i32> = r.map_or(None, Some);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue