Skip to content

Commit

Permalink
Auto merge of #3653 - Turbo87:semver, r=jtgeibel
Browse files Browse the repository at this point in the history
Update `semver` to v1.x

This PR updates the `semver` crate to the new v1.0.0 release, which is basically a complete rewrite. The `diesel` feature no longer exists, but due to #3650 we don't need it anymore.

Closes #3338
  • Loading branch information
bors committed Jun 8, 2021
2 parents ec4bdc0 + d1f2826 commit 0d83e4e
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 13 deletions.
16 changes: 7 additions & 9 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ prometheus = "0.12.0"
rand = "0.8"
reqwest = { version = "0.11", features = ["blocking", "gzip", "json"] }
scheduled-thread-pool = "0.2.0"
semver = { version = "0.10", features = ["diesel", "serde"] }
semver = { version = "1.0.3", features = ["serde"] }
sentry = "0.22"
serde = { version = "1.0.0", features = ["derive"] }
serde_json = "1.0.0"
Expand Down
7 changes: 5 additions & 2 deletions src/controllers/krate/publish.rs
Original file line number Diff line number Diff line change
Expand Up @@ -303,8 +303,11 @@ pub fn add_dependencies(
let krate:Crate = Crate::by_exact_name(&dep.name)
.first(&*conn)
.map_err(|_| cargo_err(&format_args!("no known crate named `{}`", &*dep.name)))?;
if semver::VersionReq::parse(&dep.version_req.0) == semver::VersionReq::parse("*") {
return Err(cargo_err(WILDCARD_ERROR_MESSAGE));

if let Ok(version_req) = semver::VersionReq::parse(&dep.version_req.0) {
if version_req == semver::VersionReq::STAR {
return Err(cargo_err(WILDCARD_ERROR_MESSAGE));
}
}

// If this dependency has an explicit name in `Cargo.toml` that
Expand Down
2 changes: 1 addition & 1 deletion src/models/version.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ impl TopVersions {
let highest_stable = pairs
.iter()
.map(|(_, v)| v)
.filter(|v| !v.is_prerelease())
.filter(|v| v.pre.is_empty())
.max()
.map(|v| v.clone());

Expand Down

0 comments on commit 0d83e4e

Please sign in to comment.