File tree Expand file tree Collapse file tree 1 file changed +12
-14
lines changed Expand file tree Collapse file tree 1 file changed +12
-14
lines changed Original file line number Diff line number Diff line change @@ -155,25 +155,23 @@ impl Directories {
155
155
/// - This path is longer than any element in `self.exclude` that is a prefix
156
156
/// of `path`. In case of equality, exclusion wins.
157
157
fn includes_path ( & self , path : & AbsPath ) -> bool {
158
- let mut include: Option < & AbsPathBuf > = None ;
159
- for incl in & self . include {
160
- if path. starts_with ( incl) {
161
- include = Some ( match include {
162
- Some ( prev) if prev. starts_with ( incl) => prev,
163
- _ => incl,
164
- } )
158
+ let include = self . include . iter ( ) . fold ( None :: < & AbsPathBuf > , |include, incl| {
159
+ if !path. starts_with ( incl) {
160
+ return include;
165
161
}
166
- }
162
+
163
+ Some ( match include {
164
+ Some ( prev) if prev. starts_with ( incl) => prev,
165
+ _ => incl,
166
+ } )
167
+ } ) ;
168
+
167
169
let include = match include {
168
170
Some ( it) => it,
169
171
None => return false ,
170
172
} ;
171
- for excl in & self . exclude {
172
- if path. starts_with ( excl) && excl. starts_with ( include) {
173
- return false ;
174
- }
175
- }
176
- true
173
+
174
+ !self . exclude . iter ( ) . any ( |excl| path. starts_with ( excl) && excl. starts_with ( include) )
177
175
}
178
176
}
179
177
You can’t perform that action at this time.
0 commit comments