Skip to content

Commit

Permalink
Minor optimization of Delimiters::from_byte to avoid an extra branch. (
Browse files Browse the repository at this point in the history
…#397)

Co-authored-by: AlaskanEmily <[email protected]>
  • Loading branch information
AlaskanEmily and AlaskanEmily authored Dec 3, 2024
1 parent 6fb149b commit fa6f5eb
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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]
}
}

Expand Down

0 comments on commit fa6f5eb

Please sign in to comment.