Skip to content

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
tesuji committed Aug 19, 2019
1 parent 50ecd59 commit 41eba2f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions tests/ui/option_and_then_some.fixed
Original file line number Diff line number Diff line change
Expand Up @@ -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 }))
}
4 changes: 4 additions & 0 deletions tests/ui/option_and_then_some.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 }))
}

0 comments on commit 41eba2f

Please sign in to comment.