Skip to content

Commit d760d6e

Browse files
committed
refactor(vendor): remove unnecessary allocations
1 parent a506ceb commit d760d6e

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

src/cargo/ops/vendor.rs

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,7 @@ fn cp_sources(
417417
&dst,
418418
&mut dst_opts,
419419
&mut contents.as_bytes(),
420-
"Generated Cargo.toml",
420+
Path::new("Generated Cargo.toml"),
421421
tmp_buf,
422422
)?
423423
} else {
@@ -430,13 +430,7 @@ fn cp_sources(
430430
.with_context(|| format!("failed to stat {:?}", p))?;
431431
dst_opts.mode(src_metadata.mode());
432432
}
433-
copy_and_checksum(
434-
&dst,
435-
&mut dst_opts,
436-
&mut src,
437-
&p.display().to_string(),
438-
tmp_buf,
439-
)?
433+
copy_and_checksum(&dst, &mut dst_opts, &mut src, &p, tmp_buf)?
440434
};
441435

442436
cksums.insert(relative.to_str().unwrap().replace("\\", "/"), cksum);
@@ -562,7 +556,7 @@ fn copy_and_checksum<T: Read>(
562556
dst_path: &Path,
563557
dst_opts: &mut OpenOptions,
564558
contents: &mut T,
565-
contents_path: &str,
559+
contents_path: &Path,
566560
buf: &mut [u8],
567561
) -> CargoResult<String> {
568562
let mut dst = dst_opts

0 commit comments

Comments
 (0)