Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@ impl IsolatedLintHandler {

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

let mut messages: Vec<DiagnosticReport> = self
Expand All @@ -121,7 +120,7 @@ impl IsolatedLintHandler {
Arc::from(source_text),
)))
.with_paths(vec![Arc::from(path.as_os_str())])
.run_source(&mut allocator)
.run_source()
.iter()
.map(|message| message_to_lsp_diagnostic(message, uri, source_text, rope))
.collect();
Expand Down
7 changes: 3 additions & 4 deletions crates/oxc_linter/src/service/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,18 +96,17 @@ impl LintService {
}

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

/// For tests
#[cfg(test)]
pub(crate) fn run_test_source(
&mut self,
allocator: &mut oxc_allocator::Allocator,
check_syntax_errors: bool,
tx_error: &DiagnosticSender,
) -> Vec<crate::Message> {
self.runtime.run_test_source(allocator, check_syntax_errors, tx_error)
self.runtime.run_test_source(check_syntax_errors, tx_error)
}
}
3 changes: 1 addition & 2 deletions crates/oxc_linter/src/service/runtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -637,7 +637,7 @@ impl Runtime {
// the struct not using `oxc_diagnostic::Error, because we are just collecting information
// and returning it to the client to let him display it.
#[cfg(feature = "language_server")]
pub(super) fn run_source(&mut self, _allocator: &mut oxc_allocator::Allocator) -> Vec<Message> {
pub(super) fn run_source(&mut self) -> Vec<Message> {
use std::sync::Mutex;

let messages = Mutex::new(Vec::<Message>::new());
Expand Down Expand Up @@ -706,7 +706,6 @@ impl Runtime {
#[cfg(test)]
pub(super) fn run_test_source(
&mut self,
_allocator: &mut Allocator,
check_syntax_errors: bool,
tx_error: &DiagnosticSender,
) -> Vec<Message> {
Expand Down
3 changes: 1 addition & 2 deletions crates/oxc_linter/src/tester.rs
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,6 @@ impl Tester {
fix_kind: ExpectFixKind,
fix_index: u8,
) -> TestResult {
let mut allocator = Allocator::default();
let rule = self.find_rule().read_json(rule_config.unwrap_or_default());
let mut external_plugin_store = ExternalPluginStore::default();
let linter = Linter::new(
Expand Down Expand Up @@ -557,7 +556,7 @@ impl Tester {
.with_paths(paths);

let (sender, _receiver) = mpsc::channel();
let result = lint_service.run_test_source(&mut allocator, false, &sender);
let result = lint_service.run_test_source(false, &sender);

if result.is_empty() {
return TestResult::Passed;
Expand Down
Loading