Skip to content

Commit

Permalink
Merge pull request #1283 from kaiserd/master
Browse files Browse the repository at this point in the history
refactor: simplify extracting Result from Option
  • Loading branch information
marioidival authored Oct 31, 2019
2 parents f3197dd + 8bbf124 commit dcee312
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/error/multiple_error_types/option_result.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,7 @@ fn double_first(vec: Vec<&str>) -> Result<Option<i32>, ParseIntError> {
first.parse::<i32>().map(|n| 2 * n)
});
let opt = opt.map_or(Ok(None), |r| r.map(Some))?;
Ok(opt)
opt.map_or(Ok(None), |r| r.map(Some))
}
fn main() {
Expand Down

0 comments on commit dcee312

Please sign in to comment.