Skip to content

Commit e912d65

Browse files
committed
Chore: use short-circuiting for file ID getter
1 parent 8e4fb4f commit e912d65

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

crates/vfs/src/lib.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,9 @@ impl Vfs {
111111

112112
/// Id of the given path if it exists in the `Vfs` and is not deleted.
113113
pub fn file_id(&self, path: &VfsPath) -> Option<FileId> {
114-
self.interner.get(path).filter(|&it| self.get(it).is_some())
114+
let it = self.interner.get(path)?;
115+
let _ = self.get(it).as_ref()?;
116+
Some(it)
115117
}
116118

117119
/// File path corresponding to the given `file_id`.

0 commit comments

Comments
 (0)