Only clone when required

This commit is contained in:
mo8it 2024-02-29 16:28:59 +01:00
parent 06a883e32f
commit 748f57c16d
4 changed files with 14 additions and 14 deletions

View file

@ -163,8 +163,8 @@ impl Vfs {
/// # Panics
///
/// Panics if the id is not present in the `Vfs`.
pub fn file_path(&self, file_id: FileId) -> VfsPath {
self.interner.lookup(file_id).clone()
pub fn file_path(&self, file_id: FileId) -> &VfsPath {
self.interner.lookup(file_id)
}
/// Returns an iterator over the stored ids and their corresponding paths.