@@ -118,7 +118,7 @@ use crate::{dscerror::DscError, schemas::dsc_repo::DscRepoSchema, types::Semanti
118118///
119119/// You can specify the minor and patch version segments as a wildcard with the asterisk (`*`)
120120/// character, indicating that it should match any version for that segment. If the minor version
121- /// segment is a wildcard,the patch version segment must either be a wildcard or omitted.
121+ /// segment is a wildcard, the patch version segment must either be a wildcard or omitted.
122122///
123123/// When specifying an explicit operator, specifying the version for a comparator with wildcards is
124124/// equivalent to omitting those version segments. When you define a comparator without an explicit
@@ -144,7 +144,7 @@ use crate::{dscerror::DscError, schemas::dsc_repo::DscRepoSchema, types::Semanti
144144/// | `^1.2` | `>=1.2.0, <2.0.0` | `1.2`, `^1.2.*` |
145145/// | `^1.2.*` | `>=1.2.0, <2.0.0` | `1.2` |
146146/// | `=1` | `>=1.0.0, <2.0.0` | `1`, `1.*`, `1.*.*`, `^1`, `^1.*`, `^1.*.*`, `=1.*`, `=1.*.*` |
147- /// | `=1.*` | `>=1, 0.0, <2.0.0` | `1`, `1.*`, `1.*.*`, `^1`, `^1.*`, `^1.*.*`, `=1`, `=1.*.*` |
147+ /// | `=1.*` | `>=1. 0.0, <2.0.0` | `1`, `1.*`, `1.*.*`, `^1`, `^1.*`, `^1.*.*`, `=1`, `=1.*.*` |
148148/// | `=1.*.*` | `>=1.0.0, <2.0.0` | `1`, `1.*`, `1.*.*`, `^1`, `^1.*`, `^1.*.*`, `=1`, `=1.*` |
149149/// | `=1.2` | `>=1.2.0, <1.3.0` | `1.2.*`, `=1.2.*` |
150150/// | `=1.2.*` | `>=1.2.0, <1.3.0` | `1.2.*`, `=1.2` |
@@ -263,15 +263,15 @@ use crate::{dscerror::DscError, schemas::dsc_repo::DscRepoSchema, types::Semanti
263263/// be less than the version for this comparator. Versions equal to or greater than the
264264/// comparator version don't match the comparator.
265265///
266- /// | Literal comparator | Effective requirement | Valid versions | Invalid versions |
267- /// |:------------------:|:---------------------:|:---------------------------------------|:--- ---------------------------------------------|
268- /// | `<1` | `<1.0.0` |`0.1.0` | `1.0.0`, `1.2.0`, `1.2.3`, `0.1.0-rc.1` |
269- /// | `<1.*` | `<1.0.0` |`0.1.0` | `1.0.0`, `1.2.0`, `1.2.3`, `0.1.0-rc.1` |
270- /// | `<1.*.*` | `<1.0.0` |`0.1.0` | `1.0.0`, `1.2.0`, `1.2.3`, `0.1.0-rc.1` |
271- /// | `<1.2` | `<1.2.0` | 0.1.0`, `1.0.0`, `1.1.1` | `1.2.0`, `1.2.3`, `1.3.0`, `1.2.0-rc.1`, |
272- /// | `<1.2.*` | `<1.2.0` | 0.1.0`, `1.0.0`, `1.1.1` | `1.2.0`, `1.2.3`, `1.3.0`, `1.2.0-rc.1`, |
273- /// | `<1.2.3` | `<1.2.3` | 0.1.0`, `1.0.0`, `1.2.0` | `1.2.3`, `1.3.0`, `1.2.3-rc.1` |
274- /// | `<1.2.3-rc.2` | `<1.2.3-rc.2` | 0.1.0`, `1.0.0`, `1.2.0`, `1.2.3-rc.1` | `1.2.3`, `1.3.0`, `1.0.0-rc.1`, `` 1.2.3-rc.2 |
266+ /// | Literal comparator | Effective requirement | Valid versions | Invalid versions |
267+ /// |:------------------:|:---------------------- :|:----------------------------------------|: ---------------------------------------------|
268+ /// | `<1` | `<1.0.0` | `0.1.0` | `1.0.0`, `1.2.0`, `1.2.3`, `0.1.0-rc.1` |
269+ /// | `<1.*` | `<1.0.0` | `0.1.0` | `1.0.0`, `1.2.0`, `1.2.3`, `0.1.0-rc.1` |
270+ /// | `<1.*.*` | `<1.0.0` | `0.1.0` | `1.0.0`, `1.2.0`, `1.2.3`, `0.1.0-rc.1` |
271+ /// | `<1.2` | `<1.2.0` | ` 0.1.0`, `1.0.0`, `1.1.1` | `1.2.0`, `1.2.3`, `1.3.0`, `1.2.0-rc.1`, |
272+ /// | `<1.2.*` | `<1.2.0` | ` 0.1.0`, `1.0.0`, `1.1.1` | `1.2.0`, `1.2.3`, `1.3.0`, `1.2.0-rc.1`, |
273+ /// | `<1.2.3` | `<1.2.3` | ` 0.1.0`, `1.0.0`, `1.2.0` | `1.2.3`, `1.3.0`, `1.2.3-rc.1` |
274+ /// | `<1.2.3-rc.2` | `<1.2.3-rc.2` | ` 0.1.0`, `1.0.0`, `1.2.0`, `1.2.3-rc.1` | `1.2.3`, `1.3.0`, `1.0.0-rc.1`, `1.2.3-rc.2` |
275275///
276276/// - <a id="operator-less-than-or-equal-to"></a>Less than or equal to (`<=`) - Indicates that the
277277/// [`SemanticVersion`] must be any version up to the version for this comparator. Versions
@@ -355,7 +355,7 @@ use crate::{dscerror::DscError, schemas::dsc_repo::DscRepoSchema, types::Semanti
355355/// 1. If the version doesn't define any wildcards, the implicit operator for the comparator is
356356/// the caret operator. The following sets of comparators are parsed identically:
357357///
358- /// - `1` and `^ `
358+ /// - `1` and `^1 `
359359/// - `1.2` and `^1.2`
360360/// - `1.2.3` and `^1.2.3`
361361/// - `1.2.3-rc.1` and `^1.2.3-rc.1`
@@ -657,7 +657,7 @@ impl SemanticVersionReq {
657657 /// |:----------------:|:-----:|:------------------------------------------------------------------------------------|
658658 /// | `1.*` | Yes | Defines a literal major version segment followed by a wildcard minor version. |
659659 /// | `1.2.*` | Yes | Defines literal major and minor segments followed by a wildcard patch version. |
660- /// | `1.*.*` | No | Defines more than one wildcard, which is forbidden. |
660+ /// | `1.*.*` | Yes | Equivalent to `1.*` - both wildcards match any minor and patch version. |
661661 /// | `1.*.3` | No | If the version includes any wildcards, it must be the last defined version segment. |
662662 /// | `1.2.3-*` | No | Defines the prerelease segment as a wildcard, which is forbidden. |
663663 pub const WILDCARD_VERSION_PATTERN : & str = const_str:: concat!(
@@ -771,10 +771,7 @@ impl FromStr for SemanticVersionReq {
771771impl TryFrom < String > for SemanticVersionReq {
772772 type Error = DscError ;
773773 fn try_from ( value : String ) -> Result < Self , Self :: Error > {
774- match semver:: VersionReq :: parse ( value. as_str ( ) ) {
775- Ok ( r) => Ok ( Self ( r) ) ,
776- Err ( e) => Err ( DscError :: SemVer ( e) ) ,
777- }
774+ Self :: parse ( value. as_str ( ) )
778775 }
779776}
780777
0 commit comments