Skip to content

Commit

Permalink
lexer: #[inline(always)] on Lexer::next_ascii_char_eq and `Source…
Browse files Browse the repository at this point in the history
…::advance_if_ascii_eq`
  • Loading branch information
overlookmotel committed Jul 17, 2024
1 parent f9d6d48 commit 81d54e0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion crates/oxc_parser/src/lexer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,8 @@ impl<'a> Lexer<'a> {

/// Peek the next byte, and advance the current position if it matches
/// the given ASCII char.
#[inline]
#[allow(clippy::inline_always)]
#[inline(always)]
fn next_ascii_char_eq(&mut self, b: u8) -> bool {
// TODO: can be replaced by `std::ascii:Char` once stabilized.
// https://github.com/rust-lang/rust/issues/110998
Expand Down
3 changes: 2 additions & 1 deletion crates/oxc_parser/src/lexer/source.rs
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,8 @@ impl<'a> Source<'a> {
/// # SAFETY
///
/// Caller must ensure that `ascii_byte` is a valid ASCII character.
#[inline]
#[allow(clippy::inline_always)]
#[inline(always)]
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);
Expand Down

0 comments on commit 81d54e0

Please sign in to comment.