Flatten data structures and more aggressive inlining.

This commit is contained in:
Stephen Chung
2021-03-10 13:32:09 +08:00
parent 352408fd36
commit cbad703b00
8 changed files with 98 additions and 38 deletions

View File

@@ -38,6 +38,7 @@ pub enum LexError {
impl Error for LexError {}
impl fmt::Display for LexError {
#[inline(always)]
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Self::UnexpectedInput(s) => write!(f, "Unexpected '{}'", s),
@@ -293,7 +294,7 @@ pub struct ParseError(pub Box<ParseErrorType>, pub Position);
impl Error for ParseError {}
impl fmt::Display for ParseError {
#[inline]
#[inline(always)]
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
fmt::Display::fmt(&self.0, f)?;