Clean up clippy warnings

This commit is contained in:
Henrik Friedrichsen
2022-04-27 22:41:04 +02:00
parent d1a44a613f
commit 0bbb4932e5
4 changed files with 4 additions and 6 deletions

View File

@@ -250,8 +250,7 @@ impl ListItem for Album {
.tracks
.as_ref()?
.iter()
.map(|t| t.id.as_deref())
.flatten()
.filter_map(|t| t.id.as_deref())
// spotify allows at max 5 seed items, so choose 4 random tracks...
.choose_multiple(&mut thread_rng(), MAX_SEEDS - 1);

View File

@@ -287,8 +287,7 @@ impl ListItem for Playlist {
.tracks
.as_ref()?
.iter()
.map(|t| t.id())
.flatten()
.filter_map(|t| t.id())
// only select unique tracks
.collect::<HashSet<_>>()
.into_iter()

View File

@@ -606,7 +606,7 @@ fn run_dbus_server(
if let Some(tracks) = &playlist.tracks {
let should_shuffle = queue.get_shuffle();
queue.clear();
let index = queue.append_next(&tracks.to_vec());
let index = queue.append_next(tracks);
queue.play(index, should_shuffle, should_shuffle)
}
}

View File

@@ -136,7 +136,7 @@ impl<I: ListItem> ListView<I> {
.map(|t| Playable::Track(t.clone()))
.collect::<Vec<Playable>>()
});
if let Some(tracks) = playables.or_else(|| tracks.as_ref()) {
if let Some(tracks) = playables.or(tracks.as_ref()) {
let index = self.queue.append_next(tracks);
self.queue.play(index + self.selected, true, false);
true