Skip to content

Commit 7337845

Browse files
lynzrandpeter-jerry-ye
authored andcommitted
fix: Remove anti-pattern of matching try
1 parent 62cca11 commit 7337845

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

json5/lex_number.mbt

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,7 @@ fn lex_number_end(
5050
end : Int,
5151
) -> Double raise ParseError {
5252
let s = try! ctx.input[start:end].to_string()
53-
match (try? @strconv.parse_double(s)) {
54-
Ok(d) => d
55-
Err(_) =>
56-
parse_error(InvalidNumber(offset_to_position(ctx.input, start), s))
53+
@strconv.parse_double(s) catch {
54+
_ => parse_error(InvalidNumber(offset_to_position(ctx.input, start), s))
5755
}
5856
}

0 commit comments

Comments
 (0)