Add a library identifier to disambiguate clashes in the library #238

Merged
wojtek merged 16 commits from 231---differentiate-release-groups-with-same-title-but-different-type-clash into main 2025-01-02 15:50:55 +01:00
2 changed files with 6 additions and 6 deletions
Showing only changes of commit 14ab109197 - Show all commits

View File

@ -72,10 +72,10 @@ impl Artist {
fn merge_albums_by_lib_id(
primary_albums: &mut [Album],
mut secondary_albums: Vec<Album>,
secondary_albums: Vec<Album>,
) -> HashMap<String, Vec<Album>> {
let mut secondary_without_id = HashMap::<String, Vec<Album>>::new();
for secondary_album in secondary_albums.drain(..) {
for secondary_album in secondary_albums.into_iter() {
let unmerged = Artist::merge_album_by_lib_id(primary_albums, secondary_album);
if let Some(secondary_album) = unmerged {
secondary_without_id
@ -89,9 +89,9 @@ impl Artist {
fn merge_albums_by_title(
primary_albums: &mut Vec<Album>,
mut secondary_without_id: HashMap<String, Vec<Album>>,
secondary_without_id: HashMap<String, Vec<Album>>,
) {
for (title, mut secondary_albums) in secondary_without_id.drain() {
for (title, mut secondary_albums) in secondary_without_id.into_iter() {
let mut iter = primary_albums.iter_mut();
match iter.find(|album| album.meta.id.title == title) {
Some(ref mut primary_album) => {

View File

@ -23,8 +23,8 @@ impl<T: Ord> Merge for Vec<T> {
}
impl<K: Hash + PartialEq + Eq, T: Ord> Merge for HashMap<K, Vec<T>> {
fn merge_in_place(&mut self, mut other: Self) {
for (other_key, other_value) in other.drain() {
fn merge_in_place(&mut self, other: Self) {
for (other_key, other_value) in other.into_iter() {
if let Some(ref mut value) = self.get_mut(&other_key) {
value.merge_in_place(other_value)
} else {