Skip to content

Commit f5c2e7f

Browse files
committed
refactor(linter): remove unused allocator param in Runtime for LSP & tests
1 parent f5b2a15 commit f5c2e7f

File tree

4 files changed

+6
-10
lines changed

4 files changed

+6
-10
lines changed

crates/oxc_language_server/src/linter/isolated_lint_handler.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,6 @@ impl IsolatedLintHandler {
111111

112112
fn lint_path(&mut self, path: &Path, uri: &Uri, source_text: &str) -> Vec<DiagnosticReport> {
113113
debug!("lint {}", path.display());
114-
let mut allocator = Allocator::default();
115114
let rope = &Rope::from_str(source_text);
116115

117116
let mut messages: Vec<DiagnosticReport> = self
@@ -121,7 +120,7 @@ impl IsolatedLintHandler {
121120
Arc::from(source_text),
122121
)))
123122
.with_paths(vec![Arc::from(path.as_os_str())])
124-
.run_source(&mut allocator)
123+
.run_source()
125124
.iter()
126125
.map(|message| message_to_lsp_diagnostic(message, uri, source_text, rope))
127126
.collect();

crates/oxc_linter/src/service/mod.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,18 +96,17 @@ impl LintService {
9696
}
9797

9898
#[cfg(feature = "language_server")]
99-
pub fn run_source(&mut self, allocator: &mut oxc_allocator::Allocator) -> Vec<crate::Message> {
100-
self.runtime.run_source(allocator)
99+
pub fn run_source(&mut self) -> Vec<crate::Message> {
100+
self.runtime.run_source()
101101
}
102102

103103
/// For tests
104104
#[cfg(test)]
105105
pub(crate) fn run_test_source(
106106
&mut self,
107-
allocator: &mut oxc_allocator::Allocator,
108107
check_syntax_errors: bool,
109108
tx_error: &DiagnosticSender,
110109
) -> Vec<crate::Message> {
111-
self.runtime.run_test_source(allocator, check_syntax_errors, tx_error)
110+
self.runtime.run_test_source(check_syntax_errors, tx_error)
112111
}
113112
}

crates/oxc_linter/src/service/runtime.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -637,7 +637,7 @@ impl Runtime {
637637
// the struct not using `oxc_diagnostic::Error, because we are just collecting information
638638
// and returning it to the client to let him display it.
639639
#[cfg(feature = "language_server")]
640-
pub(super) fn run_source(&mut self, _allocator: &mut oxc_allocator::Allocator) -> Vec<Message> {
640+
pub(super) fn run_source(&mut self) -> Vec<Message> {
641641
use std::sync::Mutex;
642642

643643
let messages = Mutex::new(Vec::<Message>::new());
@@ -706,7 +706,6 @@ impl Runtime {
706706
#[cfg(test)]
707707
pub(super) fn run_test_source(
708708
&mut self,
709-
_allocator: &mut Allocator,
710709
check_syntax_errors: bool,
711710
tx_error: &DiagnosticSender,
712711
) -> Vec<Message> {

crates/oxc_linter/src/tester.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -501,7 +501,6 @@ impl Tester {
501501
fix_kind: ExpectFixKind,
502502
fix_index: u8,
503503
) -> TestResult {
504-
let mut allocator = Allocator::default();
505504
let rule = self.find_rule().read_json(rule_config.unwrap_or_default());
506505
let mut external_plugin_store = ExternalPluginStore::default();
507506
let linter = Linter::new(
@@ -552,7 +551,7 @@ impl Tester {
552551
.with_paths(paths);
553552

554553
let (sender, _receiver) = mpsc::channel();
555-
let result = lint_service.run_test_source(&mut allocator, false, &sender);
554+
let result = lint_service.run_test_source(false, &sender);
556555

557556
if result.is_empty() {
558557
return TestResult::Passed;

0 commit comments

Comments
 (0)