1 // aux-build:option_helpers.rs
3 //! Checks implementation of `RESULT_MAP_UNWRAP_OR_ELSE`
5 #![warn(clippy::result_map_unwrap_or_else)]
8 extern crate option_helpers;
11 let res: Result<i32, ()> = Ok(1);
13 // Check RESULT_MAP_UNWRAP_OR_ELSE
15 let _ = res.map(|x| x + 1).unwrap_or_else(|e| 0); // should lint even though this call is on a separate line
17 let _ = res.map(|x| x + 1).unwrap_or_else(|e| 0);
18 let _ = res.map(|x| x + 1).unwrap_or_else(|e| 0);
20 let _ = opt_map!(res, |x| x + 1).unwrap_or_else(|e| 0); // should not lint