Skip to content

Commit 4c4f2fd

Browse files
committed
Use method call instead of match.
Issue #3
1 parent 37249a3 commit 4c4f2fd

1 file changed

Lines changed: 3 additions & 6 deletions

File tree

src/outcome.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,9 @@ impl Outcome {
1919
// can't choose a parser. Therefore, if expected is None, we don't parse the JSON
2020
// and won't know if it is well-formed so we just return Ok(None)
2121

22-
match Self::outcome_or_error(expected, maybe_json) {
23-
Ok(outcome) => outcome,
24-
Err(error) => Self::Error {
25-
message: format!("{error:#}"),
26-
},
27-
}
22+
Self::outcome_or_error(expected, maybe_json).unwrap_or_else(|error| Self::Error {
23+
message: format!("{error:#}"),
24+
})
2825
}
2926

3027
fn outcome_or_error(

0 commit comments

Comments
 (0)