From df36042c7c1375bbce403952f924ee84804672a4 Mon Sep 17 00:00:00 2001 From: AlaskanEmily Date: Tue, 3 Dec 2024 13:53:30 -0800 Subject: [PATCH] Minor optimization of Delimiters::from_byte to avoid an extra branch. --- src/parser.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/parser.rs b/src/parser.rs index 0a432912..aabeea6a 100644 --- a/src/parser.rs +++ b/src/parser.rs @@ -360,10 +360,8 @@ impl Delimiters { table }; - match byte { - None => Delimiter::None, - Some(b) => TABLE[b as usize], - } + assert_eq!(TABLE[0], Delimiter::None); + TABLE[byte.unwrap_or(0) as usize] } }