Skip to content

Commit

Permalink
Auto merge of #13610 - weihanglo:refactor-vendor, r=epage
Browse files Browse the repository at this point in the history
refactor(vendor): tiny not important refactors
  • Loading branch information
bors committed Mar 20, 2024
2 parents 266a5ef + 9f96d7b commit 5b776ec
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions src/cargo/ops/vendor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ fn sync(
continue;
}
if let Ok(pkg) = packages.get_one(pkg) {
drop(fs::remove_dir_all(pkg.manifest_path().parent().unwrap()));
drop(fs::remove_dir_all(pkg.root()));
}
}
}
Expand Down Expand Up @@ -192,10 +192,7 @@ fn sync(
let mut tmp_buf = [0; 64 * 1024];
for (id, pkg) in ids.iter() {
// Next up, copy it to the vendor directory
let src = pkg
.manifest_path()
.parent()
.expect("manifest_path should point to a file");
let src = pkg.root();
let max_version = *versions[&id.name()].iter().rev().next().unwrap().0;
let dir_has_version_suffix = opts.versioned_dirs || id.version() != max_version;
let dst_name = if dir_has_version_suffix {
Expand Down Expand Up @@ -329,7 +326,7 @@ fn cp_sources(
// the time and if we respect them (e.g. in git) then it'll
// probably mess with the checksums when a vendor dir is checked
// into someone else's source control
Some(".gitattributes") | Some(".gitignore") | Some(".git") => continue,
Some(".gitattributes" | ".gitignore" | ".git") => continue,

// Temporary Cargo files
Some(".cargo-ok") => continue,
Expand Down

0 comments on commit 5b776ec

Please sign in to comment.