diff --git a/src/album.rs b/src/album.rs index 5e42128..4bea787 100644 --- a/src/album.rs +++ b/src/album.rs @@ -93,7 +93,7 @@ impl From<&FullAlbum> for Album { fa.tracks .items .iter() - .map(|st| Track::from_simplified_track(&st, &fa)) + .map(|st| Track::from_simplified_track(st, fa)) .collect(), ); diff --git a/src/authentication.rs b/src/authentication.rs index 43a218c..2e0bf76 100644 --- a/src/authentication.rs +++ b/src/authentication.rs @@ -65,7 +65,7 @@ pub fn create_credentials() -> Result { .child(controls); let url = &urls["login_url"]; webbrowser::open(url).ok(); - auth_poller(&urls["credentials_url"], &s.cb_sink()); + auth_poller(&urls["credentials_url"], s.cb_sink()); s.pop_layer(); s.add_layer(login_view) }) diff --git a/src/command.rs b/src/command.rs index a1d884d..7adb5a7 100644 --- a/src/command.rs +++ b/src/command.rs @@ -1,7 +1,6 @@ use crate::queue::RepeatSetting; use std::collections::HashMap; use std::fmt; -use std::iter::FromIterator; use strum_macros::Display; @@ -235,7 +234,7 @@ fn handle_aliases(input: &str) -> &str { pub fn parse(input: &str) -> Option { let components: Vec<_> = input.trim().split(' ').collect(); - let command = handle_aliases(&components[0]); + let command = handle_aliases(components[0]); let args = components[1..].to_vec(); match command { diff --git a/src/commands.rs b/src/commands.rs index 060290f..4dd6e8c 100644 --- a/src/commands.rs +++ b/src/commands.rs @@ -321,7 +321,7 @@ impl CommandManager { let kb = self.bindings.borrow(); for (k, _v) in kb.iter() { - if let Some(binding) = Self::parse_keybinding(&k) { + if let Some(binding) = Self::parse_keybinding(k) { cursive.clear_global_callbacks(binding); } } @@ -331,10 +331,10 @@ impl CommandManager { let kb = self.bindings.borrow(); for (k, v) in kb.iter() { - if let Some(binding) = Self::parse_keybinding(&k) { + if let Some(binding) = Self::parse_keybinding(k) { self.register_keybinding(cursive, binding, v.clone()); } else { - error!("Could not parse keybinding: \"{}\"", &k); + error!("Could not parse keybinding: \"{}\"", k); } } } @@ -521,7 +521,7 @@ impl CommandManager { None } } else { - Some(Self::parse_key(&kb)) + Some(Self::parse_key(kb)) } } } diff --git a/src/library.rs b/src/library.rs index 2099fd0..d45f7fa 100644 --- a/src/library.rs +++ b/src/library.rs @@ -127,7 +127,7 @@ impl Library { let pos = { let store = self.playlists.read().expect("can't readlock playlists"); - store.iter().position(|ref i| i.id == id) + store.iter().position(|i| i.id == id) }; if let Some(position) = pos { @@ -143,7 +143,7 @@ impl Library { pub fn overwrite_playlist(&self, id: &str, tracks: &[Playable]) { debug!("saving {} tracks to list {}", tracks.len(), id); - self.spotify.overwrite_playlist(id, &tracks); + self.spotify.overwrite_playlist(id, tracks); self.fetch_playlists(); self.save_cache(config::cache_path(CACHE_PLAYLISTS), self.playlists.clone()); @@ -152,7 +152,7 @@ impl Library { pub fn save_playlist(&self, name: &str, tracks: &[Playable]) { debug!("saving {} tracks to new list {}", tracks.len(), name); match self.spotify.create_playlist(name, None, None) { - Some(id) => self.overwrite_playlist(&id, &tracks), + Some(id) => self.overwrite_playlist(&id, tracks), None => error!("could not create new playlist.."), } } diff --git a/src/mpris.rs b/src/mpris.rs index 36e46ee..15828c6 100644 --- a/src/mpris.rs +++ b/src/mpris.rs @@ -558,7 +558,7 @@ fn run_dbus_server( let uri_type = UriType::from_uri(&uri); match uri_type { Some(UriType::Album) => { - if let Some(a) = spotify.album(&id) { + if let Some(a) = spotify.album(id) { if let Some(t) = &Album::from(&a).tracks { queue.clear(); let index = queue.append_next( @@ -571,14 +571,14 @@ fn run_dbus_server( } } Some(UriType::Track) => { - if let Some(t) = spotify.track(&id) { + if let Some(t) = spotify.track(id) { queue.clear(); queue.append(Playable::Track(Track::from(&t))); queue.play(0, false, false) } } Some(UriType::Playlist) => { - if let Some(p) = spotify.playlist(&id) { + if let Some(p) = spotify.playlist(id) { let mut playlist = Playlist::from(&p); let spotify = spotify.clone(); playlist.load_tracks(spotify); @@ -594,7 +594,7 @@ fn run_dbus_server( } } Some(UriType::Show) => { - if let Some(s) = spotify.get_show(&id) { + if let Some(s) = spotify.get_show(id) { let mut show: Show = (&s).into(); let spotify = spotify.clone(); show.load_all_episodes(spotify); @@ -612,14 +612,14 @@ fn run_dbus_server( } } Some(UriType::Episode) => { - if let Some(e) = spotify.episode(&id) { + if let Some(e) = spotify.episode(id) { queue.clear(); queue.append(Playable::Episode(Episode::from(&e))); queue.play(0, false, false) } } Some(UriType::Artist) => { - if let Some(a) = spotify.artist_top_tracks(&id) { + if let Some(a) = spotify.artist_top_tracks(id) { queue.clear(); queue.append_next(a.iter().map(|track| Playable::Track(track.clone())).collect()); queue.play(0, false, false) diff --git a/src/playlist.rs b/src/playlist.rs index 02e197b..f548cc0 100644 --- a/src/playlist.rs +++ b/src/playlist.rs @@ -58,7 +58,7 @@ impl Playlist { true => { if let Some(tracks) = &mut self.tracks { tracks.remove(index); - library.playlist_update(&self); + library.playlist_update(self); } true diff --git a/src/queue.rs b/src/queue.rs index d7ff6cb..e2d5ca6 100644 --- a/src/queue.rs +++ b/src/queue.rs @@ -261,7 +261,7 @@ impl Queue { } if let Some(track) = &self.queue.read().unwrap().get(index) { - self.spotify.load(&track, true, 0); + self.spotify.load(track, true, 0); let mut current = self.current_track.write().unwrap(); current.replace(index); self.spotify.update_track(); diff --git a/src/spotify.rs b/src/spotify.rs index 4998c4a..d8b43c7 100644 --- a/src/spotify.rs +++ b/src/spotify.rs @@ -360,12 +360,7 @@ impl Spotify { position: Option, ) -> bool { self.api_with_retry(|api| { - api.user_playlist_add_tracks( - self.user.as_ref().unwrap(), - playlist_id, - &tracks, - position, - ) + api.user_playlist_add_tracks(self.user.as_ref().unwrap(), playlist_id, tracks, position) }) .is_some() } diff --git a/src/track.rs b/src/track.rs index ebfa079..871a555 100644 --- a/src/track.rs +++ b/src/track.rs @@ -81,7 +81,7 @@ impl From<&SimplifiedTrack> for Track { let artists = track .artists .iter() - .map(|ref artist| artist.name.clone()) + .map(|artist| artist.name.clone()) .collect::>(); let artist_ids = track .artists @@ -114,7 +114,7 @@ impl From<&FullTrack> for Track { let artists = track .artists .iter() - .map(|ref artist| artist.name.clone()) + .map(|artist| artist.name.clone()) .collect::>(); let artist_ids = track .artists @@ -125,7 +125,7 @@ impl From<&FullTrack> for Track { .album .artists .iter() - .map(|ref artist| artist.name.clone()) + .map(|artist| artist.name.clone()) .collect::>(); Self { @@ -283,7 +283,7 @@ impl ListItem for Track { let spotify = queue.get_spotify(); match self.album_id { - Some(ref album_id) => spotify.album(&album_id).map(|ref fa| fa.into()), + Some(ref album_id) => spotify.album(album_id).map(|ref fa| fa.into()), None => None, } } diff --git a/src/ui/artist.rs b/src/ui/artist.rs index 1768c51..83121f9 100644 --- a/src/ui/artist.rs +++ b/src/ui/artist.rs @@ -26,9 +26,9 @@ impl ArtistView { let spotify = queue.get_spotify(); let albums_view = - Self::albums_view(&artist, AlbumType::Album, queue.clone(), library.clone()); + Self::albums_view(artist, AlbumType::Album, queue.clone(), library.clone()); let singles_view = - Self::albums_view(&artist, AlbumType::Single, queue.clone(), library.clone()); + Self::albums_view(artist, AlbumType::Single, queue.clone(), library.clone()); let top_tracks: Arc>> = Arc::new(RwLock::new(Vec::new())); { diff --git a/src/ui/layout.rs b/src/ui/layout.rs index 26b704e..d24a2b9 100644 --- a/src/ui/layout.rs +++ b/src/ui/layout.rs @@ -256,7 +256,7 @@ impl View for Layout { if cmdline_visible { let printer = &printer.offset((0, printer.size.y - 1)); - self.cmdline.draw(&printer); + self.cmdline.draw(printer); } } diff --git a/src/ui/search_results.rs b/src/ui/search_results.rs index 35d52a6..7fb7e58 100644 --- a/src/ui/search_results.rs +++ b/src/ui/search_results.rs @@ -109,7 +109,7 @@ impl SearchResultsView { _offset: usize, _append: bool, ) -> u32 { - if let Some(results) = spotify.track(&query) { + if let Some(results) = spotify.track(query) { let t = vec![(&results).into()]; let mut r = tracks.write().unwrap(); *r = t; @@ -126,7 +126,7 @@ impl SearchResultsView { append: bool, ) -> u32 { if let Some(SearchResult::Tracks(results)) = - spotify.search(SearchType::Track, &query, 50, offset as u32) + spotify.search(SearchType::Track, query, 50, offset as u32) { let mut t = results.items.iter().map(|ft| ft.into()).collect(); let mut r = tracks.write().unwrap(); @@ -148,7 +148,7 @@ impl SearchResultsView { _offset: usize, _append: bool, ) -> u32 { - if let Some(results) = spotify.album(&query) { + if let Some(results) = spotify.album(query) { let a = vec![(&results).into()]; let mut r = albums.write().unwrap(); *r = a; @@ -165,7 +165,7 @@ impl SearchResultsView { append: bool, ) -> u32 { if let Some(SearchResult::Albums(results)) = - spotify.search(SearchType::Album, &query, 50, offset as u32) + spotify.search(SearchType::Album, query, 50, offset as u32) { let mut a = results.items.iter().map(|sa| sa.into()).collect(); let mut r = albums.write().unwrap(); @@ -187,7 +187,7 @@ impl SearchResultsView { _offset: usize, _append: bool, ) -> u32 { - if let Some(results) = spotify.artist(&query) { + if let Some(results) = spotify.artist(query) { let a = vec![(&results).into()]; let mut r = artists.write().unwrap(); *r = a; @@ -204,7 +204,7 @@ impl SearchResultsView { append: bool, ) -> u32 { if let Some(SearchResult::Artists(results)) = - spotify.search(SearchType::Artist, &query, 50, offset as u32) + spotify.search(SearchType::Artist, query, 50, offset as u32) { let mut a = results.items.iter().map(|fa| fa.into()).collect(); let mut r = artists.write().unwrap(); @@ -226,7 +226,7 @@ impl SearchResultsView { _offset: usize, _append: bool, ) -> u32 { - if let Some(result) = spotify.playlist(&query).as_ref() { + if let Some(result) = spotify.playlist(query).as_ref() { let pls = vec![result.into()]; let mut r = playlists.write().unwrap(); *r = pls; @@ -243,7 +243,7 @@ impl SearchResultsView { append: bool, ) -> u32 { if let Some(SearchResult::Playlists(results)) = - spotify.search(SearchType::Playlist, &query, 50, offset as u32) + spotify.search(SearchType::Playlist, query, 50, offset as u32) { let mut pls = results.items.iter().map(|sp| sp.into()).collect(); let mut r = playlists.write().unwrap(); @@ -265,7 +265,7 @@ impl SearchResultsView { _offset: usize, _append: bool, ) -> u32 { - if let Some(result) = spotify.get_show(&query).as_ref() { + if let Some(result) = spotify.get_show(query).as_ref() { let pls = vec![result.into()]; let mut r = shows.write().unwrap(); *r = pls; @@ -282,7 +282,7 @@ impl SearchResultsView { append: bool, ) -> u32 { if let Some(SearchResult::Shows(results)) = - spotify.search(SearchType::Show, &query, 50, offset as u32) + spotify.search(SearchType::Show, query, 50, offset as u32) { let mut pls = results.items.iter().map(|sp| sp.into()).collect(); let mut r = shows.write().unwrap(); @@ -304,7 +304,7 @@ impl SearchResultsView { _offset: usize, _append: bool, ) -> u32 { - if let Some(result) = spotify.episode(&query).as_ref() { + if let Some(result) = spotify.episode(query).as_ref() { let e = vec![result.into()]; let mut r = episodes.write().unwrap(); *r = e; @@ -321,7 +321,7 @@ impl SearchResultsView { append: bool, ) -> u32 { if let Some(SearchResult::Episodes(results)) = - spotify.search(SearchType::Episode, &query, 50, offset as u32) + spotify.search(SearchType::Episode, query, 50, offset as u32) { let mut e = results.items.iter().map(|se| se.into()).collect(); let mut r = episodes.write().unwrap();