Skip to content

Commit 6d0336b

Browse files
committed
Refactor: simplify logic for Directories::contains_file
The logic was simply inverted to accomodate for the short-circuiting `&&` operator.
1 parent 0765c97 commit 6d0336b

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

crates/vfs/src/loader.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -137,10 +137,7 @@ impl Directories {
137137
/// Returns `true` if `path` is included in `self`.
138138
pub fn contains_file(&self, path: &AbsPath) -> bool {
139139
let ext = path.extension().unwrap_or_default();
140-
if self.extensions.iter().all(|it| it.as_str() != ext) {
141-
return false;
142-
}
143-
self.includes_path(path)
140+
self.extensions.iter().any(|it| it.as_str() == ext) && self.includes_path(path)
144141
}
145142

146143
/// Returns `true` if `path` is included in `self`.

0 commit comments

Comments
 (0)