diff options
author | Jiayi Zhao <jeff.no.zhao@gmail.com> | 2019-06-05 13:43:16 -0400 |
---|---|---|
committer | Jiayi Zhao <jeff.no.zhao@gmail.com> | 2019-06-05 13:43:16 -0400 |
commit | 8799211cf9e7547416618725a86463444ed9e342 (patch) | |
tree | dfb3b73905a48f341051585845214589b07d21b2 /src/commands/delete_files.rs | |
parent | 724ec36a7ab0dadb0229b9a16eb6179b032be39d (diff) |
replace unnecessary path copying with references instead
Diffstat (limited to 'src/commands/delete_files.rs')
-rw-r--r-- | src/commands/delete_files.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/commands/delete_files.rs b/src/commands/delete_files.rs index f9ca485..f971ab6 100644 --- a/src/commands/delete_files.rs +++ b/src/commands/delete_files.rs @@ -20,8 +20,8 @@ impl DeleteFiles { "delete_files" } - pub fn remove_files(paths: Vec<path::PathBuf>) -> Result<(), std::io::Error> { - for path in &paths { + pub fn remove_files(paths: &[&path::PathBuf]) -> Result<(), std::io::Error> { + for path in paths { if let Ok(metadata) = fs::symlink_metadata(path) { if metadata.is_dir() { fs::remove_dir_all(&path)?; @@ -53,7 +53,7 @@ impl DeleteFiles { ch = 'y' as i32; } if ch == 'y' as i32 { - Self::remove_files(paths)?; + Self::remove_files(&paths)?; ui::wprint_msg(&view.bot_win, "Deleted files"); ReloadDirList::reload(context.curr_tab_index, context)?; } |