Apply some clippy suggestions

This commit is contained in:
Elias Projahn 2023-11-25 15:05:40 +01:00
parent e26444c982
commit 0926d912eb
4 changed files with 6 additions and 8 deletions

View file

@ -185,7 +185,7 @@ impl MusicusHomePage {
items.push(PlaylistItem::new(
true,
&title,
performances.as_ref().map(|x| x.as_str()),
performances.as_deref(),
None,
&tracks[0].path,
));
@ -212,7 +212,7 @@ impl MusicusHomePage {
items.push(PlaylistItem::new(
true,
&title,
performances.as_ref().map(|x| x.as_str()),
performances.as_deref(),
Some(&track_title(&first_track, 1)),
&first_track.path,
));
@ -221,7 +221,7 @@ impl MusicusHomePage {
items.push(PlaylistItem::new(
false,
&title,
performances.as_ref().map(|x| x.as_str()),
performances.as_deref(),
// track number = track index + 1 (first track) + 1 (zero based)
Some(&track_title(&track, index + 2)),
&track.path,

View file

@ -380,7 +380,7 @@ impl MusicusLibrary {
.get::<_, String>(4)?
.split(',')
.filter(|s| !s.is_empty())
.map(|s| str::parse::<usize>(s))
.map(str::parse::<usize>)
.collect::<Result<Vec<usize>, ParseIntError>>()
.expect("work part IDs should be valid integers"),
path: PathBuf::from(self.folder()).join(row.get::<_, String>(6)?),

View file

@ -59,7 +59,7 @@ mod imp {
..Default::default()
});
let uri = glib::filename_to_uri(&item.path(), None)
let uri = glib::filename_to_uri(item.path(), None)
.expect("track path should be parsable as an URI");
let player = self.player.get().unwrap();

View file

@ -71,9 +71,7 @@ mod imp {
self.remaining_time_label.set_label(&format_time(
player
.duration_ms()
.checked_sub(current_time_ms)
.unwrap_or(0),
.duration_ms().saturating_sub(current_time_ms),
));
}
}