about summary refs log tree commit diff
diff options
context:
space:
mode:
authorLzu Tao <taolzu@gmail.com>2019-08-19 05:41:47 +0000
committerLzu Tao <taolzu@gmail.com>2019-08-19 05:41:47 +0000
commit41eba2f26aa0bb45148d37e9696b73322f8d6ca0 (patch)
tree16975f0177bf9812b1221233827429f5a04a773e
parent50ecd595a6d8ec66299c4ce2f1804a381458d74f (diff)
downloadrust-41eba2f26aa0bb45148d37e9696b73322f8d6ca0.tar.gz
rust-41eba2f26aa0bb45148d37e9696b73322f8d6ca0.zip
Add test
-rw-r--r--tests/ui/option_and_then_some.fixed4
-rw-r--r--tests/ui/option_and_then_some.rs4
2 files changed, 8 insertions, 0 deletions
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<String> {
     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<String> {
     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 }))
+}