From 2629cd7bf89ded028ea6e1b015ad817cb5242c1c Mon Sep 17 00:00:00 2001 From: Lzu Tao Date: Mon, 19 Aug 2019 11:43:05 +0700 Subject: [PATCH] Add test --- tests/ui/option_and_then_some.fixed | 4 ++++ tests/ui/option_and_then_some.rs | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/tests/ui/option_and_then_some.fixed b/tests/ui/option_and_then_some.fixed index 852f48879a35..a73f599e8a12 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 { "b" } else { return None } )) +} diff --git a/tests/ui/option_and_then_some.rs b/tests/ui/option_and_then_some.rs index aebc66374a51..69da4e58c66f 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 { "b" } else { return None } )) +}