Skip to content

Commit

Permalink
krate/publish: Fix VersionReq comparison
Browse files Browse the repository at this point in the history
  • Loading branch information
Turbo87 committed Jun 6, 2021
1 parent e589429 commit d1f2826
Showing 1 changed file with 5 additions and 2 deletions.
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

0 comments on commit d1f2826

Please sign in to comment.