diff --git a/src/library/mod.rs b/src/library/mod.rs index c3f5d62..6fa2634 100644 --- a/src/library/mod.rs +++ b/src/library/mod.rs @@ -1,6 +1,6 @@ //! Module for interacting with the music library. -use std::{fmt, num::ParseIntError, str::Utf8Error}; +use std::{num::ParseIntError, str::Utf8Error}; use crate::Artist; @@ -128,12 +128,6 @@ impl From for Error { } } -impl fmt::Display for Error { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - write!(f, "{self:#?}") - } -} - /// Trait for interacting with the music library. pub trait Library { /// List lirbary items that match the a specific query. diff --git a/src/main.rs b/src/main.rs index 4847c96..0cfcfc8 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,4 +1,4 @@ -use std::{path::PathBuf, process::exit}; +use std::path::PathBuf; use structopt::StructOpt; @@ -40,18 +40,13 @@ fn main() { SystemExecutor::default().config(opt.beets_config_file_path.as_deref()), )); - let collection = match beets.list(&Query::new()) { - Ok(collection) => collection, - Err(e) => { - println!("{e}"); - exit(1) - } - }; + let collection = beets + .list(&Query::new()) + .expect("failed to query the library"); let mut database = DatabaseJson::new(Box::new(DatabaseJsonFile::new(&opt.database_file_path))); - if let Err(e) = database.write(&collection) { - println!("{e}"); - exit(1) - } + database + .write(&collection) + .expect("failed to write to the database"); }