Skip to content

Commit 75712e1

Browse files
committed
refactor: reuse Package::root() instead
1 parent 266a5ef commit 75712e1

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

src/cargo/ops/vendor.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ fn sync(
133133
continue;
134134
}
135135
if let Ok(pkg) = packages.get_one(pkg) {
136-
drop(fs::remove_dir_all(pkg.manifest_path().parent().unwrap()));
136+
drop(fs::remove_dir_all(pkg.root()));
137137
}
138138
}
139139
}
@@ -192,10 +192,7 @@ fn sync(
192192
let mut tmp_buf = [0; 64 * 1024];
193193
for (id, pkg) in ids.iter() {
194194
// Next up, copy it to the vendor directory
195-
let src = pkg
196-
.manifest_path()
197-
.parent()
198-
.expect("manifest_path should point to a file");
195+
let src = pkg.root();
199196
let max_version = *versions[&id.name()].iter().rev().next().unwrap().0;
200197
let dir_has_version_suffix = opts.versioned_dirs || id.version() != max_version;
201198
let dst_name = if dir_has_version_suffix {

0 commit comments

Comments
 (0)