Skip to content

Commit

Permalink
Make the [src] link on impl Default for VersionReq more comprehensible
Browse files Browse the repository at this point in the history
  • Loading branch information
dtolnay committed Feb 4, 2022
1 parent 3365701 commit 1b76d8a
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,8 @@ pub struct Version {
/// - Whitespace is permitted around commas and around operators. Whitespace is
/// not permitted within a partial version, i.e. anywhere between the major
/// version number and its minor, patch, pre-release, or build metadata.
#[derive(Default, Clone, Eq, PartialEq, Hash, Debug)]
#[derive(Clone, Eq, PartialEq, Hash, Debug)]
#[cfg_attr(no_const_vec_new, derive(Default))]
pub struct VersionReq {
pub comparators: Vec<Comparator>,
}
Expand Down Expand Up @@ -477,6 +478,14 @@ impl VersionReq {
}
}

/// The default VersionReq is the same as [`VersionReq::STAR`].
#[cfg(not(no_const_vec_new))]
impl Default for VersionReq {
fn default() -> Self {
VersionReq::STAR
}
}

impl Comparator {
pub fn parse(text: &str) -> Result<Self, Error> {
Comparator::from_str(text)
Expand Down

0 comments on commit 1b76d8a

Please sign in to comment.