Skip to content

Commit dcee312

Browse files
authored
Merge pull request #1283 from kaiserd/master
refactor: simplify extracting Result from Option
2 parents f3197dd + 8bbf124 commit dcee312

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

src/error/multiple_error_types/option_result.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,7 @@ fn double_first(vec: Vec<&str>) -> Result<Option<i32>, ParseIntError> {
3939
first.parse::<i32>().map(|n| 2 * n)
4040
});
4141
42-
let opt = opt.map_or(Ok(None), |r| r.map(Some))?;
43-
44-
Ok(opt)
42+
opt.map_or(Ok(None), |r| r.map(Some))
4543
}
4644
4745
fn main() {

0 commit comments

Comments
 (0)