Code fix
All checks were successful
Cargo CI / Build and Test (pull_request) Successful in 2m6s
Cargo CI / Lint (pull_request) Successful in 1m8s

This commit is contained in:
Wojciech Kozlowski 2025-01-05 13:31:32 +01:00
parent 54b170a5b5
commit 6919f0214a

View File

@ -212,6 +212,10 @@ impl AppMachine<MatchState> {
mh.set_artist_mb_ref(&matches.matching.id, tuple.mb_ref) mh.set_artist_mb_ref(&matches.matching.id, tuple.mb_ref)
} }
fn filter_mb_ref(left: &AlbumMbRef, right: &AlbumMbRef) -> bool {
(left == right) && !matches!(left, AlbumMbRef::CannotHaveMbid)
}
fn select_album( fn select_album(
inner: &mut AppInner, inner: &mut AppInner,
matches: &AlbumMatches, matches: &AlbumMatches,
@ -225,7 +229,7 @@ impl AppMachine<MatchState> {
let iter = artist.albums.iter(); let iter = artist.albums.iter();
let filtered = iter let filtered = iter
.filter(|album| album.meta.id != matches.matching) .filter(|album| album.meta.id != matches.matching)
.filter(|album| album.meta.id.mb_ref == tuple.mb_ref); .filter(|album| Self::filter_mb_ref(&album.meta.id.mb_ref, &tuple.mb_ref));
clashing.extend(filtered.map(|a| &a.meta.id).cloned()) clashing.extend(filtered.map(|a| &a.meta.id).cloned())
} }