From dc2094cfa5b15bb5b915c5f1ba81535e45d0af22 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Tue, 14 Jul 2020 15:57:10 +0200 Subject: Minor, push allocations down --- crates/vfs/src/file_set.rs | 2 +- crates/vfs/src/lib.rs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'crates/vfs/src') diff --git a/crates/vfs/src/file_set.rs b/crates/vfs/src/file_set.rs index 37c479306..e5e2ef530 100644 --- a/crates/vfs/src/file_set.rs +++ b/crates/vfs/src/file_set.rs @@ -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 } diff --git a/crates/vfs/src/lib.rs b/crates/vfs/src/lib.rs index 3bfecd08f..cdf6f1fd0 100644 --- a/crates/vfs/src/lib.rs +++ b/crates/vfs/src/lib.rs @@ -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 + '_ { + pub fn iter(&self) -> impl Iterator + '_ { (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) }) } -- cgit v1.2.3