mirror of
https://github.com/danbulant/oxc
synced 2026-05-21 05:08:45 +00:00
refactor(linter): inline Rule trait default methods (#5619)
Hopefully compiler is already inlining these trivial/empty methods, but mark them `#[inline]` to make sure.
This commit is contained in:
parent
a0370bf506
commit
89bdf5536f
1 changed files with 4 additions and 0 deletions
|
|
@ -17,14 +17,17 @@ pub trait Rule: Sized + Default + fmt::Debug {
|
||||||
|
|
||||||
/// Visit each AST Node
|
/// Visit each AST Node
|
||||||
#[expect(unused_variables)]
|
#[expect(unused_variables)]
|
||||||
|
#[inline]
|
||||||
fn run<'a>(&self, node: &AstNode<'a>, ctx: &LintContext<'a>) {}
|
fn run<'a>(&self, node: &AstNode<'a>, ctx: &LintContext<'a>) {}
|
||||||
|
|
||||||
/// Visit each symbol
|
/// Visit each symbol
|
||||||
#[expect(unused_variables)]
|
#[expect(unused_variables)]
|
||||||
|
#[inline]
|
||||||
fn run_on_symbol(&self, symbol_id: SymbolId, ctx: &LintContext<'_>) {}
|
fn run_on_symbol(&self, symbol_id: SymbolId, ctx: &LintContext<'_>) {}
|
||||||
|
|
||||||
/// Run only once. Useful for inspecting scopes and trivias etc.
|
/// Run only once. Useful for inspecting scopes and trivias etc.
|
||||||
#[expect(unused_variables)]
|
#[expect(unused_variables)]
|
||||||
|
#[inline]
|
||||||
fn run_once(&self, ctx: &LintContext) {}
|
fn run_once(&self, ctx: &LintContext) {}
|
||||||
|
|
||||||
/// Check if a rule should be run at all.
|
/// Check if a rule should be run at all.
|
||||||
|
|
@ -35,6 +38,7 @@ pub trait Rule: Sized + Default + fmt::Debug {
|
||||||
///
|
///
|
||||||
/// [`linter`]: crate::Linter
|
/// [`linter`]: crate::Linter
|
||||||
#[expect(unused_variables)]
|
#[expect(unused_variables)]
|
||||||
|
#[inline]
|
||||||
fn should_run(&self, ctx: &LintContext) -> bool {
|
fn should_run(&self, ctx: &LintContext) -> bool {
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue