From patchwork Wed Nov 6 17:36:34 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: D7255: rust-matchers: remove default implementations for `Matcher` trait From: phabricator X-Patchwork-Id: 42808 Message-Id: <49d1beab9cb9b8426fedb37ed8dd93a1@localhost.localdomain> To: Phabricator Cc: mercurial-devel@mercurial-scm.org Date: Wed, 6 Nov 2019 17:36:34 +0000 Herald added subscribers: kevincox, durin42. Alphare updated this revision to Diff 17626. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D7255?vs=17623&id=17626 BRANCH default CHANGES SINCE LAST ACTION https://phab.mercurial-scm.org/D7255/new/ REVISION DETAIL https://phab.mercurial-scm.org/D7255 AFFECTED FILES rust/hg-core/src/matchers.rs CHANGE DETAILS To: Alphare, #hg-reviewers Cc: durin42, kevincox, mercurial-devel diff --git a/rust/hg-core/src/matchers.rs b/rust/hg-core/src/matchers.rs --- a/rust/hg-core/src/matchers.rs +++ b/rust/hg-core/src/matchers.rs @@ -26,13 +26,9 @@ /// Explicitly listed files fn file_set(&self) -> HashSet<&HgPath>; /// Returns whether `filename` is in `file_set` - fn exact_match(&self, _filename: impl AsRef) -> bool { - false - } + fn exact_match(&self, filename: impl AsRef) -> bool; /// Returns whether `filename` is matched by this matcher - fn matches(&self, _filename: impl AsRef) -> bool { - false - } + fn matches(&self, filename: impl AsRef) -> bool; /// Decides whether a directory should be visited based on whether it /// has potential matches in it or one of its subdirectories, and /// potentially lists which subdirectories of that directory should be @@ -71,20 +67,14 @@ /// `VisitChildrenSet::This`). fn visit_children_set( &self, - _directory: impl AsRef, - ) -> VisitChildrenSet { - VisitChildrenSet::This - } + directory: impl AsRef, + ) -> VisitChildrenSet; /// Matcher will match everything and `files_set()` will be empty: /// optimization might be possible. - fn matches_everything(&self) -> bool { - false - } + fn matches_everything(&self) -> bool; /// Matcher will match exactly the files in `files_set()`: optimization /// might be possible. - fn is_exact(&self) -> bool { - false - } + fn is_exact(&self) -> bool; } /// Matches everything. @@ -95,11 +85,22 @@ fn file_set(&self) -> HashSet<&HgPath> { HashSet::new() } - + fn exact_match(&self, _filename: impl AsRef) -> bool { + false + } + fn matches(&self, _filename: impl AsRef) -> bool { + true + } fn visit_children_set( &self, _directory: impl AsRef, ) -> VisitChildrenSet { VisitChildrenSet::Recursive } + fn matches_everything(&self) -> bool { + true + } + fn is_exact(&self) -> bool { + false + } }