From dc9014d59b9412490bf4e19b0f38113d10c6ef68 Mon Sep 17 00:00:00 2001 From: Ed Page Date: Tue, 30 Jul 2024 14:39:55 -0500 Subject: [PATCH] refactor(publish): Clarify we prepare_transmit using the local package --- src/cargo/ops/registry/publish.rs | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/cargo/ops/registry/publish.rs b/src/cargo/ops/registry/publish.rs index f0a72bda404..e58e0a5164d 100644 --- a/src/cargo/ops/registry/publish.rs +++ b/src/cargo/ops/registry/publish.rs @@ -324,10 +324,10 @@ fn verify_dependencies( pub(crate) fn prepare_transmit( gctx: &GlobalContext, - pkg: &Package, + local_pkg: &Package, registry_id: SourceId, ) -> CargoResult { - let deps = pkg + let deps = local_pkg .dependencies() .iter() .filter(|dep| { @@ -378,7 +378,7 @@ pub(crate) fn prepare_transmit( }) }) .collect::>>()?; - let manifest = pkg.manifest(); + let manifest = local_pkg.manifest(); let ManifestMetadata { ref authors, ref description, @@ -398,12 +398,13 @@ pub(crate) fn prepare_transmit( let readme_content = readme .as_ref() .map(|readme| { - paths::read(&pkg.root().join(readme)) - .with_context(|| format!("failed to read `readme` file for package `{}`", pkg)) + paths::read(&local_pkg.root().join(readme)).with_context(|| { + format!("failed to read `readme` file for package `{}`", local_pkg) + }) }) .transpose()?; if let Some(ref file) = *license_file { - if !pkg.root().join(file).exists() { + if !local_pkg.root().join(file).exists() { bail!("the license file `{}` does not exist", file) } } @@ -440,8 +441,8 @@ pub(crate) fn prepare_transmit( }; Ok(NewCrate { - name: pkg.name().to_string(), - vers: pkg.version().to_string(), + name: local_pkg.name().to_string(), + vers: local_pkg.version().to_string(), deps, features: string_features, authors: authors.clone(),