]> git.proxmox.com Git - cargo.git/commitdiff
Update approach to check for yanked version
authorbishtpawan <pawan.bisht@knoldus.com>
Fri, 31 Jul 2020 06:22:54 +0000 (11:52 +0530)
committerbishtpawan <pawan.bisht@knoldus.com>
Wed, 5 Aug 2020 12:01:56 +0000 (17:31 +0530)
src/cargo/ops/common_for_install_and_uninstall.rs

index 9d3e63bd63e4c53016e30b7d9f3f64dbeea9dfd6..cb18e6a38d09c44ced3f10f9175965d671365089 100644 (file)
@@ -545,24 +545,17 @@ where
             Ok(pkg)
         }
         None => {
-            // check whether the package is yanked or not
-            if source.is_yanked(
-                PackageId::new(dep.package_name(), dep.version_req(), source.source_id()).into_ok(),
-            ) {
-                bail!(
-                    "provided package has been yanked `{}` in {} with version `{}`",
-                    dep.package_name(),
-                    source.source_id(),
-                    dep.version_req(),
-                )
-            } else {
-                bail!(
-                    "could not find `{}` in {} with version `{}`",
-                    dep.package_name(),
-                    source.source_id(),
-                    dep.version_req(),
-                )
+            for pkg_id in deps.iter() {
+                if source.is_yanked(pkg_id.package_id()).unwrap_or(false) {
+                    bail!("provided package has been yanked `{}`", pkg_id.package_id())
+                }
             }
+            bail!(
+                "could not find `{}` in {} with version `{}`",
+                dep.package_name(),
+                source.source_id(),
+                dep.version_req(),
+            )
         }
     }
 }