mirror of
https://github.com/rust-lang/rust.git
synced 2025-04-13 12:36:47 +00:00
result_map_or_into_option: add opt.map_or(None, |_| Some(y))
test
This commit is contained in:
parent
d0738bd673
commit
fb276dc3fa
@ -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));
|
||||
}
|
||||
|
@ -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));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user