Skip to content

Commit d44b0ac

Browse files
committed
refactor(linter): remove Runner trait (#12559)
Refactor. As far as I can see, this trait does not add any value, since it's only implemented by `LintRunner`. So remove it.
1 parent a9101da commit d44b0ac

File tree

3 files changed

+6
-11
lines changed

3 files changed

+6
-11
lines changed

apps/oxlint/src/lib.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,11 @@ mod command;
22
mod lint;
33
mod output_formatter;
44
mod result;
5-
mod runner;
65
mod tester;
76
mod walk;
87

98
pub mod cli {
10-
pub use crate::{command::*, lint::LintRunner, result::CliRunResult, runner::Runner};
9+
pub use crate::{command::*, lint::LintRunner, result::CliRunResult};
1110
}
1211

1312
pub use oxc_linter::{
@@ -21,7 +20,7 @@ mod raw_fs;
2120
#[global_allocator]
2221
static GLOBAL: mimalloc_safe::MiMalloc = mimalloc_safe::MiMalloc;
2322

24-
use cli::{CliRunResult, LintRunner, Runner};
23+
use cli::{CliRunResult, LintRunner};
2524
use std::{ffi::OsStr, io::BufWriter};
2625

2726
pub fn lint(external_linter: Option<ExternalLinter>) -> CliRunResult {

apps/oxlint/src/lint.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ use rustc_hash::{FxHashMap, FxHashSet};
2020
use serde_json::Value;
2121

2222
use crate::{
23-
cli::{CliRunResult, LintCommand, MiscOptions, ReportUnusedDirectives, Runner, WarningOptions},
23+
cli::{CliRunResult, LintCommand, MiscOptions, ReportUnusedDirectives, WarningOptions},
2424
output_formatter::{LintCommandInfo, OutputFormatter},
2525
walk::Walk,
2626
};
@@ -32,18 +32,16 @@ pub struct LintRunner {
3232
external_linter: Option<ExternalLinter>,
3333
}
3434

35-
impl Runner for LintRunner {
36-
type Options = LintCommand;
37-
38-
fn new(options: Self::Options, external_linter: Option<ExternalLinter>) -> Self {
35+
impl LintRunner {
36+
pub(crate) fn new(options: LintCommand, external_linter: Option<ExternalLinter>) -> Self {
3937
Self {
4038
options,
4139
cwd: env::current_dir().expect("Failed to get current working directory"),
4240
external_linter,
4341
}
4442
}
4543

46-
fn run(self, stdout: &mut dyn Write) -> CliRunResult {
44+
pub(crate) fn run(self, stdout: &mut dyn Write) -> CliRunResult {
4745
let format_str = self.options.output_options.format;
4846
let output_formatter = OutputFormatter::new(format_str);
4947

apps/oxlint/src/tester.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
#[cfg(test)]
22
use crate::cli::{LintRunner, lint_command};
33
#[cfg(test)]
4-
use crate::runner::Runner;
5-
#[cfg(test)]
64
use cow_utils::CowUtils;
75
#[cfg(test)]
86
use lazy_regex::Regex;

0 commit comments

Comments
 (0)