build_conditional_lint

Function build_conditional_lint 

Source
pub(crate) fn build_conditional_lint(
    changed_paths: &[String],
    extension: Option<&str>,
    lint: fn(&Path) -> LintFnResult,
) -> fn(&Path) -> LintFnResult
Expand description

Conditionally returns the supplied lint or LINT_NO_OP based on file changes.

Returns the provided Lint function if no extension filter is set or if any changed file matches the specified extension. Otherwise, returns LINT_NO_OP.

ยงRationale

Enables efficient skipping of lints when no relevant files have changed, reducing unnecessary work while maintaining deterministic output.