Skip to content

Commit

Permalink
improve compatibility check with PartialEq
Browse files Browse the repository at this point in the history
Signed-off-by: joaogdemacedo <[email protected]>
  • Loading branch information
joaogdemacedo committed Nov 22, 2023
1 parent 45edb2b commit a362755
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions src/commands/plugins.rs
Original file line number Diff line number Diff line change
Expand Up @@ -262,10 +262,9 @@ impl Upgrade {
let installed_in_catalogue: Vec<_> = installed_plugins
.into_iter()
.filter(|installed| {
catalogue_plugins.iter().any(|catalogue| {
installed.manifest == catalogue.manifest
&& matches!(catalogue.compatibility, PluginCompatibility::Compatible)
})
catalogue_plugins
.iter()
.any(|catalogue| installed.manifest == catalogue.manifest)
})
.collect();

Expand All @@ -290,12 +289,11 @@ impl Upgrade {
.await
{
// Check if upgraded candidates have a newer version and if are compatible
if is_potential_upgrade(&installed_plugin.manifest, &manifest) {
if let PluginCompatibility::Compatible =
PluginCompatibility::for_current(&manifest)
{
eligible_plugins.push((installed_plugin, manifest));
}
if is_potential_upgrade(&installed_plugin.manifest, &manifest)
&& PluginCompatibility::Compatible
== PluginCompatibility::for_current(&manifest)
{
eligible_plugins.push((installed_plugin, manifest));
}
}
}
Expand Down Expand Up @@ -537,7 +535,7 @@ impl Search {
}
}

#[derive(Debug)]
#[derive(Debug, PartialEq)]
pub(crate) enum PluginCompatibility {
Compatible,
IncompatibleSpin(String),
Expand Down

0 comments on commit a362755

Please sign in to comment.