Skip to content

Commit fa6f5eb

Browse files
authoredDec 3, 2024··
Minor optimization of Delimiters::from_byte to avoid an extra branch. (#397)
Co-authored-by: AlaskanEmily <[email protected]>
1 parent 6fb149b commit fa6f5eb

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed
 

‎src/parser.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -360,10 +360,8 @@ impl Delimiters {
360360
table
361361
};
362362

363-
match byte {
364-
None => Delimiter::None,
365-
Some(b) => TABLE[b as usize],
366-
}
363+
assert_eq!(TABLE[0], Delimiter::None);
364+
TABLE[byte.unwrap_or(0) as usize]
367365
}
368366
}
369367

0 commit comments

Comments
 (0)
Please sign in to comment.