Skip to content

Commit

Permalink
refactor: reuse Package::root() instead
Browse files Browse the repository at this point in the history
  • Loading branch information
weihanglo committed Mar 20, 2024
1 parent 266a5ef commit 75712e1
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 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

0 comments on commit 75712e1

Please sign in to comment.