From 9750f514d30156ab587b5df032f8bb17eaee3962 Mon Sep 17 00:00:00 2001 From: Ed Page Date: Tue, 29 Aug 2023 10:49:09 -0500 Subject: [PATCH] fix(pkgid): More consistently refer to SemVer --- src/cargo/util/to_semver.rs | 5 ++++- tests/testsuite/install_upgrade.rs | 2 +- tests/testsuite/pkgid.rs | 4 ++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/cargo/util/to_semver.rs b/src/cargo/util/to_semver.rs index 25da9dfb9754..3cc9e5706ac1 100644 --- a/src/cargo/util/to_semver.rs +++ b/src/cargo/util/to_semver.rs @@ -15,7 +15,10 @@ impl<'a> ToSemver for &'a str { fn to_semver(self) -> CargoResult { match Version::parse(self.trim()) { Ok(v) => Ok(v), - Err(..) => Err(anyhow::format_err!("cannot parse '{}' as a semver", self)), + Err(..) => Err(anyhow::format_err!( + "cannot parse '{}' as a SemVer version", + self + )), } } } diff --git a/tests/testsuite/install_upgrade.rs b/tests/testsuite/install_upgrade.rs index 5c1818da7435..580117f5cdcc 100644 --- a/tests/testsuite/install_upgrade.rs +++ b/tests/testsuite/install_upgrade.rs @@ -230,7 +230,7 @@ fn ambiguous_version_no_longer_allowed() { cargo_process("install foo --version=1.0") .with_stderr( "\ -[ERROR] invalid value '1.0' for '--version ': cannot parse '1.0' as a semver +[ERROR] invalid value '1.0' for '--version ': cannot parse '1.0' as a SemVer version tip: if you want to specify SemVer range, add an explicit qualifier, like '^1.0' diff --git a/tests/testsuite/pkgid.rs b/tests/testsuite/pkgid.rs index 7cb633485f20..1857f43b1857 100644 --- a/tests/testsuite/pkgid.rs +++ b/tests/testsuite/pkgid.rs @@ -156,7 +156,7 @@ error: invalid package ID specification: `two-ver@0` Did you mean `two-ver`? Caused by: - cannot parse '0' as a semver + cannot parse '0' as a SemVer version ", ) .run(); @@ -169,7 +169,7 @@ Caused by: error: invalid package ID specification: `two-ver@0.2` Caused by: - cannot parse '0.2' as a semver + cannot parse '0.2' as a SemVer version ", ) .run();