Skip to main content

run_rule

Function run_rule 

Source
pub fn run_rule(
    rule: &dyn LintRule,
    config: &Config,
    path: &Path,
    shared_config: &OnceLock<Arc<Config>>,
) -> Vec<LintError>
Expand description

Run a single rule, dispatching to LintRule::check_shared with one lazily-created Arc<Config> for rules that want a shared handle, and to LintRule::check otherwise.

The Arc is created at most once per shared_config cell (i.e. per linted file), so purely native rule sets never pay for the clone. Linter implementations should route every rule invocation through this function so the dispatch policy stays in one place.