Skip to main content

should_ignore

Function should_ignore 

Source
pub fn should_ignore(path: &Path, patterns: &[String]) -> bool
Expand description

Whether path is covered by any of the .heddleignore patterns.

is_dir = true is passed to the underlying gitignore matcher so trailing-slash rules (target/, build/) match the bare directory entry itself — not just paths inside it. This preserves the pre-existing in-house matcher’s behavior, where build/ on a bare build path returned true. Walker callers depend on this to prune entire directory subtrees before descending; the alternative (is_dir = false) caused unnecessary traversal of target/, node_modules/, and other build trees.

Non-directory rules (*.log, node_modules, [Mm]akefile) are unaffected — gitignore-spec rules without a trailing slash match regardless of the is_dir flag.