cargo fmt/clippy all the things + make them mandatory in CI
This commit is contained in:
@@ -54,10 +54,26 @@ impl SearchView {
|
||||
.with_id(EDIT_ID);
|
||||
|
||||
let tabs = TabView::new()
|
||||
.tab("tracks", "Tracks", ListView::new(results_tracks.clone(), queue.clone()))
|
||||
.tab("albums", "Albums", ListView::new(results_albums.clone(), queue.clone()))
|
||||
.tab("artists", "Artists", ListView::new(results_artists.clone(), queue.clone()))
|
||||
.tab("playlists", "Playlists", ListView::new(results_playlists.clone(), queue.clone()));
|
||||
.tab(
|
||||
"tracks",
|
||||
"Tracks",
|
||||
ListView::new(results_tracks.clone(), queue.clone()),
|
||||
)
|
||||
.tab(
|
||||
"albums",
|
||||
"Albums",
|
||||
ListView::new(results_albums.clone(), queue.clone()),
|
||||
)
|
||||
.tab(
|
||||
"artists",
|
||||
"Artists",
|
||||
ListView::new(results_artists.clone(), queue.clone()),
|
||||
)
|
||||
.tab(
|
||||
"playlists",
|
||||
"Playlists",
|
||||
ListView::new(results_playlists.clone(), queue.clone()),
|
||||
);
|
||||
|
||||
SearchView {
|
||||
results_tracks,
|
||||
@@ -79,52 +95,25 @@ impl SearchView {
|
||||
});
|
||||
}
|
||||
|
||||
fn search_track(
|
||||
spotify: Arc<Spotify>,
|
||||
tracks: Arc<RwLock<Vec<Track>>>,
|
||||
query: String,
|
||||
) {
|
||||
fn search_track(spotify: Arc<Spotify>, tracks: Arc<RwLock<Vec<Track>>>, query: String) {
|
||||
if let Some(results) = spotify.search_track(&query, 50, 0) {
|
||||
let t = results
|
||||
.tracks
|
||||
.items
|
||||
.iter()
|
||||
.map(|ft| ft.into())
|
||||
.collect();
|
||||
let t = results.tracks.items.iter().map(|ft| ft.into()).collect();
|
||||
let mut r = tracks.write().unwrap();
|
||||
*r = t;
|
||||
}
|
||||
}
|
||||
|
||||
fn search_album(
|
||||
spotify: Arc<Spotify>,
|
||||
albums: Arc<RwLock<Vec<Album>>>,
|
||||
query: String,
|
||||
) {
|
||||
fn search_album(spotify: Arc<Spotify>, albums: Arc<RwLock<Vec<Album>>>, query: String) {
|
||||
if let Some(results) = spotify.search_album(&query, 50, 0) {
|
||||
let a = results
|
||||
.albums
|
||||
.items
|
||||
.iter()
|
||||
.map(|sa| sa.into())
|
||||
.collect();
|
||||
let a = results.albums.items.iter().map(|sa| sa.into()).collect();
|
||||
let mut r = albums.write().unwrap();
|
||||
*r = a;
|
||||
}
|
||||
}
|
||||
|
||||
fn search_artist(
|
||||
spotify: Arc<Spotify>,
|
||||
artists: Arc<RwLock<Vec<Artist>>>,
|
||||
query: String,
|
||||
) {
|
||||
fn search_artist(spotify: Arc<Spotify>, artists: Arc<RwLock<Vec<Artist>>>, query: String) {
|
||||
if let Some(results) = spotify.search_artist(&query, 50, 0) {
|
||||
let a = results
|
||||
.artists
|
||||
.items
|
||||
.iter()
|
||||
.map(|fa| fa.into())
|
||||
.collect();
|
||||
let a = results.artists.items.iter().map(|fa| fa.into()).collect();
|
||||
let mut r = artists.write().unwrap();
|
||||
*r = a;
|
||||
}
|
||||
|
||||
@@ -40,7 +40,13 @@ impl View for StatusBar {
|
||||
ColorType::Palette(PaletteColor::Background),
|
||||
);
|
||||
let style_bar_bg = ColorStyle::new(
|
||||
ColorType::Color(*printer.theme.palette.custom("statusbar_progress_bg").unwrap()),
|
||||
ColorType::Color(
|
||||
*printer
|
||||
.theme
|
||||
.palette
|
||||
.custom("statusbar_progress_bg")
|
||||
.unwrap(),
|
||||
),
|
||||
ColorType::Palette(PaletteColor::Background),
|
||||
);
|
||||
let style = ColorStyle::new(
|
||||
|
||||
@@ -8,7 +8,7 @@ use cursive::{Cursive, Printer, Vec2};
|
||||
use unicode_width::UnicodeWidthStr;
|
||||
|
||||
use commands::CommandResult;
|
||||
use traits::{ViewExt, IntoBoxedViewExt};
|
||||
use traits::{IntoBoxedViewExt, ViewExt};
|
||||
|
||||
pub struct Tab {
|
||||
title: String,
|
||||
@@ -18,7 +18,7 @@ pub struct Tab {
|
||||
pub struct TabView {
|
||||
tabs: Vec<Tab>,
|
||||
ids: HashMap<String, usize>,
|
||||
selected: usize
|
||||
selected: usize,
|
||||
}
|
||||
|
||||
impl TabView {
|
||||
@@ -26,14 +26,14 @@ impl TabView {
|
||||
Self {
|
||||
tabs: Vec::new(),
|
||||
ids: HashMap::new(),
|
||||
selected: 0
|
||||
selected: 0,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn add_tab<S: Into<String>, V: IntoBoxedViewExt>(&mut self, id: S, title: S, view: V) {
|
||||
let tab = Tab {
|
||||
title: title.into(),
|
||||
view: view.as_boxed_view_ext()
|
||||
view: view.as_boxed_view_ext(),
|
||||
};
|
||||
self.tabs.push(tab);
|
||||
self.ids.insert(id.into(), self.tabs.len() - 1);
|
||||
@@ -57,7 +57,7 @@ impl TabView {
|
||||
|
||||
impl View for TabView {
|
||||
fn draw(&self, printer: &Printer<'_, '_>) {
|
||||
if self.tabs.len() == 0 {
|
||||
if self.tabs.is_empty() {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user