diff --git a/src/collection/mod.rs b/src/collection/mod.rs index 62352ad..e21039a 100644 --- a/src/collection/mod.rs +++ b/src/collection/mod.rs @@ -56,18 +56,15 @@ pub trait CollectionManager { /// The collection manager. It is responsible for pulling information from both the library and the /// database, ensuring its consistent and writing back any changes. -pub struct MhCollectionManager { - library: Box, +pub struct MhCollectionManager { + library: L, database: Box, collection: Collection, } -impl MhCollectionManager { +impl MhCollectionManager { /// Create a new [`CollectionManager`] with the provided [`Library`] and [`Database`]. - pub fn new( - library: Box, - database: Box, - ) -> Self { + pub fn new(library: L, database: Box) -> Self { MhCollectionManager { library, database, @@ -76,7 +73,7 @@ impl MhCollectionManager { } } -impl CollectionManager for MhCollectionManager { +impl CollectionManager for MhCollectionManager { fn rescan_library(&mut self) -> Result<(), Error> { self.collection = self.library.list(&Query::default())?; Ok(()) @@ -127,8 +124,7 @@ mod tests { .times(1) .return_once(|_| database_result); - let mut collection_manager = - MhCollectionManager::new(Box::new(library), Box::new(database)); + let mut collection_manager = MhCollectionManager::new(library, Box::new(database)); collection_manager.rescan_library().unwrap(); assert_eq!(collection_manager.get_collection(), &*COLLECTION); @@ -147,8 +143,7 @@ mod tests { .times(1) .return_once(|_| library_result); - let mut collection_manager = - MhCollectionManager::new(Box::new(library), Box::new(database)); + let mut collection_manager = MhCollectionManager::new(library, Box::new(database)); let actual_err = collection_manager.rescan_library().unwrap_err(); let expected_err = Error::LibraryError( @@ -171,8 +166,7 @@ mod tests { .times(1) .return_once(|_| database_result); - let mut collection_manager = - MhCollectionManager::new(Box::new(library), Box::new(database)); + let mut collection_manager = MhCollectionManager::new(library, Box::new(database)); let actual_err = collection_manager.save_to_database().unwrap_err(); let expected_err = diff --git a/src/main.rs b/src/main.rs index 81a8fab..545e453 100644 --- a/src/main.rs +++ b/src/main.rs @@ -49,7 +49,7 @@ fn main() { &opt.database_file_path, ))); - let collection_manager = MhCollectionManager::new(Box::new(beets), Box::new(database)); + let collection_manager = MhCollectionManager::new(beets, Box::new(database)); // Initialize the terminal user interface. let backend = CrosstermBackend::new(io::stdout());