mirror of
https://github.com/rust-lang/rust-analyzer
synced 2025-01-12 13:18:47 +00:00
Refactor: simplify logic for Directories::contains_file
The logic was simply inverted to accomodate for the short-circuiting `&&` operator.
This commit is contained in:
parent
0765c9713b
commit
6d0336b2e4
1 changed files with 1 additions and 4 deletions
|
@ -137,10 +137,7 @@ impl Directories {
|
|||
/// Returns `true` if `path` is included in `self`.
|
||||
pub fn contains_file(&self, path: &AbsPath) -> bool {
|
||||
let ext = path.extension().unwrap_or_default();
|
||||
if self.extensions.iter().all(|it| it.as_str() != ext) {
|
||||
return false;
|
||||
}
|
||||
self.includes_path(path)
|
||||
self.extensions.iter().any(|it| it.as_str() == ext) && self.includes_path(path)
|
||||
}
|
||||
|
||||
/// Returns `true` if `path` is included in `self`.
|
||||
|
|
Loading…
Reference in a new issue