Skip to content

Commit

Permalink
Merge pull request #3936 from wasmerio/fix-for-excessive-allocation
Browse files Browse the repository at this point in the history
Fix for excessive allocation
  • Loading branch information
Michael Bryan authored Jun 1, 2023
2 parents 3adc373 + 2904171 commit 495b98b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions lib/virtual-fs/src/static_fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ impl FileOpener for StaticFileSystem {
let file = (*self.volumes)
.get(&volume)
.ok_or(FsError::EntryNotFound)?
.get_file_entry(&format!("{}", path.display()))
.get_file_entry(path.to_string_lossy().as_ref())
.map_err(|_e| FsError::EntryNotFound)?;

Ok(Box::new(WebCFile {
Expand All @@ -69,7 +69,7 @@ impl FileOpener for StaticFileSystem {
}
None => {
for (volume, v) in self.volumes.iter() {
let entry = match v.get_file_entry(&format!("{}", path.display())) {
let entry = match v.get_file_entry(path.to_string_lossy().as_ref()) {
Ok(s) => s,
Err(_) => continue, // error
};
Expand Down
4 changes: 2 additions & 2 deletions lib/virtual-fs/src/webc_fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ where
.volumes
.get(&volume)
.ok_or(FsError::EntryNotFound)?
.get_file_entry(&format!("{}", path.display()))
.get_file_entry(path.to_string_lossy().as_ref())
.map_err(|_e| FsError::EntryNotFound)?;

Ok(Box::new(WebCFile {
Expand All @@ -108,7 +108,7 @@ where
None => continue, // error
};

let entry = match v.get_file_entry(&format!("{}", path.display())) {
let entry = match v.get_file_entry(path.to_string_lossy().as_ref()) {
Ok(s) => s,
Err(_) => continue, // error
};
Expand Down

0 comments on commit 495b98b

Please sign in to comment.