commit 759fbe88d16e39bd3a3571c0ebf56a115ddbe3d9
parent 1e369813f4a7d3e0a43c7c9cd6007918bfc23425
Author: Armin Weigl <tb46305@gmail.com>
Date: Wed, 17 Mar 2021 20:12:46 +0100
hare::lex::lex_unicode: replace match with type assertion
Diffstat:
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/hare/lex/lex.ha b/hare/lex/lex.ha
@@ -119,10 +119,7 @@ fn lex_unicode(lex: *lexer, loc: location, n: size) (rune | error) = {
buf[i] = r: u32: u8;
};
let s = strings::from_utf8_unsafe(buf[..n]);
- return match (strconv::stou32b(s, strconv::base::HEX)) {
- (strconv::overflow | strconv::invalid) => abort(), // Invariant
- u: u32 => u: rune,
- };
+ return strconv::stou32b(s, strconv::base::HEX) as u32: rune;
};
fn lex_rune(lex: *lexer, loc: location) (rune | error) = {