From 107e5e6c62b0d07c16197226bace21659be6b23c Mon Sep 17 00:00:00 2001 From: jordan Date: Wed, 14 Sep 2022 11:56:04 +0100 Subject: [PATCH] Merge pull request #35 from Eijebong/fix-renamed-deps Fix dependency renaming in published crates--- src/metadata.rs | 34 +++++++++++++++++++++------------- 1 file changed, 21 insertions(+), 13 deletions(-) diff --git a/src/metadata.rs b/src/metadata.rs index b6f39c7..aed0ce9 100644 --- a/src/metadata.rs +++ a/src/metadata.rs @@ -26,19 +26,27 @@ deps: package .dependencies .into_iter() - .map(|v| CargoIndexCrateMetadataDependency { - name: v.name, - req: v.req, - features: v.features, - optional: v.optional, - default_features: v.uses_default_features, - target: v.target, - kind: v.kind, - registry: Some(v.registry.map_or( - Cow::Borrowed("https://github.com/rust-lang/crates.io-index.git"), - Cow::Owned, - )), - package: v.rename, + .map(|v| { + let (name, package) = if let Some(rename) = v.rename { + (rename, Some(v.name)) + } else { + (v.name, None) + }; + + CargoIndexCrateMetadataDependency { + name, + req: v.req, + features: v.features, + optional: v.optional, + default_features: v.uses_default_features, + target: v.target, + kind: v.kind, + registry: Some(v.registry.map_or( + Cow::Borrowed("https://github.com/rust-lang/crates.io-index.git"), + Cow::Owned, + )), + package, + } }) .collect(), cksum, -- rgit 0.1.3