Skip to content

Commit 41eba2f

Browse files
committed
Add test
1 parent 50ecd59 commit 41eba2f

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

tests/ui/option_and_then_some.fixed

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,7 @@ pub fn foo() -> Option<String> {
1919
let x = Some(String::from("hello"));
2020
Some("hello".to_owned()).and_then(|s| Some(format!("{}{}", s, x?)))
2121
}
22+
23+
pub fn example2(x: bool) -> Option<&'static str> {
24+
Some("a").and_then(|s| Some(if x { s } else { return None }))
25+
}

tests/ui/option_and_then_some.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,7 @@ pub fn foo() -> Option<String> {
1919
let x = Some(String::from("hello"));
2020
Some("hello".to_owned()).and_then(|s| Some(format!("{}{}", s, x?)))
2121
}
22+
23+
pub fn example2(x: bool) -> Option<&'static str> {
24+
Some("a").and_then(|s| Some(if x { s } else { return None }))
25+
}

0 commit comments

Comments
 (0)