mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-27 12:29:21 +00:00
Minor, push allocations down
This commit is contained in:
parent
ebb4d29d69
commit
dc2094cfa5
3 changed files with 15 additions and 3 deletions
|
@ -90,12 +90,12 @@ impl Vfs {
|
|||
pub fn file_contents(&self, file_id: FileId) -> &[u8] {
|
||||
self.get(file_id).as_deref().unwrap()
|
||||
}
|
||||
pub fn iter(&self) -> impl Iterator<Item = (FileId, VfsPath)> + '_ {
|
||||
pub fn iter(&self) -> impl Iterator<Item = (FileId, &VfsPath)> + '_ {
|
||||
(0..self.data.len())
|
||||
.map(|it| FileId(it as u32))
|
||||
.filter(move |&file_id| self.get(file_id).is_some())
|
||||
.map(move |file_id| {
|
||||
let path = self.interner.lookup(file_id).clone();
|
||||
let path = self.interner.lookup(file_id);
|
||||
(file_id, path)
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue