##// END OF EJS Templates
rust-matchers: remove default implementations for `Matcher` trait...
Raphaël Gomès -
r44009:27c25c0d default
parent child Browse files
Show More
@@ -26,13 +26,9 b' pub trait Matcher {'
26 /// Explicitly listed files
26 /// Explicitly listed files
27 fn file_set(&self) -> HashSet<&HgPath>;
27 fn file_set(&self) -> HashSet<&HgPath>;
28 /// Returns whether `filename` is in `file_set`
28 /// Returns whether `filename` is in `file_set`
29 fn exact_match(&self, _filename: impl AsRef<HgPath>) -> bool {
29 fn exact_match(&self, filename: impl AsRef<HgPath>) -> bool;
30 false
31 }
32 /// Returns whether `filename` is matched by this matcher
30 /// Returns whether `filename` is matched by this matcher
33 fn matches(&self, _filename: impl AsRef<HgPath>) -> bool {
31 fn matches(&self, filename: impl AsRef<HgPath>) -> bool;
34 false
35 }
36 /// Decides whether a directory should be visited based on whether it
32 /// Decides whether a directory should be visited based on whether it
37 /// has potential matches in it or one of its subdirectories, and
33 /// has potential matches in it or one of its subdirectories, and
38 /// potentially lists which subdirectories of that directory should be
34 /// potentially lists which subdirectories of that directory should be
@@ -71,20 +67,14 b' pub trait Matcher {'
71 /// `VisitChildrenSet::This`).
67 /// `VisitChildrenSet::This`).
72 fn visit_children_set(
68 fn visit_children_set(
73 &self,
69 &self,
74 _directory: impl AsRef<HgPath>,
70 directory: impl AsRef<HgPath>,
75 ) -> VisitChildrenSet {
71 ) -> VisitChildrenSet;
76 VisitChildrenSet::This
77 }
78 /// Matcher will match everything and `files_set()` will be empty:
72 /// Matcher will match everything and `files_set()` will be empty:
79 /// optimization might be possible.
73 /// optimization might be possible.
80 fn matches_everything(&self) -> bool {
74 fn matches_everything(&self) -> bool;
81 false
82 }
83 /// Matcher will match exactly the files in `files_set()`: optimization
75 /// Matcher will match exactly the files in `files_set()`: optimization
84 /// might be possible.
76 /// might be possible.
85 fn is_exact(&self) -> bool {
77 fn is_exact(&self) -> bool;
86 false
87 }
88 }
78 }
89
79
90 /// Matches everything.
80 /// Matches everything.
@@ -95,11 +85,22 b' impl Matcher for AlwaysMatcher {'
95 fn file_set(&self) -> HashSet<&HgPath> {
85 fn file_set(&self) -> HashSet<&HgPath> {
96 HashSet::new()
86 HashSet::new()
97 }
87 }
98
88 fn exact_match(&self, _filename: impl AsRef<HgPath>) -> bool {
89 false
90 }
91 fn matches(&self, _filename: impl AsRef<HgPath>) -> bool {
92 true
93 }
99 fn visit_children_set(
94 fn visit_children_set(
100 &self,
95 &self,
101 _directory: impl AsRef<HgPath>,
96 _directory: impl AsRef<HgPath>,
102 ) -> VisitChildrenSet {
97 ) -> VisitChildrenSet {
103 VisitChildrenSet::Recursive
98 VisitChildrenSet::Recursive
104 }
99 }
100 fn matches_everything(&self) -> bool {
101 true
102 }
103 fn is_exact(&self) -> bool {
104 false
105 }
105 }
106 }
General Comments 0
You need to be logged in to leave comments. Login now