Skip to content

Commit

Permalink
fix(manifest): Improve error on good pre-release
Browse files Browse the repository at this point in the history
  • Loading branch information
epage committed Aug 30, 2023
1 parent ccedb8f commit ed7884e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/cargo/util/semver_ext.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,10 +142,10 @@ impl std::str::FromStr for PartialVersion {
let version_req = match semver::VersionReq::parse(value) {
// Exclude semver operators like `^` and pre-release identifiers
Ok(req) if value.chars().all(|c| c.is_ascii_digit() || c == '.') => req,
Err(_) if value.contains('+') => {
_ if value.contains('+') => {
anyhow::bail!("unexpected build field, expected a version like \"1.32\"")
}
Err(_) if value.contains('-') => {
_ if value.contains('-') => {
anyhow::bail!("unexpected prerelease field, expected a version like \"1.32\"")
}
_ => anyhow::bail!("expected a version like \"1.32\""),
Expand Down
2 changes: 1 addition & 1 deletion tests/testsuite/rust_version.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ Caused by:
|
6 | rust-version = \"1.43.0-beta.1\"
| ^^^^^^^^^^^^^^^
expected a version like \"1.32\"",
unexpected prerelease field, expected a version like \"1.32\"",
)
.run();
}
Expand Down

0 comments on commit ed7884e

Please sign in to comment.