Fix clippy lints for rust 1.75 #79
@ -222,7 +222,7 @@ pub struct Track {
|
|||||||
|
|
||||||
impl PartialOrd for Track {
|
impl PartialOrd for Track {
|
||||||
fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {
|
fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {
|
||||||
self.id.partial_cmp(&other.id)
|
Some(self.cmp(other))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -255,7 +255,7 @@ pub struct Album {
|
|||||||
|
|
||||||
impl PartialOrd for Album {
|
impl PartialOrd for Album {
|
||||||
fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {
|
fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {
|
||||||
self.id.partial_cmp(&other.id)
|
Some(self.cmp(other))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -309,7 +309,7 @@ pub struct Artist {
|
|||||||
|
|
||||||
impl PartialOrd for Artist {
|
impl PartialOrd for Artist {
|
||||||
fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {
|
fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {
|
||||||
self.id.partial_cmp(&other.id)
|
Some(self.cmp(other))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -151,6 +151,7 @@ mod tests {
|
|||||||
let io_err: Error = io::Error::new(io::ErrorKind::Interrupted, "Interrupted").into();
|
let io_err: Error = io::Error::new(io::ErrorKind::Interrupted, "Interrupted").into();
|
||||||
let inv_err = Error::Invalid(String::from("Invalid"));
|
let inv_err = Error::Invalid(String::from("Invalid"));
|
||||||
let int_err: Error = "five".parse::<u32>().unwrap_err().into();
|
let int_err: Error = "five".parse::<u32>().unwrap_err().into();
|
||||||
|
#[allow(invalid_from_utf8)]
|
||||||
let utf_err: Error = std::str::from_utf8(b"\xe2\x28\xa1").unwrap_err().into();
|
let utf_err: Error = std::str::from_utf8(b"\xe2\x28\xa1").unwrap_err().into();
|
||||||
|
|
||||||
assert!(!exe_err.to_string().is_empty());
|
assert!(!exe_err.to_string().is_empty());
|
||||||
|
@ -96,7 +96,7 @@ impl AlbumSelection {
|
|||||||
let track: TrackSelection;
|
let track: TrackSelection;
|
||||||
if let Some(albums) = albums {
|
if let Some(albums) = albums {
|
||||||
state.select(if !albums.is_empty() { Some(0) } else { None });
|
state.select(if !albums.is_empty() { Some(0) } else { None });
|
||||||
track = TrackSelection::initialise(albums.get(0).map(|a| a.tracks.as_slice()));
|
track = TrackSelection::initialise(albums.first().map(|a| a.tracks.as_slice()));
|
||||||
} else {
|
} else {
|
||||||
state.select(None);
|
state.select(None);
|
||||||
track = TrackSelection::initialise(None);
|
track = TrackSelection::initialise(None);
|
||||||
@ -143,7 +143,7 @@ impl ArtistSelection {
|
|||||||
let album: AlbumSelection;
|
let album: AlbumSelection;
|
||||||
if let Some(artists) = artists {
|
if let Some(artists) = artists {
|
||||||
state.select(if !artists.is_empty() { Some(0) } else { None });
|
state.select(if !artists.is_empty() { Some(0) } else { None });
|
||||||
album = AlbumSelection::initialise(artists.get(0).map(|a| a.albums.as_slice()));
|
album = AlbumSelection::initialise(artists.first().map(|a| a.albums.as_slice()));
|
||||||
} else {
|
} else {
|
||||||
state.select(None);
|
state.select(None);
|
||||||
album = AlbumSelection::initialise(None);
|
album = AlbumSelection::initialise(None);
|
||||||
@ -417,7 +417,7 @@ impl<'a> ArtistOverlay<'a> {
|
|||||||
opt_vec
|
opt_vec
|
||||||
.map(|vec| {
|
.map(|vec| {
|
||||||
if vec.len() < 2 {
|
if vec.len() < 2 {
|
||||||
vec.get(0).map(|item| item.url()).unwrap_or("").to_string()
|
vec.first().map(|item| item.url()).unwrap_or("").to_string()
|
||||||
} else {
|
} else {
|
||||||
let indent = format!("\n{indent}");
|
let indent = format!("\n{indent}");
|
||||||
let list = vec
|
let list = vec
|
||||||
@ -474,9 +474,7 @@ impl<'a, 'b> AlbumState<'a, 'b> {
|
|||||||
"Title: {}\n\
|
"Title: {}\n\
|
||||||
Year: {}",
|
Year: {}",
|
||||||
album.map(|a| a.id.title.as_str()).unwrap_or(""),
|
album.map(|a| a.id.title.as_str()).unwrap_or(""),
|
||||||
album
|
album.map(|a| a.id.year.to_string()).unwrap_or_default(),
|
||||||
.map(|a| a.id.year.to_string())
|
|
||||||
.unwrap_or_else(|| "".to_string()),
|
|
||||||
));
|
));
|
||||||
|
|
||||||
AlbumState {
|
AlbumState {
|
||||||
@ -510,19 +508,15 @@ impl<'a, 'b> TrackState<'a, 'b> {
|
|||||||
Title: {}\n\
|
Title: {}\n\
|
||||||
Artist: {}\n\
|
Artist: {}\n\
|
||||||
Quality: {}",
|
Quality: {}",
|
||||||
track
|
track.map(|t| t.id.number.to_string()).unwrap_or_default(),
|
||||||
.map(|t| t.id.number.to_string())
|
|
||||||
.unwrap_or_else(|| "".to_string()),
|
|
||||||
track.map(|t| t.id.title.as_str()).unwrap_or(""),
|
track.map(|t| t.id.title.as_str()).unwrap_or(""),
|
||||||
track
|
track.map(|t| t.artist.join("; ")).unwrap_or_default(),
|
||||||
.map(|t| t.artist.join("; "))
|
|
||||||
.unwrap_or_else(|| "".to_string()),
|
|
||||||
track
|
track
|
||||||
.map(|t| match t.quality.format {
|
.map(|t| match t.quality.format {
|
||||||
Format::Flac => "FLAC".to_string(),
|
Format::Flac => "FLAC".to_string(),
|
||||||
Format::Mp3 => format!("MP3 {}kbps", t.quality.bitrate),
|
Format::Mp3 => format!("MP3 {}kbps", t.quality.bitrate),
|
||||||
})
|
})
|
||||||
.unwrap_or_else(|| "".to_string()),
|
.unwrap_or_default(),
|
||||||
));
|
));
|
||||||
|
|
||||||
TrackState {
|
TrackState {
|
||||||
|
Loading…
Reference in New Issue
Block a user