]>
git.proxmox.com Git - rustc.git/blob - src/tools/clippy/tests/ui/result_map_or_into_option.rs
1 #![warn(clippy::result_map_or_into_option)]
4 let opt
: Result
<u32, &str> = Ok(1);
5 let _
= opt
.map_or(None
, Some
);
7 let rewrap
= |s
: u32| -> Option
<u32> { Some(s) }
;
9 // A non-Some `f` arg should not emit the lint
10 let opt
: Result
<u32, &str> = Ok(1);
11 let _
= opt
.map_or(None
, rewrap
);
13 // A non-Some `f` closure where the argument is not used as the
14 // return should not emit the lint
15 let opt
: Result
<u32, &str> = Ok(1);
16 _
= opt
.map_or(None
, |_x
| Some(1));