result_map_or_into_option: add opt.map_or(None, |_| Some(y)) test

This commit is contained in:
Nick Torres 2020-04-04 14:02:45 -07:00
parent d0738bd673
commit fb276dc3fa
2 changed files with 10 additions and 0 deletions

View File

@ -11,4 +11,9 @@ fn main() {
// A non-Some `f` arg should not emit the lint
let opt: Result<u32, &str> = Ok(1);
let _ = opt.map_or(None, rewrap);
// A non-Some `f` closure where the argument is not used as the
// return should not emit the lint
let opt: Result<u32, &str> = Ok(1);
opt.map_or(None, |_x| Some(1));
}

View File

@ -11,4 +11,9 @@ fn main() {
// A non-Some `f` arg should not emit the lint
let opt: Result<u32, &str> = Ok(1);
let _ = opt.map_or(None, rewrap);
// A non-Some `f` closure where the argument is not used as the
// return should not emit the lint
let opt: Result<u32, &str> = Ok(1);
opt.map_or(None, |_x| Some(1));
}