2 #![warn(clippy::option_if_let_else)]
4 fn bad1(string: Option<&str>) -> (bool, &str) {
5 string.map_or((false, "hello"), |x| (true, x))
8 fn longer_body(arg: Option<u32>) -> u32 {
15 fn test_map_or_else(arg: Option<u32>) {
16 let _ = arg.map_or_else(|| {
21 }, |x| x * x * x * x);
24 fn negative_tests(arg: Option<u32>) -> u32 {
25 let _ = if let Some(13) = arg { "unlucky" } else { "lucky" };
27 let _ = if let Some(x) = arg {
33 let _ = if let Some(x) = arg {
42 let optional = Some(5);
43 let _ = optional.map_or(5, |x| x + 2);
45 let _ = longer_body(None);
46 test_map_or_else(None);
47 let _ = negative_tests(None);