Skip to main content

pattern_subsumes

Function pattern_subsumes 

Source
pub fn pattern_subsumes(a: &str, b: &str) -> bool
Expand description

Check if pattern a is subsumed by pattern b (i.e., everything a matches, b also matches). If true, and b comes after a in CODEOWNERS, then a is a dead rule.

Key anchoring rules:

  • Unanchored patterns (no leading /) match MORE files than anchored patterns
  • /docs/ (anchored) IS subsumed by docs/ (unanchored)
  • docs/ (unanchored) is NOT subsumed by /docs/ (anchored)