-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Run feature tests only on purl crate Using `--no-default-features` on the workspace does not work as expected because the `purl_test` and `xtask` crates depend on certain features of the `purl` crate. So with feature unification, the `purl` crate is built with those features **enabled**. To resolve this and simplify the tests, this patch switches the default and minimal tests to only test the `purl` crate itself. The "Full" test is left to test the entire workspace with code coverage. This technically leaves open the possibility that `purl_test` or `xtask` may not successfully build with default features... But since those are test and development crates, I'm not actually concerned. * Add missing feature guards * 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.
- Loading branch information
1 parent
4d17bd8
commit fde807c
Showing
3 changed files
with
13 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,7 @@ pub use format::*; | |
pub use package_type::*; | ||
pub use parse::*; | ||
pub use qualifiers::Qualifiers; | ||
#[cfg(feature = "smartstring")] | ||
use smartstring::{LazyCompact, SmartString, SmartStringMode}; | ||
|
||
mod builder; | ||
|
@@ -181,6 +182,7 @@ impl<'a> PurlShape for Cow<'a, str> { | |
/// Without type-specific functionality, it's possible to create PURLs that have | ||
/// incorrect capitalization or are missing a required namespace or required | ||
/// qualifiers. | ||
#[cfg(feature = "smartstring")] | ||
impl<M> PurlShape for SmartString<M> | ||
where | ||
M: SmartStringMode, | ||
|
@@ -229,11 +231,13 @@ pub struct PurlParts { | |
/// # Example | ||
/// | ||
/// ``` | ||
/// // `Purl` is an alias for `GenericPurl<PackageType>`. | ||
/// 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/[email protected]", &purl.to_string()); | ||
/// ``` | ||
|