cargo clippy

This commit is contained in:
Henrik Friedrichsen
2020-08-23 20:35:16 +02:00
parent 1edf28a165
commit 6f7b64c908
6 changed files with 9 additions and 10 deletions

View File

@@ -138,7 +138,7 @@ impl ListItem for Album {
.unwrap()
.iter()
.filter(|t| t.id().is_some())
.map(|t| t.id().clone().unwrap())
.map(|t| t.id().unwrap())
.collect();
let ids: Vec<String> = tracks
.iter()

View File

@@ -127,7 +127,7 @@ impl ListItem for Artist {
.unwrap()
.iter()
.filter(|t| t.id().is_some())
.map(|t| t.id().clone().unwrap())
.map(|t| t.id().unwrap())
.collect();
let ids: Vec<String> = tracks
.iter()

View File

@@ -191,7 +191,6 @@ impl CommandManager {
let local = if let Some(mut contextmenu) = s.find_name::<ContextMenu>("contextmenu") {
contextmenu.on_command(s, cmd)?
} else {
debug!("no contextmenu");
let mut main = s
.find_name::<Layout>("main")
.expect("could not find layout");

View File

@@ -42,7 +42,7 @@ fn get_metadata(playable: Option<Playable>) -> Metadata {
"/org/ncspot/{}",
playable
.map(|t| t.uri().replace(':', "/"))
.unwrap_or("0".to_string())
.unwrap_or_else(|| "0".to_string())
)))),
);
hm.insert(
@@ -65,7 +65,7 @@ fn get_metadata(playable: Option<Playable>) -> Metadata {
Variant(Box::new(
playable
.and_then(|p| p.track())
.map(|t| t.album.clone())
.map(|t| t.album)
.unwrap_or_default(),
)),
);
@@ -74,7 +74,7 @@ fn get_metadata(playable: Option<Playable>) -> Metadata {
Variant(Box::new(
playable
.and_then(|p| p.track())
.map(|t| t.album_artists.clone())
.map(|t| t.album_artists)
.unwrap_or_default(),
)),
);
@@ -83,7 +83,7 @@ fn get_metadata(playable: Option<Playable>) -> Metadata {
Variant(Box::new(
playable
.and_then(|p| p.track())
.map(|t| t.artists.clone())
.map(|t| t.artists)
.unwrap_or_default(),
)),
);

View File

@@ -107,7 +107,7 @@ impl ListItem for Playlist {
.unwrap()
.iter()
.filter(|t| t.id().is_some())
.map(|t| t.id().clone().unwrap())
.map(|t| t.id().unwrap())
.collect();
let ids: Vec<String> = tracks
.iter()

View File

@@ -337,7 +337,7 @@ impl Spotify {
core.run(Session::connect(config, credentials, None, handle))
});
match jh.join() {
Ok(session) => session.or_else(Err),
Ok(session) => session,
Err(e) => Err(io::Error::new(
io::ErrorKind::Other,
e.downcast_ref::<String>()
@@ -590,7 +590,7 @@ impl Spotify {
let mut tracks: Vec<String> = tracks
.iter()
.filter(|track| track.id().is_some())
.map(|track| track.id().clone().unwrap())
.map(|track| track.id().unwrap())
.collect();
// we can only send 100 tracks per request