Use variables directly inside format strings

Most systems should have an up to date Rust compiler by now, so we should be
fine.
This commit is contained in:
Henrik Friedrichsen
2023-02-06 20:06:25 +01:00
parent 2fe3b056bf
commit 8222f1b2e4
17 changed files with 34 additions and 40 deletions

View File

@@ -74,7 +74,7 @@ impl Track {
pub fn duration_str(&self) -> String {
let minutes = self.duration / 60_000;
let seconds = (self.duration / 1000) % 60;
format!("{:02}:{:02}", minutes, seconds)
format!("{minutes:02}:{seconds:02}")
}
}
@@ -194,7 +194,7 @@ impl ListItem for Track {
if left != default {
Playable::format(&Playable::Track(self.clone()), &left, library)
} else {
format!("{}", self)
format!("{self}")
}
}
@@ -307,7 +307,7 @@ impl ListItem for Track {
fn share_url(&self) -> Option<String> {
self.id
.clone()
.map(|id| format!("https://open.spotify.com/track/{}", id))
.map(|id| format!("https://open.spotify.com/track/{id}"))
}
fn album(&self, queue: Arc<Queue>) -> Option<Album> {