cargo fmt/clippy

This commit is contained in:
Henrik Friedrichsen
2021-01-10 01:54:54 +01:00
parent def01494db
commit 9afad2d91c
4 changed files with 14 additions and 12 deletions

View File

@@ -7,7 +7,7 @@ use crate::events::EventManager;
use crate::library::Library;
use crate::queue::{Queue, RepeatSetting};
use crate::spotify::{Spotify, VOLUME_PERCENT};
use crate::traits::{ViewExt, IntoBoxedViewExt};
use crate::traits::{IntoBoxedViewExt, ViewExt};
use crate::ui::contextmenu::ContextMenu;
use crate::ui::help::HelpView;
use crate::ui::layout::Layout;
@@ -216,7 +216,9 @@ impl CommandManager {
self.queue.clone(),
self.library.clone(),
);
s.call_on_name("main", |v: &mut Layout| v.push_view(view.as_boxed_view_ext()));
s.call_on_name("main", |v: &mut Layout| {
v.push_view(view.as_boxed_view_ext())
});
Ok(None)
}
Command::Jump(_)

View File

@@ -12,7 +12,6 @@ use librespot_playback::config::Bitrate;
use librespot_playback::mixer::Mixer;
use librespot_playback::player::{Player, PlayerEvent as LibrespotPlayerEvent};
use rspotify::{blocking::client::ApiError, senum::Country};
use rspotify::blocking::client::Spotify as SpotifyAPI;
use rspotify::model::album::{FullAlbum, SavedAlbum, SimplifiedAlbum};
use rspotify::model::artist::FullArtist;
@@ -22,6 +21,7 @@ use rspotify::model::search::SearchResult;
use rspotify::model::track::{FullTrack, SavedTrack, SimplifiedTrack};
use rspotify::model::user::PrivateUser;
use rspotify::senum::SearchType;
use rspotify::{blocking::client::ApiError, senum::Country};
use serde_json::{json, Map};
@@ -774,7 +774,9 @@ impl Spotify {
}
pub fn show_episodes(&self, show_id: &str, offset: u32) -> Option<Page<SimplifiedEpisode>> {
self.api_with_retry(|api| api.get_shows_episodes(show_id.to_string(), 50, offset, self.country))
self.api_with_retry(|api| {
api.get_shows_episodes(show_id.to_string(), 50, offset, self.country)
})
}
pub fn get_saved_shows(&self, offset: u32) -> Option<Page<Show>> {

View File

@@ -35,7 +35,7 @@ pub struct SelectArtistMenu {
enum ContextMenuAction {
ShowItem(Box<dyn ListItem>),
SelectArtist(Box<Vec<Artist>>),
SelectArtist(Vec<Artist>),
ShareUrl(String),
AddToPlaylist(Box<Track>),
ShowRecommentations(Box<dyn ListItem>),
@@ -142,14 +142,11 @@ impl ContextMenu {
let action = match a.len() {
0 => None,
1 => Some(ContextMenuAction::ShowItem(Box::new(a[0].clone()))),
_ => Some(ContextMenuAction::SelectArtist(Box::new(a))),
_ => Some(ContextMenuAction::SelectArtist(a)),
};
if let Some(a) = action {
content.add_item(
"Show artist",
a
)
content.add_item("Show artist", a)
}
}
if let Some(a) = item.album(queue.clone()) {
@@ -208,7 +205,7 @@ impl ContextMenu {
track.toggle_saved(library);
}
ContextMenuAction::SelectArtist(artists) => {
let dialog = Self::select_artist_dialog(library, queue, *artists.clone());
let dialog = Self::select_artist_dialog(library, queue, artists.clone());
s.add_layer(dialog);
}
}

View File

@@ -621,7 +621,8 @@ impl<I: ListItem + Clone> ViewExt for ListView<I> {
return match artists.len() {
0 => Ok(CommandResult::Consumed(None)),
1 => {
let view = ArtistView::new(queue, library, &artists[0]).as_boxed_view_ext();
let view = ArtistView::new(queue, library, &artists[0])
.as_boxed_view_ext();
Ok(CommandResult::View(view))
}
_ => {