mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-27 21:43:37 +00:00
Merge #5372
5372: Minor, push allocations down r=matklad a=matklad
bors r+
🤖
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
This commit is contained in:
commit
5a25cc2820
3 changed files with 15 additions and 3 deletions
12
baseline.tst
Normal file
12
baseline.tst
Normal file
|
@ -0,0 +1,12 @@
|
|||
24ms - SourceRootConfig::partition
|
||||
24ms - SourceRootConfig::partition
|
||||
31ms - SourceRootConfig::partition
|
||||
30ms - SourceRootConfig::partition
|
||||
35ms - SourceRootConfig::partition
|
||||
28ms - SourceRootConfig::partition
|
||||
32ms - SourceRootConfig::partition
|
||||
26ms - SourceRootConfig::partition
|
||||
30ms - SourceRootConfig::partition
|
||||
26ms - SourceRootConfig::partition
|
||||
32ms - SourceRootConfig::partition
|
||||
31ms - SourceRootConfig::partition
|
|
@ -62,7 +62,7 @@ impl FileSetConfig {
|
|||
let mut res = vec![FileSet::default(); self.len()];
|
||||
for (file_id, path) in vfs.iter() {
|
||||
let root = self.classify(&path, &mut scratch_space);
|
||||
res[root].insert(file_id, path)
|
||||
res[root].insert(file_id, path.clone())
|
||||
}
|
||||
res
|
||||
}
|
||||
|
|
|
@ -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…
Reference in a new issue