]> git.lizzy.rs Git - rust.git/blob - tests/ui/result_map_or_into_option.rs
d097c19e44b90a3fbb7af3e99d15c02eacd9b263
[rust.git] / tests / ui / result_map_or_into_option.rs
1 // run-rustfix
2
3 #![warn(clippy::result_map_or_into_option)]
4
5 fn main() {
6     let opt: Result<u32, &str> = Ok(1);
7     let _ = opt.map_or(None, Some);
8
9     let rewrap = |s: u32| -> Option<u32> { Some(s) };
10
11     // A non-Some `f` arg should not emit the lint
12     let opt: Result<u32, &str> = Ok(1);
13     let _ = opt.map_or(None, rewrap);
14 }