Skip to content

Commit c049765

Browse files
committed
style(lexer): reformat comments (#11012)
Follow-on after #10933. Cosmetic change only. Reformat comments to our standard style, with backticks around type/field names.
1 parent 54bfb4b commit c049765

1 file changed

Lines changed: 8 additions & 7 deletions

File tree

crates/oxc_parser/src/lexer/token.rs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ pub struct Token(u128);
3737
impl Default for Token {
3838
fn default() -> Self {
3939
let mut token = Self(0);
40-
// Kind::default() is Kind::Eof. Kind::Eof as u8 needs to be set.
41-
// Assuming Kind::Eof will be 1 after #[repr(u8)] (Undetermined = 0, Eof = 1)
40+
// `Kind::default()` is `Kind::Eof`. `Kind::Eof as u8` needs to be set.
41+
// Assuming `Kind::Eof` will be 1 after `#[repr(u8)]` (Undetermined = 0, Eof = 1)
4242
token.set_kind(Kind::default());
4343
token
4444
}
@@ -47,15 +47,16 @@ impl Default for Token {
4747
impl Token {
4848
#[inline]
4949
pub(super) fn new_on_new_line() -> Self {
50-
// Start with a default token, then set the flag.
50+
// Start with a default token, then set the flag
5151
let mut token = Self::default();
5252
token.0 |= IS_ON_NEW_LINE_FLAG;
5353
token
5454
}
5555

5656
#[inline]
5757
pub fn kind(&self) -> Kind {
58-
// SAFETY: This conversion is safe because Kind is #[repr(u8)] and we ensure the value stored is a valid Kind variant.
58+
// SAFETY: This conversion is safe because `Kind` is `#[repr(u8)]`,
59+
// and we ensure the value stored is a valid `Kind` variant
5960
unsafe { std::mem::transmute(((self.0 >> KIND_SHIFT) & KIND_MASK) as u8) }
6061
}
6162

@@ -101,13 +102,13 @@ impl Token {
101102

102103
#[inline]
103104
pub(crate) fn set_kind(&mut self, kind: Kind) {
104-
self.0 &= !(KIND_MASK << KIND_SHIFT); // Clear current kind bits
105+
self.0 &= !(KIND_MASK << KIND_SHIFT); // Clear current `kind` bits
105106
self.0 |= u128::from(kind as u8) << KIND_SHIFT;
106107
}
107108

108109
#[inline]
109110
pub(crate) fn set_start(&mut self, start: u32) {
110-
self.0 &= !(START_MASK << START_SHIFT); // Clear current start bits
111+
self.0 &= !(START_MASK << START_SHIFT); // Clear current `start` bits
111112
self.0 |= u128::from(start) << START_SHIFT;
112113
}
113114

@@ -130,7 +131,7 @@ impl Token {
130131
pub(crate) fn set_end(&mut self, end: u32) {
131132
let start = self.start();
132133
debug_assert!(end >= start, "Token end ({end}) cannot be less than start ({start})");
133-
self.0 &= !(END_MASK << END_SHIFT); // Clear current end bits
134+
self.0 &= !(END_MASK << END_SHIFT); // Clear current `end` bits
134135
self.0 |= u128::from(end) << END_SHIFT;
135136
}
136137
}

0 commit comments

Comments
 (0)