From e90b541af6aacfc03b765820b24ae2884838cb1b Mon Sep 17 00:00:00 2001 From: Wojciech Kozlowski Date: Fri, 9 Feb 2024 08:55:32 +0100 Subject: [PATCH] Lints --- src/core/collection/artist.rs | 2 +- src/core/collection/merge.rs | 2 +- src/core/musichoard/musichoard.rs | 30 +++++++++++++++--------------- src/tui/testmod.rs | 2 +- src/tui/ui.rs | 2 +- 5 files changed, 19 insertions(+), 19 deletions(-) diff --git a/src/core/collection/artist.rs b/src/core/collection/artist.rs index ca7c694..1e38609 100644 --- a/src/core/collection/artist.rs +++ b/src/core/collection/artist.rs @@ -1,5 +1,5 @@ use std::{ - collections::{HashMap, BTreeMap}, + collections::{BTreeMap, HashMap}, fmt::{self, Debug, Display}, mem, }; diff --git a/src/core/collection/merge.rs b/src/core/collection/merge.rs index 99cfc33..25e482c 100644 --- a/src/core/collection/merge.rs +++ b/src/core/collection/merge.rs @@ -1,4 +1,4 @@ -use std::{cmp::Ordering, iter::Peekable, collections::HashMap, hash::Hash}; +use std::{cmp::Ordering, collections::HashMap, hash::Hash, iter::Peekable}; /// A trait for merging two objects. The merge is asymmetric with the left argument considered to be /// the primary whose properties are to be kept in case of collisions. diff --git a/src/core/musichoard/musichoard.rs b/src/core/musichoard/musichoard.rs index 9ef25f5..552f542 100644 --- a/src/core/musichoard/musichoard.rs +++ b/src/core/musichoard/musichoard.rs @@ -124,9 +124,9 @@ impl MusicHoard { &mut self, artist_id: ID, ) -> Result<(), Error> { - Ok(self - .get_artist_mut_or_err(artist_id.as_ref())? - .clear_musicbrainz_url()) + self.get_artist_mut_or_err(artist_id.as_ref())? + .clear_musicbrainz_url(); + Ok(()) } pub fn add_to_property, S: AsRef + Into>( @@ -135,9 +135,9 @@ impl MusicHoard { property: S, values: Vec, ) -> Result<(), Error> { - Ok(self - .get_artist_mut_or_err(artist_id.as_ref())? - .add_to_property(property, values)) + self.get_artist_mut_or_err(artist_id.as_ref())? + .add_to_property(property, values); + Ok(()) } pub fn remove_from_property, S: AsRef>( @@ -146,9 +146,9 @@ impl MusicHoard { property: S, values: Vec, ) -> Result<(), Error> { - Ok(self - .get_artist_mut_or_err(artist_id.as_ref())? - .remove_from_property(property, values)) + self.get_artist_mut_or_err(artist_id.as_ref())? + .remove_from_property(property, values); + Ok(()) } pub fn set_property, S: AsRef + Into>( @@ -157,9 +157,9 @@ impl MusicHoard { property: S, values: Vec, ) -> Result<(), Error> { - Ok(self - .get_artist_mut_or_err(artist_id.as_ref())? - .set_property(property, values)) + self.get_artist_mut_or_err(artist_id.as_ref())? + .set_property(property, values); + Ok(()) } pub fn clear_property, S: AsRef>( @@ -167,9 +167,9 @@ impl MusicHoard { artist_id: ID, property: S, ) -> Result<(), Error> { - Ok(self - .get_artist_mut_or_err(artist_id.as_ref())? - .clear_property(property)) + self.get_artist_mut_or_err(artist_id.as_ref())? + .clear_property(property); + Ok(()) } fn sort(collection: &mut [Artist]) { diff --git a/src/tui/testmod.rs b/src/tui/testmod.rs index 3d89dde..7054f71 100644 --- a/src/tui/testmod.rs +++ b/src/tui/testmod.rs @@ -1,10 +1,10 @@ -use std::collections::HashMap; use musichoard::collection::{ album::{Album, AlbumId}, artist::{Artist, ArtistId, MusicBrainz}, track::{Format, Quality, Track, TrackId}, }; use once_cell::sync::Lazy; +use std::collections::HashMap; use crate::tests::*; diff --git a/src/tui/ui.rs b/src/tui/ui.rs index c9fc3e5..8d9d952 100644 --- a/src/tui/ui.rs +++ b/src/tui/ui.rs @@ -206,7 +206,7 @@ impl<'a> ArtistOverlay<'a> { list_indent: &str, ) -> String { let mut vec: Vec<(&str, &Vec)> = map.iter().map(|(k, v)| (k.as_ref(), v)).collect(); - vec.sort_by(|x, y| x.0.cmp(&y.0)); + vec.sort_by(|x, y| x.0.cmp(y.0)); let indent = format!("\n{item_indent}"); let list = vec