# HG changeset patch # User Arseniy Alekseyev # Date 1712927830 -3600 # Node ID cae0be933434975bdcd07d94533b9059d972836b # Parent 529a655874fb91c2f6b3e2bbf0b912decd8f941e match: small tweak to PatternMatcher.visit_children_set This makes it a bit more efficient (avoid a computation in case of early return), and in my opinion clearer. diff -r 529a655874fb -r cae0be933434 rust/hg-core/src/matchers.rs --- a/rust/hg-core/src/matchers.rs Fri Apr 12 14:09:55 2024 +0100 +++ b/rust/hg-core/src/matchers.rs Fri Apr 12 14:17:10 2024 +0100 @@ -354,9 +354,12 @@ if self.prefix && self.files.contains(directory) { return VisitChildrenSet::Recursive; } - let path_or_parents_in_set = dir_ancestors(directory) - .any(|parent_dir| self.files.contains(parent_dir)); - if self.dirs.contains(directory) || path_or_parents_in_set { + if self.dirs.contains(directory) { + return VisitChildrenSet::This; + } + if dir_ancestors(directory) + .any(|parent_dir| self.files.contains(parent_dir)) + { VisitChildrenSet::This } else { VisitChildrenSet::Empty