Skip to content

Commit a0973dc

Browse files
committed
refactor(linter): use BigIntLiteral::raw field (#7660)
No need to slice source text to get raw value of `BigIntLiteral`. It already has a `raw` field.
1 parent 3711a8e commit a0973dc

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

crates/oxc_linter/src/rules/unicorn/numeric_separators_style.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,13 +101,11 @@ impl Rule for NumericSeparatorsStyle {
101101
}
102102
}
103103
AstKind::BigIntLiteral(number) => {
104-
let raw = number.span.source_text(ctx.source_text());
105-
106-
if self.only_if_contains_separator && !raw.contains('_') {
104+
if self.only_if_contains_separator && !number.raw.contains('_') {
107105
return;
108106
}
109107

110-
let formatted = self.format_bigint(number, raw);
108+
let formatted = self.format_bigint(number, &number.raw);
111109

112110
if formatted.len() != number.span.size() as usize {
113111
ctx.diagnostic_with_fix(

0 commit comments

Comments
 (0)