Fix some minor issues
All checks were successful
Cargo CI / Build and Test (pull_request) Successful in 1m41s
Cargo CI / Lint (pull_request) Successful in 1m12s

This commit is contained in:
Wojciech Kozlowski 2024-03-01 08:55:45 +01:00
parent c76e2309a3
commit 1dcd701acf

View File

@ -81,8 +81,11 @@ impl<LIB, DB> MusicHoard<LIB, DB> {
primary.insert(secondary_artist.id.clone(), secondary_artist);
}
}
self.collection = primary.into_values().collect();
Self::sort_artists(&mut self.collection);
self.pre_commit = self.collection.clone();
}
fn items_to_artists(items: Vec<Item>) -> Result<HashMap<ArtistId, Artist>, Error> {
@ -176,7 +179,7 @@ impl<LIB, DB> MusicHoard<LIB, DB> {
}
impl<LIB: ILibrary> MusicHoard<LIB, NoDatabase> {
/// Create a new [`MusicHoard`] with the provided [`IDatabase`].
/// Create a new [`MusicHoard`] with the provided [`ILibrary`] and no database.
pub fn library(library: LIB) -> Self {
MusicHoard {
collection: vec![],
@ -202,7 +205,7 @@ impl<LIB: ILibrary, DB> MusicHoard<LIB, DB> {
}
impl<DB: IDatabase> MusicHoard<NoLibrary, DB> {
/// Create a new [`MusicHoard`] with the provided [`IDatabase`].
/// Create a new [`MusicHoard`] with the provided [`IDatabase`] and no library.
pub fn database(database: DB) -> Result<Self, Error> {
let mut mh = MusicHoard {
collection: vec![],
@ -224,8 +227,6 @@ impl<LIB, DB: IDatabase> MusicHoard<LIB, DB> {
Self::sort_albums_and_tracks(self.database_cache.iter_mut());
self.merge_collections();
self.pre_commit = self.collection.clone();
Ok(())
}