Skip to main content

apply_rules

Function apply_rules 

Source
pub fn apply_rules<F>(diagnostics: &mut Vec<AnalysisDiagnostic>, lookup_rule: F)
where F: Fn(&str) -> Option<RuleConfig>,
Expand description

Apply a [diagnostics.rules] configuration to a stream of analyser diagnostics in place. Drops diagnostics whose resolved severity is allow, and remaps the remaining diagnostics’ severity field:

  • warn → the diagnostic’s intrinsic severity stays unchanged.
  • deny → severity is upgraded to Error.

lookup_rule is the resolution function — typically LoadedLexConfig::lookup_diagnostic_rule, which consults the named built-in fields first and the extension-rules side-channel second. Diagnostics whose code has no matching entry on either surface pass through untouched at their intrinsic severity.