Skip to content

Commit

Permalink
Pre-allocate objects vec in objects_from_files
Browse files Browse the repository at this point in the history
  • Loading branch information
roblabla committed Jan 3, 2024
1 parent 0d2f011 commit 0b4ce30
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3818,7 +3818,7 @@ fn wait_on_child(cmd: &Command, program: &str, child: &mut Child) -> Result<(),
/// Find the destination object path for each file in the input source files,
/// and store them in the output Object.
fn objects_from_files(files: &[Arc<Path>], dst: &Path) -> Result<Vec<Object>, Error> {
let mut objects = Vec::new();
let mut objects = Vec::with_capacity(files.len());
for file in files {
let obj = if file.has_root() || file.components().any(|x| x == Component::ParentDir) {
// If `file` is an absolute path or might not be usable directly as a suffix due to
Expand Down

0 comments on commit 0b4ce30

Please sign in to comment.