Linter suggestions

This commit is contained in:
Antoine Gersant 2022-11-08 02:04:54 -08:00
parent 63e971059a
commit a5f5a77100
3 changed files with 6 additions and 6 deletions

View file

@ -103,7 +103,7 @@ impl FrameContent for id3::Tag {
}
fn read_mp3(path: &Path) -> Result<SongTags> {
let tag = id3::Tag::read_from_path(&path).or_else(|error| {
let tag = id3::Tag::read_from_path(path).or_else(|error| {
if let Some(tag) = error.partial_tag {
Ok(tag)
} else {
@ -112,7 +112,7 @@ fn read_mp3(path: &Path) -> Result<SongTags> {
})?;
let duration = {
mp3_duration::from_path(&path)
mp3_duration::from_path(path)
.map(|d| d.as_secs() as u32)
.ok()
};
@ -123,7 +123,7 @@ fn read_mp3(path: &Path) -> Result<SongTags> {
}
fn read_aiff(path: &Path) -> Result<SongTags> {
let tag = id3::Tag::read_from_aiff_path(&path).or_else(|error| {
let tag = id3::Tag::read_from_aiff_path(path).or_else(|error| {
if let Some(tag) = error.partial_tag {
Ok(tag)
} else {
@ -134,7 +134,7 @@ fn read_aiff(path: &Path) -> Result<SongTags> {
}
fn read_wave(path: &Path) -> Result<SongTags> {
let tag = id3::Tag::read_from_wav_path(&path).or_else(|error| {
let tag = id3::Tag::read_from_wav_path(path).or_else(|error| {
if let Some(tag) = error.partial_tag {
Ok(tag)
} else {

View file

@ -82,7 +82,7 @@ impl Index {
let vfs = self.vfs_manager.get_vfs()?;
let mut connection = self.db.connect()?;
let real_songs: Vec<Song> = if virtual_path.as_ref().parent() != None {
let real_songs: Vec<Song> = if virtual_path.as_ref().parent().is_some() {
let real_path = vfs
.virtual_to_real(virtual_path)
.map_err(|_| QueryError::VFSPathNotFound)?;

View file

@ -40,7 +40,7 @@ impl diesel::r2d2::CustomizeConnection<SqliteConnection, diesel::r2d2::Error>
impl DB {
pub fn new(path: &Path) -> Result<DB> {
std::fs::create_dir_all(&path.parent().unwrap())?;
std::fs::create_dir_all(path.parent().unwrap())?;
let manager = ConnectionManager::<SqliteConnection>::new(path.to_string_lossy());
let pool = diesel::r2d2::Pool::builder()
.connection_customizer(Box::new(ConnectionCustomizer {}))