Skip to content

Commit bb4347c

Browse files
committed
perf(linter): use precomputed extension (#14819)
Very marginally faster to use the precomputed file extension now.
1 parent 1fcf56c commit bb4347c

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

crates/oxc_linter/src/lib.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -167,10 +167,9 @@ impl Linter {
167167
#[cfg(debug_assertions)]
168168
let mut current_diagnostic_index = 0;
169169

170-
let is_partial_loader_file = path
171-
.extension()
172-
.and_then(|ext| ext.to_str())
173-
.is_some_and(|ext| LINT_PARTIAL_LOADER_EXTENSIONS.contains(&ext));
170+
let is_partial_loader_file = ctx_host
171+
.file_extension()
172+
.is_some_and(|ext| LINT_PARTIAL_LOADER_EXTENSIONS.iter().any(|e| e == &ext));
174173

175174
loop {
176175
let mut rules = rules

0 commit comments

Comments
 (0)