refactor(library): various Rust style optimizations

Lots of small fixes to the APIs and functions in the `library` module,
mostly following best practices outlined in the Rust library guidelines.
Changes outside the `library` module were mostly required changes after
changing function signatures.
This commit is contained in:
Thomas Frans
2024-01-29 14:43:59 +01:00
committed by Henrik Friedrichsen
parent 97f10a9493
commit 7940365344
9 changed files with 202 additions and 125 deletions

View File

@@ -249,18 +249,18 @@ impl ListItem for Track {
fn toggle_saved(&mut self, library: &Library) {
if library.is_saved_track(&Playable::Track(self.clone())) {
library.unsave_tracks(vec![self], true);
library.unsave_tracks(&[self]);
} else {
library.save_tracks(vec![self], true);
library.save_tracks(&[self]);
}
}
fn save(&mut self, library: &Library) {
library.save_tracks(vec![self], true);
library.save_tracks(&[self]);
}
fn unsave(&mut self, library: &Library) {
library.unsave_tracks(vec![self], true);
library.unsave_tracks(&[self]);
}
fn open(&self, _queue: Arc<Queue>, _library: Arc<Library>) -> Option<Box<dyn ViewExt>> {