fix(msrv): Error, rather than panic, on rust-version 'x'

Fixes #13768
This commit is contained in:
Ed Page 2024-04-17 13:15:09 -05:00
parent af9288f1b6
commit 675d67d093
2 changed files with 7 additions and 6 deletions

View file

@ -183,5 +183,9 @@ fn is_req(value: &str) -> bool {
let Some(first) = value.chars().next() else { let Some(first) = value.chars().next() else {
return false; return false;
}; };
"<>=^~".contains(first) || value.contains('*') || value.contains(',') "<>=^~".contains(first)
|| value.contains('*')
|| value.contains(',')
|| value.contains('x')
|| value.contains('X')
} }

View file

@ -125,7 +125,6 @@ fn rust_version_bad_pre_release() {
} }
#[cargo_test] #[cargo_test]
#[should_panic]
fn rust_version_x_wildcard() { fn rust_version_x_wildcard() {
project() project()
.file( .file(
@ -150,8 +149,8 @@ fn rust_version_x_wildcard() {
[ERROR] unexpected version requirement, expected a version like \"1.32\" [ERROR] unexpected version requirement, expected a version like \"1.32\"
--> Cargo.toml:7:28 --> Cargo.toml:7:28
| |
7 | rust-version = \"^1.43\" 7 | rust-version = \"x\"
| ^^^^^^^ | ^^^
| |
", ",
) )
@ -159,7 +158,6 @@ fn rust_version_x_wildcard() {
} }
#[cargo_test] #[cargo_test]
#[should_panic]
fn rust_version_minor_x_wildcard() { fn rust_version_minor_x_wildcard() {
project() project()
.file( .file(
@ -193,7 +191,6 @@ fn rust_version_minor_x_wildcard() {
} }
#[cargo_test] #[cargo_test]
#[should_panic]
fn rust_version_patch_x_wildcard() { fn rust_version_patch_x_wildcard() {
project() project()
.file( .file(