2 #![deny(clippy::bind_instead_of_map)]
4 // need a main anyway, use it get rid of unused warnings too
9 let _ = x.map(|o| o + 1);
10 // and an easy counter-example
11 let _ = x.and_then(|o| if o < 32 { Some(o) } else { None });
14 let x: Result<u32, &str> = Ok(1);
18 pub fn foo() -> Option<String> {
19 let x = Some(String::from("hello"));
20 Some("hello".to_owned()).and_then(|s| Some(format!("{}{}", s, x?)))
23 pub fn example2(x: bool) -> Option<&'static str> {
24 Some("a").and_then(|s| Some(if x { s } else { return None }))