From cdff92aa3ca05547426d0bf2c3c72a49c33c6048 Mon Sep 17 00:00:00 2001 From: Jiahao XU Date: Sat, 24 Dec 2022 16:04:51 +1100 Subject: [PATCH] Fix reinstalling crates after removed by `cargo-uninstall` (#628) Honor `.crates.toml` only since `cargo-uninstall` can only update `.crates.toml`, not binstall's own manifest. Fixed #625 Signed-off-by: Jiahao XU --- crates/bin/src/entry.rs | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/crates/bin/src/entry.rs b/crates/bin/src/entry.rs index be51cf0f..6cb2216d 100644 --- a/crates/bin/src/entry.rs +++ b/crates/bin/src/entry.rs @@ -287,18 +287,11 @@ fn filter_out_installed_crates( let name = &crate_name.name; let curr_version = metadata - .and_then(|metadata| { - metadata - .0 - .get(name) - .map(|crate_info| &crate_info.current_version) - .into_iter() - .chain(metadata.1.get(name)) - // Since the cargo_install_v1_metadata could be out of sync - // from cargo_binstall_metadata, it is better to obtain - // the version from both of them and takes the larger one. - .max() - }); + // `cargo-uninstall` can be called to uninstall crates, + // but it only updates .crates.toml. + // + // So here we will honour .crates.toml only. + .and_then(|metadata| metadata.1.get(name)); match ( force,