Skip to content

Commit

Permalink
refactor(ast): inline trivial functions and shorten code
Browse files Browse the repository at this point in the history
  • Loading branch information
overlookmotel committed Jul 6, 2024
1 parent 564a75a commit 9c11c85
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions crates/oxc_ast/src/trivia.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ pub struct Comment {
}

impl Comment {
#[inline]
pub fn new(end: u32, kind: CommentKind) -> Self {
Self { kind, end }
}
Expand All @@ -28,12 +29,14 @@ pub enum CommentKind {
}

impl CommentKind {
#[inline]
pub fn is_single_line(self) -> bool {
matches!(self, Self::SingleLine)
self == Self::SingleLine
}

#[inline]
pub fn is_multi_line(self) -> bool {
matches!(self, Self::MultiLine)
self == Self::MultiLine
}
}

Expand All @@ -54,6 +57,7 @@ pub struct TriviasImpl {
impl Deref for Trivias {
type Target = TriviasImpl;

#[inline]
fn deref(&self) -> &Self::Target {
self.0.as_ref()
}
Expand Down

0 comments on commit 9c11c85

Please sign in to comment.