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:
@@ -170,7 +170,7 @@ impl ListItem for Album {
|
||||
}
|
||||
|
||||
fn display_left(&self, _library: Arc<Library>) -> String {
|
||||
format!("{}", self)
|
||||
format!("{self}")
|
||||
}
|
||||
|
||||
fn display_right(&self, library: Arc<Library>) -> String {
|
||||
@@ -289,7 +289,7 @@ impl ListItem for Album {
|
||||
fn share_url(&self) -> Option<String> {
|
||||
self.id
|
||||
.clone()
|
||||
.map(|id| format!("https://open.spotify.com/album/{}", id))
|
||||
.map(|id| format!("https://open.spotify.com/album/{id}"))
|
||||
}
|
||||
|
||||
fn artists(&self) -> Option<Vec<Artist>> {
|
||||
|
||||
@@ -95,7 +95,7 @@ impl ListItem for Artist {
|
||||
}
|
||||
|
||||
fn display_left(&self, _library: Arc<Library>) -> String {
|
||||
format!("{}", self)
|
||||
format!("{self}")
|
||||
}
|
||||
|
||||
fn display_right(&self, library: Arc<Library>) -> String {
|
||||
@@ -115,7 +115,7 @@ impl ListItem for Artist {
|
||||
"".into()
|
||||
};
|
||||
|
||||
format!("{}{}", followed, tracks)
|
||||
format!("{followed}{tracks}")
|
||||
}
|
||||
|
||||
fn play(&mut self, queue: Arc<Queue>) {
|
||||
@@ -199,7 +199,7 @@ impl ListItem for Artist {
|
||||
fn share_url(&self) -> Option<String> {
|
||||
self.id
|
||||
.clone()
|
||||
.map(|id| format!("https://open.spotify.com/artist/{}", id))
|
||||
.map(|id| format!("https://open.spotify.com/artist/{id}"))
|
||||
}
|
||||
|
||||
#[inline]
|
||||
|
||||
@@ -25,7 +25,7 @@ impl Episode {
|
||||
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}")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -121,7 +121,7 @@ impl Playable {
|
||||
let duration = self.duration();
|
||||
let minutes = duration / 60_000;
|
||||
let seconds = (duration / 1000) % 60;
|
||||
format!("{:02}:{:02}", minutes, seconds)
|
||||
format!("{minutes:02}:{seconds:02}")
|
||||
}
|
||||
|
||||
pub fn as_listitem(&self) -> Box<dyn ListItem> {
|
||||
|
||||
@@ -216,7 +216,7 @@ impl ListItem for Playlist {
|
||||
.map(|t| t.len())
|
||||
.unwrap_or(self.num_tracks);
|
||||
|
||||
format!("{}{:>4} tracks", saved, num_tracks)
|
||||
format!("{saved}{num_tracks:>4} tracks")
|
||||
}
|
||||
|
||||
fn play(&mut self, queue: Arc<Queue>) {
|
||||
|
||||
@@ -77,7 +77,7 @@ impl ListItem for Show {
|
||||
}
|
||||
|
||||
fn display_left(&self, _library: Arc<Library>) -> String {
|
||||
format!("{}", self)
|
||||
format!("{self}")
|
||||
}
|
||||
|
||||
fn display_right(&self, library: Arc<Library>) -> String {
|
||||
|
||||
@@ -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> {
|
||||
|
||||
Reference in New Issue
Block a user