From e43e9677bef661677c5f36b9db6e446d02be11b0 Mon Sep 17 00:00:00 2001 From: Eric Huss Date: Mon, 23 Oct 2023 10:31:08 -0700 Subject: [PATCH] Re-export DependencyKind It is a SemVer hazard to expose a private dependency type in a public API. If anyone was comparing the kind against their own local dependency, then the versions have to match. Using a re-export allows the user to access the type directly. --- reg-index/src/lib.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/reg-index/src/lib.rs b/reg-index/src/lib.rs index 1d51ee3..ba97af2 100644 --- a/reg-index/src/lib.rs +++ b/reg-index/src/lib.rs @@ -59,6 +59,7 @@ mod validate; mod yank; pub use add::{add, add_from_crate, force_add}; +pub use cargo_metadata::DependencyKind; pub use init::init; pub use list::{list, list_all}; pub use metadata::{metadata, metadata_from_crate}; @@ -117,7 +118,7 @@ pub struct IndexDependency { /// The dependency kind. // Required, but crates.io has some broken missing entries. #[serde(default, deserialize_with = "parse_dependency_kind")] - pub kind: cargo_metadata::DependencyKind, + pub kind: DependencyKind, /// The URL of the index of the registry where this dependency is from. /// /// If not specified or null, it is assumed the dependency is in the @@ -129,7 +130,7 @@ pub struct IndexDependency { pub package: Option, } -fn parse_dependency_kind<'de, D>(d: D) -> Result +fn parse_dependency_kind<'de, D>(d: D) -> Result where D: serde::Deserializer<'de>, {