Skip to content

Commit 5b776ec

Browse files
committed
Auto merge of #13610 - weihanglo:refactor-vendor, r=epage
refactor(vendor): tiny not important refactors
2 parents 266a5ef + 9f96d7b commit 5b776ec

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

src/cargo/ops/vendor.rs

Lines changed: 3 additions & 6 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 {
@@ -329,7 +326,7 @@ fn cp_sources(
329326
// the time and if we respect them (e.g. in git) then it'll
330327
// probably mess with the checksums when a vendor dir is checked
331328
// into someone else's source control
332-
Some(".gitattributes") | Some(".gitignore") | Some(".git") => continue,
329+
Some(".gitattributes" | ".gitignore" | ".git") => continue,
333330

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

0 commit comments

Comments
 (0)