Clippy cleanups
This commit is contained in:
@@ -95,8 +95,8 @@ impl Playlist {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn sort(&mut self, key: &SortKey, direction: &SortDirection) {
|
pub fn sort(&mut self, key: &SortKey, direction: &SortDirection) {
|
||||||
fn compare_artists(a: &Vec<String>, b: &Vec<String>) -> Ordering {
|
fn compare_artists(a: &[String], b: &[String]) -> Ordering {
|
||||||
let sanitize_artists_name = |x: &Vec<String>| -> Vec<String> {
|
let sanitize_artists_name = |x: &[String]| -> Vec<String> {
|
||||||
x.iter()
|
x.iter()
|
||||||
.map(|x| {
|
.map(|x| {
|
||||||
x.to_lowercase()
|
x.to_lowercase()
|
||||||
@@ -125,9 +125,9 @@ impl Playlist {
|
|||||||
if let Some(c) = self.tracks.as_mut() {
|
if let Some(c) = self.tracks.as_mut() {
|
||||||
c.sort_by(|a, b| match (a.track(), b.track()) {
|
c.sort_by(|a, b| match (a.track(), b.track()) {
|
||||||
(Some(a), Some(b)) => {
|
(Some(a), Some(b)) => {
|
||||||
let (a, b) = match direction {
|
let (a, b) = match *direction {
|
||||||
&SortDirection::Ascending => (a, b),
|
SortDirection::Ascending => (a, b),
|
||||||
&SortDirection::Descending => (b, a),
|
SortDirection::Descending => (b, a),
|
||||||
};
|
};
|
||||||
match *key {
|
match *key {
|
||||||
SortKey::Title => a.title.to_lowercase().cmp(&b.title.to_lowercase()),
|
SortKey::Title => a.title.to_lowercase().cmp(&b.title.to_lowercase()),
|
||||||
|
|||||||
@@ -417,14 +417,14 @@ pub fn send_notification(track_name: &str, _cover_url: Option<String>) {
|
|||||||
let path = crate::utils::cache_path_for_url(u.to_string());
|
let path = crate::utils::cache_path_for_url(u.to_string());
|
||||||
|
|
||||||
if !path.exists() {
|
if !path.exists() {
|
||||||
if let Err(e) = crate::utils::download(u.to_string(), path.clone()) {
|
if let Err(e) = crate::utils::download(u, path.clone()) {
|
||||||
error!("Failed to download cover: {}", e);
|
error!("Failed to download cover: {}", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Notification::new()
|
Notification::new()
|
||||||
.summary(track_name)
|
.summary(track_name)
|
||||||
.icon(&path.to_str().unwrap())
|
.icon(path.to_str().unwrap())
|
||||||
.show()
|
.show()
|
||||||
} else {
|
} else {
|
||||||
Notification::new().summary(track_name).show()
|
Notification::new().summary(track_name).show()
|
||||||
|
|||||||
Reference in New Issue
Block a user