Create the main binary #15

Merged
wojtek merged 4 commits from 7---create-the-main-binary into main 2023-04-10 00:13:18 +02:00
4 changed files with 15 additions and 10 deletions
Showing only changes of commit 5b4185df22 - Show all commits

View File

@ -1,7 +1,7 @@
//! Module for storing MusicHoard data in a JSON file database.
use std::fs;
use std::path::{PathBuf, Path};
use std::path::{Path, PathBuf};
use serde::de::DeserializeOwned;
use serde::Serialize;
@ -57,7 +57,9 @@ pub struct DatabaseJsonFile {
impl DatabaseJsonFile {
/// Create a database instance that will read/write to the provided path.
pub fn new(path: &Path) -> Self {
DatabaseJsonFile { path: path.to_path_buf() }
DatabaseJsonFile {
path: path.to_path_buf(),
}
}
}

View File

@ -32,7 +32,7 @@ impl<T: SimpleOption + Display> QueryOptionArgBeets for QueryOption<T> {
Self::Exclude(value) => ("^", value),
Self::None => return None,
};
Some(format!("{}{}{}", negate, option_name, value))
Some(format!("{negate}{option_name}{value}"))
}
}
@ -43,7 +43,7 @@ impl QueryOptionArgBeets for QueryOption<Vec<String>> {
Self::Exclude(value) => ("^", value),
Self::None => return None,
};
Some(format!("{}{}{}", negate, option_name, vec.join("; ")))
Some(format!("{negate}{option_name}{}", vec.join("; ")))
}
}

View File

@ -1,6 +1,6 @@
//! Module for interacting with the music library.
use std::{num::ParseIntError, str::Utf8Error, fmt};
use std::{fmt, num::ParseIntError, str::Utf8Error};
use crate::Artist;
@ -130,7 +130,7 @@ impl From<Utf8Error> for Error {
impl fmt::Display for Error {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{:#?}", self)
write!(f, "{self:#?}")
}
}

View File

@ -1,9 +1,12 @@
use std::fs;
use musichoard::{database::{
json::{DatabaseJson, DatabaseJsonFile},
DatabaseRead, DatabaseWrite,
}, Artist};
use musichoard::{
database::{
json::{DatabaseJson, DatabaseJsonFile},
DatabaseRead, DatabaseWrite,
},
Artist,
};
use tempfile::NamedTempFile;
use crate::COLLECTION;