From 5e069158a4b9c4befde2d320e4f077a21e9f57ea Mon Sep 17 00:00:00 2001 From: Kyle Willmon Date: Tue, 31 Oct 2023 12:34:37 -0500 Subject: [PATCH] Avoid `PackageType` in doctests `PackageType` is only available with the `package-type` feature. So it's best to avoid it in unrelated doctests. Otherwise, they will fail when run without default features. --- purl/src/builder.rs | 5 ++--- purl/src/lib.rs | 8 +++++--- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/purl/src/builder.rs b/purl/src/builder.rs index 66dfb89..ff24166 100644 --- a/purl/src/builder.rs +++ b/purl/src/builder.rs @@ -10,11 +10,10 @@ use crate::{GenericPurl, ParseError, PurlParts, PurlShape, SmallString}; /// # Example /// /// ``` -/// // `PurlBuilder` is an alias for `GenericPurlBuilder`. -/// use purl::{PackageType, PurlBuilder}; +/// use purl::GenericPurlBuilder; /// /// // Use the builder if you want to set fields besides the type and name. -/// let purl = PurlBuilder::new(PackageType::Maven, "my-package") +/// let purl = GenericPurlBuilder::new(String::from("maven"), "my-package") /// .with_namespace("my.company") /// .build() /// .unwrap(); diff --git a/purl/src/lib.rs b/purl/src/lib.rs index 37a5223..806c777 100644 --- a/purl/src/lib.rs +++ b/purl/src/lib.rs @@ -231,11 +231,13 @@ pub struct PurlParts { /// # Example /// /// ``` -/// // `Purl` is an alias for `GenericPurl`. -/// use purl::{PackageType, Purl}; +/// use purl::GenericPurl; /// /// // Use the builder if you want to set fields besides the type and name. -/// let purl = Purl::builder(PackageType::Npm, "my-package").with_version("1.2.3").build().unwrap(); +/// let purl = GenericPurl::builder(String::from("npm"), "my-package") +/// .with_version("1.2.3") +/// .build() +/// .unwrap(); /// /// assert_eq!("pkg:npm/my-package@1.2.3", &purl.to_string()); /// ```