Skip to content

Commit 04c956c

Browse files
committed
feat(cargo-util-schemas): TryFrom<PartialVersion> for RustVersion
1 parent 9e0cdc2 commit 04c956c

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

crates/cargo-util-schemas/src/manifest.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1417,6 +1417,14 @@ impl std::str::FromStr for RustVersion {
14171417
fn from_str(value: &str) -> Result<Self, Self::Err> {
14181418
let partial = value.parse::<PartialVersion>();
14191419
let partial = partial.map_err(RustVersionErrorKind::PartialVersion)?;
1420+
partial.try_into()
1421+
}
1422+
}
1423+
1424+
impl TryFrom<PartialVersion> for RustVersion {
1425+
type Error = RustVersionError;
1426+
1427+
fn try_from(partial: PartialVersion) -> Result<Self, Self::Error> {
14201428
if partial.pre.is_some() {
14211429
return Err(RustVersionErrorKind::Prerelease.into());
14221430
}

0 commit comments

Comments
 (0)