Chore: add comments to explicitly express two-step check

See https://github.com/rust-analyzer/rust-analyzer/pull/9836#discussion_r685953381
This commit is contained in:
Basti Ortiz 2021-08-10 22:30:08 +08:00
parent ae1288eeed
commit 0e480a6e9c
No known key found for this signature in database
GPG Key ID: 1402D5CB17F48E1B

View File

@ -136,10 +136,13 @@ pub fn contains_dir(&self, path: &AbsPath) -> bool {
impl Directories {
/// Returns `true` if `path` is included in `self`.
pub fn contains_file(&self, path: &AbsPath) -> bool {
// First, check the file extension...
let ext = path.extension().unwrap_or_default();
if self.extensions.iter().all(|it| it.as_str() != ext) {
return false;
}
// Then, check for path inclusion...
self.includes_path(path)
}