mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-29 12:36:35 +03:00
Chore: use short-circuiting for file ID getter
This commit is contained in:
@@ -111,7 +111,9 @@ pub fn len(&self) -> usize {
|
||||
|
||||
/// Id of the given path if it exists in the `Vfs` and is not deleted.
|
||||
pub fn file_id(&self, path: &VfsPath) -> Option<FileId> {
|
||||
self.interner.get(path).filter(|&it| self.get(it).is_some())
|
||||
let it = self.interner.get(path)?;
|
||||
let _ = self.get(it).as_ref()?;
|
||||
Some(it)
|
||||
}
|
||||
|
||||
/// File path corresponding to the given `file_id`.
|
||||
|
||||
Reference in New Issue
Block a user