Skip to content

Commit d1f2826

Browse files
committed
krate/publish: Fix VersionReq comparison
1 parent e589429 commit d1f2826

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/controllers/krate/publish.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -303,8 +303,11 @@ pub fn add_dependencies(
303303
let krate:Crate = Crate::by_exact_name(&dep.name)
304304
.first(&*conn)
305305
.map_err(|_| cargo_err(&format_args!("no known crate named `{}`", &*dep.name)))?;
306-
if semver::VersionReq::parse(&dep.version_req.0) == semver::VersionReq::parse("*") {
307-
return Err(cargo_err(WILDCARD_ERROR_MESSAGE));
306+
307+
if let Ok(version_req) = semver::VersionReq::parse(&dep.version_req.0) {
308+
if version_req == semver::VersionReq::STAR {
309+
return Err(cargo_err(WILDCARD_ERROR_MESSAGE));
310+
}
308311
}
309312

310313
// If this dependency has an explicit name in `Cargo.toml` that

0 commit comments

Comments
 (0)