Small clean up

This commit is contained in:
Wojciech Kozlowski 2024-09-28 12:15:42 +02:00
parent b0ac9bf2c1
commit c130519adf

View File

@ -27,11 +27,11 @@ macro_rules! item_option_artist_set {
meta: &ArtistMeta, meta: &ArtistMeta,
) -> Result<(), musichoard::Error> { ) -> Result<(), musichoard::Error> {
let mut info = meta.info.clone(); let mut info = meta.info.clone();
info.musicbrainz = match self { match self {
MatchOption::Some(m) => m.item.info.musicbrainz, MatchOption::Some(m) => info.musicbrainz = m.item.info.musicbrainz,
MatchOption::CannotHaveMbid => MbRefOption::CannotHaveMbid, MatchOption::CannotHaveMbid => info.musicbrainz = MbRefOption::CannotHaveMbid,
MatchOption::ManualInputMbid => panic!(), MatchOption::ManualInputMbid => panic!(),
}; }
music_hoard.set_artist_info(&meta.id, info) music_hoard.set_artist_info(&meta.id, info)
} }
} }
@ -51,15 +51,11 @@ macro_rules! item_option_album_set {
meta: &AlbumMeta, meta: &AlbumMeta,
) -> Result<(), musichoard::Error> { ) -> Result<(), musichoard::Error> {
let mut info = meta.info.clone(); let mut info = meta.info.clone();
(info.musicbrainz, info.primary_type, info.secondary_types) = match self { match self {
MatchOption::Some(m) => ( MatchOption::Some(m) => info = m.item.info,
m.item.info.musicbrainz, MatchOption::CannotHaveMbid => info.musicbrainz = MbRefOption::CannotHaveMbid,
m.item.info.primary_type,
m.item.info.secondary_types,
),
MatchOption::CannotHaveMbid => (MbRefOption::CannotHaveMbid, None, Vec::new()),
MatchOption::ManualInputMbid => panic!(), MatchOption::ManualInputMbid => panic!(),
}; }
music_hoard.set_album_info(artist, &meta.id, info) music_hoard.set_album_info(artist, &meta.id, info)
} }
} }