From 6393c7d98d9555206ff26dc0fba96c090e4fe958 Mon Sep 17 00:00:00 2001 From: Brooks Date: Thu, 27 Apr 2023 22:45:59 -0400 Subject: [PATCH] Removes erroneous Copy on AsRef params in snapshot_utils (#31382) --- runtime/src/snapshot_utils.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/runtime/src/snapshot_utils.rs b/runtime/src/snapshot_utils.rs index 0a3832476a..ee9095fe59 100644 --- a/runtime/src/snapshot_utils.rs +++ b/runtime/src/snapshot_utils.rs @@ -427,8 +427,8 @@ pub enum VerifySlotDeltasError { /// This is useful if the process does not have permission /// to delete the top level directory it might be able to /// delete the contents of that directory. -fn delete_contents_of_path(path: impl AsRef + Copy) { - if let Ok(dir_entries) = std::fs::read_dir(path) { +fn delete_contents_of_path(path: impl AsRef) { + if let Ok(dir_entries) = std::fs::read_dir(&path) { for entry in dir_entries.flatten() { let sub_path = entry.path(); let metadata = match entry.metadata() { @@ -474,9 +474,9 @@ fn delete_contents_of_path(path: impl AsRef + Copy) { /// If the process is killed and the deleting process is not done, /// the leftover path will be deleted in the next process life, so /// there is no file space leaking. -pub fn move_and_async_delete_path(path: impl AsRef + Copy) { +pub fn move_and_async_delete_path(path: impl AsRef) { let mut path_delete = PathBuf::new(); - path_delete.push(path); + path_delete.push(&path); path_delete.set_file_name(format!( "{}{}", path_delete.file_name().unwrap().to_str().unwrap(), @@ -491,7 +491,7 @@ pub fn move_and_async_delete_path(path: impl AsRef + Copy) { return; } - if let Err(err) = std::fs::rename(path, &path_delete) { + if let Err(err) = std::fs::rename(&path, &path_delete) { warn!( "Path renaming failed: {}. Falling back to rm_dir in sync mode", err.to_string()