From 0e480a6e9c9fcb24d42011a031444e0446c07353 Mon Sep 17 00:00:00 2001 From: Basti Ortiz <39114273+Some-Dood@users.noreply.github.com> Date: Tue, 10 Aug 2021 22:30:08 +0800 Subject: [PATCH] Chore: add comments to explicitly express two-step check See https://github.com/rust-analyzer/rust-analyzer/pull/9836#discussion_r685953381 --- crates/vfs/src/loader.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/crates/vfs/src/loader.rs b/crates/vfs/src/loader.rs index 211d4f7c7829..5959ce2ce79a 100644 --- a/crates/vfs/src/loader.rs +++ b/crates/vfs/src/loader.rs @@ -136,10 +136,13 @@ impl Entry { 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) }