Skip to content

Commit

Permalink
cmd: use Vec::with_capacity(size) instead of Vec::new() + reserve()
Browse files Browse the repository at this point in the history
  • Loading branch information
davvid committed Nov 19, 2023
1 parent 5439935 commit 0ea5981
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/cmd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<String> = 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);
Expand Down

0 comments on commit 0ea5981

Please sign in to comment.