From 148bdb5585e0bd0a1b3ff417e416ebd81c11974c Mon Sep 17 00:00:00 2001 From: overlookmotel <557937+overlookmotel@users.noreply.github.com> Date: Mon, 29 Jul 2024 15:38:02 +0000 Subject: [PATCH] refactor(parser): adjust function inlining (#4530) These 2 `#[inline(always)]` were introduced by accident by me just playing around in #4298. One should be kept, but the other one we should leave to compiler to decide. --- crates/oxc_parser/src/lexer/mod.rs | 1 + crates/oxc_parser/src/lexer/source.rs | 3 +-- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/oxc_parser/src/lexer/mod.rs b/crates/oxc_parser/src/lexer/mod.rs index ca4365b62..fedfb1320 100644 --- a/crates/oxc_parser/src/lexer/mod.rs +++ b/crates/oxc_parser/src/lexer/mod.rs @@ -265,6 +265,7 @@ impl<'a> Lexer<'a> { /// Peek the next byte, and advance the current position if it matches /// the given ASCII char. + // `#[inline(always)]` to make sure the `assert!` gets optimized out. #[allow(clippy::inline_always)] #[inline(always)] fn next_ascii_char_eq(&mut self, b: u8) -> bool { diff --git a/crates/oxc_parser/src/lexer/source.rs b/crates/oxc_parser/src/lexer/source.rs index bbeee075d..5dcb00cd6 100644 --- a/crates/oxc_parser/src/lexer/source.rs +++ b/crates/oxc_parser/src/lexer/source.rs @@ -202,8 +202,7 @@ impl<'a> Source<'a> { /// # SAFETY /// /// Caller must ensure that `ascii_byte` is a valid ASCII character. - #[allow(clippy::inline_always)] - #[inline(always)] + #[inline] pub(super) unsafe fn advance_if_ascii_eq(&mut self, ascii_byte: u8) -> bool { debug_assert!(ascii_byte.is_ascii()); let matched = self.peek_byte() == Some(ascii_byte);