Refactor cache lookup logic in VFS to streamline path checks

- Simplified the condition for checking if a path is within the walked roots by removing unnecessary variable assignments.
- This change enhances the clarity and efficiency of the metadata retrieval process in the VFS.
This commit is contained in:
Joe 2026-03-06 20:55:28 -06:00
parent dc788711c7
commit 5ff0ed3f99

View file

@ -293,11 +293,7 @@ impl VfsInner {
if let Some(&is_file) = cache.is_file.get(path) { if let Some(&is_file) = cache.is_file.get(path) {
return Ok(Metadata { is_file }); return Ok(Metadata { is_file });
} }
if cache if cache.walked_roots.iter().any(|root| path.starts_with(root)) {
.walked_roots
.iter()
.any(|root| path.starts_with(root))
{
return Err(io::Error::new( return Err(io::Error::new(
io::ErrorKind::NotFound, io::ErrorKind::NotFound,
"not in prefetch cache", "not in prefetch cache",