From 0ea598146d981f79d1e75ddd4691d28029fed87e Mon Sep 17 00:00:00 2001 From: David Aguilar Date: Sun, 19 Nov 2023 00:37:15 -0800 Subject: [PATCH] cmd: use Vec::with_capacity(size) instead of Vec::new() + reserve() --- src/cmd.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/cmd.rs b/src/cmd.rs index 521e6a5..481b289 100644 --- a/src/cmd.rs +++ b/src/cmd.rs @@ -185,9 +185,7 @@ where // Create a copy of the command so where the first entry has been replaced // with a $PATH-resolved absolute path. - let mut command_vec: Vec = Vec::new(); - command_vec.reserve(command.len()); - + let mut command_vec = Vec::with_capacity(command.len()); command_vec.push(cmd_path.to_string_lossy().to_string()); for arg in &command[1..] { let curpath = std::path::PathBuf::from(arg);