diff --git a/tests/ui/option_and_then_some.fixed b/tests/ui/option_and_then_some.fixed index 852f48879a3..035bc1e5465 100644 --- a/tests/ui/option_and_then_some.fixed +++ b/tests/ui/option_and_then_some.fixed @@ -19,3 +19,7 @@ pub fn foo() -> Option { let x = Some(String::from("hello")); Some("hello".to_owned()).and_then(|s| Some(format!("{}{}", s, x?))) } + +pub fn example2(x: bool) -> Option<&'static str> { + Some("a").and_then(|s| Some(if x { s } else { return None })) +} diff --git a/tests/ui/option_and_then_some.rs b/tests/ui/option_and_then_some.rs index aebc66374a5..d49da7813c6 100644 --- a/tests/ui/option_and_then_some.rs +++ b/tests/ui/option_and_then_some.rs @@ -19,3 +19,7 @@ pub fn foo() -> Option { let x = Some(String::from("hello")); Some("hello".to_owned()).and_then(|s| Some(format!("{}{}", s, x?))) } + +pub fn example2(x: bool) -> Option<&'static str> { + Some("a").and_then(|s| Some(if x { s } else { return None })) +}