chore: cargo clippy --fix

Reformat format strings
This commit is contained in:
Henrik Friedrichsen
2025-07-03 22:11:31 +02:00
parent ca94c00bca
commit b843c7e721
14 changed files with 55 additions and 68 deletions

View File

@@ -216,7 +216,7 @@ impl Application {
if layout.has_screen(&initial_screen) { if layout.has_screen(&initial_screen) {
layout.set_screen(initial_screen); layout.set_screen(initial_screen);
} else { } else {
error!("Invalid screen name: {}", initial_screen); error!("Invalid screen name: {initial_screen}");
layout.set_screen("library"); layout.set_screen("library");
} }
@@ -244,7 +244,7 @@ impl Application {
#[cfg(unix)] #[cfg(unix)]
for signal in signals.pending() { for signal in signals.pending() {
if signal == SIGTERM || signal == SIGHUP { if signal == SIGTERM || signal == SIGHUP {
info!("Caught {}, cleaning up and closing", signal); info!("Caught {signal}, cleaning up and closing");
if let Some(data) = self.cursive.user_data::<UserData>().cloned() { if let Some(data) = self.cursive.user_data::<UserData>().cloned() {
data.cmd.handle(&mut self.cursive, Command::Quit); data.cmd.handle(&mut self.cursive, Command::Quit);
} }
@@ -253,7 +253,7 @@ impl Application {
for event in self.event_manager.msg_iter() { for event in self.event_manager.msg_iter() {
match event { match event {
Event::Player(state) => { Event::Player(state) => {
trace!("event received: {:?}", state); trace!("event received: {state:?}");
self.spotify.update_status(state.clone()); self.spotify.update_status(state.clone());
#[cfg(unix)] #[cfg(unix)]

View File

@@ -77,14 +77,11 @@ impl CommandManager {
for (key, commands) in custom_bindings.unwrap_or_default() { for (key, commands) in custom_bindings.unwrap_or_default() {
match parse(&commands) { match parse(&commands) {
Ok(cmds) => { Ok(cmds) => {
info!("Custom keybinding: {} -> {:?}", key, cmds); info!("Custom keybinding: {key} -> {cmds:?}");
kb.insert(key, cmds); kb.insert(key, cmds);
} }
Err(err) => { Err(err) => {
error!( error!("Invalid command(s) for key {key}-\"{commands}\": {err}");
"Invalid command(s) for key {}-\"{}\": {}",
key, commands, err
);
} }
} }
} }
@@ -204,7 +201,7 @@ impl CommandManager {
.spotify .spotify
.volume() .volume()
.saturating_sub(VOLUME_PERCENT * amount); .saturating_sub(VOLUME_PERCENT * amount);
debug!("vol {}", volume); debug!("vol {volume}");
self.spotify.set_volume(volume, true); self.spotify.set_volume(volume, true);
Ok(None) Ok(None)
} }
@@ -239,7 +236,7 @@ impl CommandManager {
Command::NewPlaylist(name) => { Command::NewPlaylist(name) => {
match self.spotify.api.create_playlist(name, None, None) { match self.spotify.api.create_playlist(name, None, None) {
Ok(_) => self.library.update_library(), Ok(_) => self.library.update_library(),
Err(_) => error!("could not create playlist {}", name), Err(_) => error!("could not create playlist {name}"),
} }
Ok(None) Ok(None)
} }
@@ -273,10 +270,10 @@ impl CommandManager {
Ok(None) Ok(None)
} }
Command::Execute(cmd) => { Command::Execute(cmd) => {
log::info!("Executing command: {}", cmd); log::info!("Executing command: {cmd}");
let cmd = std::ffi::CString::new(cmd.clone()).unwrap(); let cmd = std::ffi::CString::new(cmd.clone()).unwrap();
let result = unsafe { libc::system(cmd.as_ptr()) }; let result = unsafe { libc::system(cmd.as_ptr()) };
log::info!("Exit code: {}", result); log::info!("Exit code: {result}");
Ok(None) Ok(None)
} }
Command::Reconnect => { Command::Reconnect => {
@@ -404,7 +401,7 @@ impl CommandManager {
if let Some(binding) = Self::parse_keybinding(k) { if let Some(binding) = Self::parse_keybinding(k) {
self.register_keybinding(cursive, binding, v.clone()); self.register_keybinding(cursive, binding, v.clone());
} else { } else {
error!("Could not parse keybinding: \"{}\"", k); error!("Could not parse keybinding: \"{k}\"");
} }
} }
} }

View File

@@ -257,7 +257,7 @@ impl Config {
let path = config_path(USER_STATE_FILE_NAME); let path = config_path(USER_STATE_FILE_NAME);
debug!("saving user state to {}", path.display()); debug!("saving user state to {}", path.display());
if let Err(e) = CBOR.write(path, &*self.state()) { if let Err(e) = CBOR.write(path, &*self.state()) {
error!("Could not save user state: {}", e); error!("Could not save user state: {e}");
} }
} }

View File

@@ -77,7 +77,7 @@ impl IpcSocket {
loop { loop {
match listener.accept().await { match listener.accept().await {
Ok((stream, sockaddr)) => { Ok((stream, sockaddr)) => {
debug!("Connection from {:?}", sockaddr); debug!("Connection from {sockaddr:?}");
tokio::spawn(Self::stream_handler( tokio::spawn(Self::stream_handler(
stream, stream,
ev.clone(), ev.clone(),

View File

@@ -79,8 +79,7 @@ impl Library {
let saved_cache_version = self.cfg.state().cache_version; let saved_cache_version = self.cfg.state().cache_version;
if saved_cache_version < CACHE_VERSION { if saved_cache_version < CACHE_VERSION {
debug!( debug!(
"Cache version for {:?} has changed from {} to {}, ignoring cache", "Cache version for {cache_path:?} has changed from {saved_cache_version} to {CACHE_VERSION}, ignoring cache"
cache_path, saved_cache_version, CACHE_VERSION
); );
return; return;
} }
@@ -103,7 +102,7 @@ impl Library {
self.trigger_redraw(); self.trigger_redraw();
} }
Err(e) => { Err(e) => {
error!("can't parse cache: {}", e); error!("can't parse cache: {e}");
} }
} }
} }
@@ -369,7 +368,7 @@ impl Library {
loop { loop {
let page = self.spotify.api.current_user_followed_artists(last); let page = self.spotify.api.current_user_followed_artists(last);
debug!("artists page: {}", i); debug!("artists page: {i}");
i += 1; i += 1;
if page.is_err() { if page.is_err() {
error!("Failed to fetch artists."); error!("Failed to fetch artists.");
@@ -426,7 +425,7 @@ impl Library {
.spotify .spotify
.api .api
.current_user_saved_albums(albums.len() as u32); .current_user_saved_albums(albums.len() as u32);
debug!("albums page: {}", i); debug!("albums page: {i}");
i += 1; i += 1;
@@ -470,7 +469,7 @@ impl Library {
.api .api
.current_user_saved_tracks(tracks.len() as u32); .current_user_saved_tracks(tracks.len() as u32);
debug!("tracks page: {}", i); debug!("tracks page: {i}");
i += 1; i += 1;
if page.is_err() { if page.is_err() {

View File

@@ -57,7 +57,7 @@ impl Playlist {
pub fn delete_track(&mut self, index: usize, spotify: Spotify, library: &Library) -> bool { pub fn delete_track(&mut self, index: usize, spotify: Spotify, library: &Library) -> bool {
let playable = self.tracks.as_ref().unwrap()[index].clone(); let playable = self.tracks.as_ref().unwrap()[index].clone();
debug!("deleting track: {} {:?}", index, playable); debug!("deleting track: {index} {playable:?}");
if playable.track().map(|t| t.is_local) == Some(true) { if playable.track().map(|t| t.is_local) == Some(true) {
warn!("track is a local file, can't delete"); warn!("track is a local file, can't delete");

View File

@@ -464,7 +464,7 @@ impl Queue {
QueueEvent::PreloadTrackRequest => { QueueEvent::PreloadTrackRequest => {
if let Some(next_index) = self.next_index() { if let Some(next_index) = self.next_index() {
let track = self.queue.read().unwrap()[next_index].clone(); let track = self.queue.read().unwrap()[next_index].clone();
debug!("Preloading track {} as requested by librespot", track); debug!("Preloading track {track} as requested by librespot");
self.spotify.preload(&track); self.spotify.preload(&track);
} }
} }
@@ -494,7 +494,7 @@ pub fn send_notification(summary_txt: &str, body_txt: &str, cover_url: Option<St
let path = crate::utils::cache_path_for_url(u.to_string()); let path = crate::utils::cache_path_for_url(u.to_string());
if !path.exists() { if !path.exists() {
if let Err(e) = crate::utils::download(u, path.clone()) { if let Err(e) = crate::utils::download(u, path.clone()) {
log::error!("Failed to download cover: {}", e); log::error!("Failed to download cover: {e}");
} }
} }
n.icon(path.to_str().unwrap()); n.icon(path.to_str().unwrap());
@@ -512,6 +512,6 @@ pub fn send_notification(summary_txt: &str, body_txt: &str, cover_url: Option<St
#[cfg(all(unix, not(target_os = "macos")))] #[cfg(all(unix, not(target_os = "macos")))]
info!("Created notification: {}", handle.id()); info!("Created notification: {}", handle.id());
} }
Err(e) => log::error!("Failed to send notification cover: {}", e), Err(e) => log::error!("Failed to send notification cover: {e}"),
} }
} }

View File

@@ -136,7 +136,7 @@ impl Spotify {
}; };
match env::var("http_proxy") { match env::var("http_proxy") {
Ok(proxy) => { Ok(proxy) => {
info!("Setting HTTP proxy {}", proxy); info!("Setting HTTP proxy {proxy}");
session_config.proxy = Url::parse(&proxy).ok(); session_config.proxy = Url::parse(&proxy).ok();
} }
Err(_) => debug!("No HTTP proxy set"), Err(_) => debug!("No HTTP proxy set"),
@@ -204,7 +204,7 @@ impl Spotify {
let backend_name = backend.0; let backend_name = backend.0;
info!("Initializing audio backend {}", backend_name); info!("Initializing audio backend {backend_name}");
if backend_name == "pulseaudio" { if backend_name == "pulseaudio" {
// TODO: Audit that the environment access only happens in single-threaded code. // TODO: Audit that the environment access only happens in single-threaded code.
unsafe { env::set_var("PULSE_PROP_application.name", "ncspot") }; unsafe { env::set_var("PULSE_PROP_application.name", "ncspot") };
@@ -316,10 +316,10 @@ impl Spotify {
/// Load `track` into the [Player]. Start playing immediately if /// Load `track` into the [Player]. Start playing immediately if
/// `start_playing` is true. Start playing from `position_ms` in the song. /// `start_playing` is true. Start playing from `position_ms` in the song.
pub fn load(&self, track: &Playable, start_playing: bool, position_ms: u32) { pub fn load(&self, track: &Playable, start_playing: bool, position_ms: u32) {
info!("loading track: {:?}", track); info!("loading track: {track:?}");
if !track.is_playable() { if !track.is_playable() {
warn!("track {:?} can not be played, skipping..", track); warn!("track {track:?} can not be played, skipping..");
self.events.send(Event::Player(PlayerEvent::FinishedTrack)); self.events.send(Event::Player(PlayerEvent::FinishedTrack));
return; return;
} }
@@ -385,7 +385,7 @@ impl Spotify {
/// Send an [MprisCommand] to the mpris thread. /// Send an [MprisCommand] to the mpris thread.
#[cfg(feature = "mpris")] #[cfg(feature = "mpris")]
fn send_mpris(&self, cmd: MprisCommand) { fn send_mpris(&self, cmd: MprisCommand) {
debug!("Sending mpris command: {:?}", cmd); debug!("Sending mpris command: {cmd:?}");
match self.mpris.lock().unwrap().as_ref() { match self.mpris.lock().unwrap().as_ref() {
Some(mpris_manager) => { Some(mpris_manager) => {
mpris_manager.send(cmd); mpris_manager.send(cmd);
@@ -398,15 +398,12 @@ impl Spotify {
/// Send a [WorkerCommand] to the worker thread. /// Send a [WorkerCommand] to the worker thread.
fn send_worker(&self, cmd: WorkerCommand) { fn send_worker(&self, cmd: WorkerCommand) {
info!("sending command to worker: {:?}", cmd); info!("sending command to worker: {cmd:?}");
let channel = self.channel.read().unwrap(); let channel = self.channel.read().unwrap();
match channel.as_ref() { match channel.as_ref() {
Some(channel) => { Some(channel) => {
if let Err(e) = channel.send(cmd) { if let Err(e) = channel.send(cmd) {
error!( error!("can't send command to spotify worker: {e}, dropping command");
"can't send command to spotify worker: {}, dropping command",
e
);
} }
} }
None => error!("no channel to worker available"), None => error!("no channel to worker available"),
@@ -460,7 +457,7 @@ impl Spotify {
/// Set the current volume of the [Player]. If `notify` is true, also notify MPRIS clients about /// Set the current volume of the [Player]. If `notify` is true, also notify MPRIS clients about
/// the update. /// the update.
pub fn set_volume(&self, volume: u16, notify: bool) { pub fn set_volume(&self, volume: u16, notify: bool) {
info!("setting volume to {}", volume); info!("setting volume to {volume}");
self.cfg.with_state_mut(|s| s.volume = volume); self.cfg.with_state_mut(|s| s.volume = volume);
self.send_worker(WorkerCommand::SetVolume(volume)); self.send_worker(WorkerCommand::SetVolume(volume));
// HACK: This is a bit of a hack to prevent duplicate update signals when updating from the // HACK: This is a bit of a hack to prevent duplicate update signals when updating from the

View File

@@ -92,7 +92,7 @@ impl WebApi {
return None; return None;
} }
info!("Token will expire in {}, renewing", delta); info!("Token will expire in {delta}, renewing");
} }
let (token_tx, token_rx) = std::sync::mpsc::channel(); let (token_tx, token_rx) = std::sync::mpsc::channel();
@@ -136,14 +136,14 @@ impl WebApi {
match result { match result {
Ok(v) => Some(v), Ok(v) => Some(v),
Err(ClientError::Http(error)) => { Err(ClientError::Http(error)) => {
debug!("http error: {:?}", error); debug!("http error: {error:?}");
match error.as_ref() { match error.as_ref() {
HttpError::StatusCode(response) => match response.status() { HttpError::StatusCode(response) => match response.status() {
429 => { 429 => {
let waiting_duration = response let waiting_duration = response
.header("Retry-After") .header("Retry-After")
.and_then(|v| v.parse::<u64>().ok()); .and_then(|v| v.parse::<u64>().ok());
debug!("rate limit hit. waiting {:?} seconds", waiting_duration); debug!("rate limit hit. waiting {waiting_duration:?} seconds");
thread::sleep(Duration::from_secs(waiting_duration.unwrap_or(0))); thread::sleep(Duration::from_secs(waiting_duration.unwrap_or(0)));
api_call(&self.api).ok() api_call(&self.api).ok()
} }
@@ -153,7 +153,7 @@ impl WebApi {
.and_then(move |_| api_call(&self.api).ok()) .and_then(move |_| api_call(&self.api).ok())
} }
_ => { _ => {
error!("unhandled api error: {:?}", response); error!("unhandled api error: {response:?}");
None None
} }
}, },
@@ -161,7 +161,7 @@ impl WebApi {
} }
} }
Err(e) => { Err(e) => {
error!("unhandled api error: {}", e); error!("unhandled api error: {e}");
None None
} }
} }
@@ -258,12 +258,12 @@ impl WebApi {
if self.append_tracks(id, tracks, None).is_ok() { if self.append_tracks(id, tracks, None).is_ok() {
debug!("{} tracks successfully added", tracks.len()); debug!("{} tracks successfully added", tracks.len());
} else { } else {
error!("error saving tracks to playlists {}", id); error!("error saving tracks to playlists {id}");
return; return;
} }
} }
} else { } else {
error!("error saving tracks to playlist {}", id); error!("error saving tracks to playlist {id}");
} }
} }
@@ -295,7 +295,7 @@ impl WebApi {
/// Fetch the album with the given `album_id`. /// Fetch the album with the given `album_id`.
pub fn album(&self, album_id: &str) -> Result<FullAlbum, ()> { pub fn album(&self, album_id: &str) -> Result<FullAlbum, ()> {
debug!("fetching album {}", album_id); debug!("fetching album {album_id}");
let aid = AlbumId::from_id(album_id).map_err(|_| ())?; let aid = AlbumId::from_id(album_id).map_err(|_| ())?;
self.api_with_retry(|api| api.album(aid.clone(), Some(Market::FromToken))) self.api_with_retry(|api| api.album(aid.clone(), Some(Market::FromToken)))
.ok_or(()) .ok_or(())
@@ -395,7 +395,7 @@ impl WebApi {
const MAX_LIMIT: u32 = 50; const MAX_LIMIT: u32 = 50;
let spotify = self.clone(); let spotify = self.clone();
let fetch_page = move |offset: u32| { let fetch_page = move |offset: u32| {
debug!("fetching user playlists, offset: {}", offset); debug!("fetching user playlists, offset: {offset}");
spotify.api_with_retry(|api| { spotify.api_with_retry(|api| {
match api.current_user_playlists_manual(Some(MAX_LIMIT), Some(offset)) { match api.current_user_playlists_manual(Some(MAX_LIMIT), Some(offset)) {
Ok(page) => Ok(ApiPage { Ok(page) => Ok(ApiPage {
@@ -416,10 +416,7 @@ impl WebApi {
let spotify = self.clone(); let spotify = self.clone();
let playlist_id = playlist_id.to_string(); let playlist_id = playlist_id.to_string();
let fetch_page = move |offset: u32| { let fetch_page = move |offset: u32| {
debug!( debug!("fetching playlist {playlist_id} tracks, offset: {offset}");
"fetching playlist {} tracks, offset: {}",
playlist_id, offset
);
spotify.api_with_retry(|api| { spotify.api_with_retry(|api| {
match api.playlist_items_manual( match api.playlist_items_manual(
PlaylistId::from_id(&playlist_id).unwrap(), PlaylistId::from_id(&playlist_id).unwrap(),
@@ -461,7 +458,7 @@ impl WebApi {
limit: u32, limit: u32,
offset: u32, offset: u32,
) -> Result<Page<SimplifiedTrack>, ()> { ) -> Result<Page<SimplifiedTrack>, ()> {
debug!("fetching album tracks {}", album_id); debug!("fetching album tracks {album_id}");
self.api_with_retry(|api| { self.api_with_retry(|api| {
api.album_track_manual( api.album_track_manual(
AlbumId::from_id(album_id).unwrap(), AlbumId::from_id(album_id).unwrap(),
@@ -484,7 +481,7 @@ impl WebApi {
let spotify = self.clone(); let spotify = self.clone();
let artist_id = artist_id.to_string(); let artist_id = artist_id.to_string();
let fetch_page = move |offset: u32| { let fetch_page = move |offset: u32| {
debug!("fetching artist {} albums, offset: {}", artist_id, offset); debug!("fetching artist {artist_id} albums, offset: {offset}");
spotify.api_with_retry(|api| { spotify.api_with_retry(|api| {
match api.artist_albums_manual( match api.artist_albums_manual(
ArtistId::from_id(&artist_id).unwrap(), ArtistId::from_id(&artist_id).unwrap(),
@@ -695,7 +692,7 @@ impl WebApi {
const MAX_LIMIT: u32 = 50; const MAX_LIMIT: u32 = 50;
let spotify = self.clone(); let spotify = self.clone();
let fetch_page = move |offset: u32| { let fetch_page = move |offset: u32| {
debug!("fetching categories, offset: {}", offset); debug!("fetching categories, offset: {offset}");
spotify.api_with_retry(|api| { spotify.api_with_retry(|api| {
match api.categories_manual( match api.categories_manual(
None, None,
@@ -721,7 +718,7 @@ impl WebApi {
let spotify = self.clone(); let spotify = self.clone();
let category_id = category_id.to_string(); let category_id = category_id.to_string();
let fetch_page = move |offset: u32| { let fetch_page = move |offset: u32| {
debug!("fetching category playlists, offset: {}", offset); debug!("fetching category playlists, offset: {offset}");
spotify.api_with_retry(|api| { spotify.api_with_retry(|api| {
match api.category_playlists_manual( match api.category_playlists_manual(
&category_id, &category_id,

View File

@@ -94,7 +94,7 @@ impl Worker {
Some(WorkerCommand::Load(playable, start_playing, position_ms)) => { Some(WorkerCommand::Load(playable, start_playing, position_ms)) => {
match SpotifyId::from_uri(&playable.uri()) { match SpotifyId::from_uri(&playable.uri()) {
Ok(id) => { Ok(id) => {
info!("player loading track: {:?}", id); info!("player loading track: {id:?}");
if !id.is_playable() { if !id.is_playable() {
warn!("track is not playable"); warn!("track is not playable");
self.events.send(Event::Player(PlayerEvent::FinishedTrack)); self.events.send(Event::Player(PlayerEvent::FinishedTrack));
@@ -103,7 +103,7 @@ impl Worker {
} }
} }
Err(e) => { Err(e) => {
error!("error parsing uri: {:?}", e); error!("error parsing uri: {e:?}");
self.events.send(Event::Player(PlayerEvent::FinishedTrack)); self.events.send(Event::Player(PlayerEvent::FinishedTrack));
} }
} }
@@ -128,7 +128,7 @@ impl Worker {
} }
Some(WorkerCommand::Preload(playable)) => { Some(WorkerCommand::Preload(playable)) => {
if let Ok(id) = SpotifyId::from_uri(&playable.uri()) { if let Ok(id) = SpotifyId::from_uri(&playable.uri()) {
debug!("Preloading {:?}", id); debug!("Preloading {id:?}");
self.player.preload(id); self.player.preload(id);
} }
} }

View File

@@ -351,7 +351,7 @@ impl ContextMenu {
impl ViewExt for AddToPlaylistMenu { impl ViewExt for AddToPlaylistMenu {
fn on_command(&mut self, s: &mut Cursive, cmd: &Command) -> Result<CommandResult, String> { fn on_command(&mut self, s: &mut Cursive, cmd: &Command) -> Result<CommandResult, String> {
log::info!("playlist command: {:?}", cmd); log::info!("playlist command: {cmd:?}");
handle_move_command::<Playlist>(&mut self.dialog, s, cmd, "addplaylist_select") handle_move_command::<Playlist>(&mut self.dialog, s, cmd, "addplaylist_select")
} }
} }
@@ -364,7 +364,7 @@ impl ViewExt for ContextMenu {
impl ViewExt for SelectArtistMenu { impl ViewExt for SelectArtistMenu {
fn on_command(&mut self, s: &mut Cursive, cmd: &Command) -> Result<CommandResult, String> { fn on_command(&mut self, s: &mut Cursive, cmd: &Command) -> Result<CommandResult, String> {
log::info!("artist move command: {:?}", cmd); log::info!("artist move command: {cmd:?}");
handle_move_command::<Artist>(&mut self.dialog, s, cmd, "artist_select") handle_move_command::<Artist>(&mut self.dialog, s, cmd, "artist_select")
} }
} }

View File

@@ -38,10 +38,7 @@ impl CoverView {
query query
}; };
debug!( debug!("Determined window dimensions: {xpixels}x{ypixels}, {cols}x{rows}");
"Determined window dimensions: {}x{}, {}x{}",
xpixels, ypixels, cols, rows
);
// Determine font size, considering max scale to prevent tiny covers on HiDPI screens // Determine font size, considering max scale to prevent tiny covers on HiDPI screens
let scale = config.values().cover_max_scale.unwrap_or(1.0); let scale = config.values().cover_max_scale.unwrap_or(1.0);
@@ -127,7 +124,7 @@ impl CoverView {
); );
if let Err(e) = self.run_ueberzug_cmd(&cmd) { if let Err(e) = self.run_ueberzug_cmd(&cmd) {
error!("Failed to run Ueberzug: {}", e); error!("Failed to run Ueberzug: {e}");
return; return;
} }
@@ -144,7 +141,7 @@ impl CoverView {
let cmd = "{\"action\": \"remove\", \"identifier\": \"cover\"}\n"; let cmd = "{\"action\": \"remove\", \"identifier\": \"cover\"}\n";
if let Err(e) = self.run_ueberzug_cmd(cmd) { if let Err(e) = self.run_ueberzug_cmd(cmd) {
error!("Failed to run Ueberzug: {}", e); error!("Failed to run Ueberzug: {e}");
} }
} }
@@ -184,7 +181,7 @@ impl CoverView {
let loading_thread = self.loading.clone(); let loading_thread = self.loading.clone();
std::thread::spawn(move || { std::thread::spawn(move || {
if let Err(e) = crate::utils::download(url.clone(), path.clone()) { if let Err(e) = crate::utils::download(url.clone(), path.clone()) {
error!("Failed to download cover: {}", e); error!("Failed to download cover: {e}");
} }
let mut loading = loading_thread.write().unwrap(); let mut loading = loading_thread.write().unwrap();
loading.remove(&url.clone()); loading.remove(&url.clone());

View File

@@ -67,7 +67,7 @@ impl<I: ListItem + Clone> ApiResult<I> {
pub fn next(&self) -> Option<Vec<I>> { pub fn next(&self) -> Option<Vec<I>> {
let offset = self.offset() + self.limit; let offset = self.offset() + self.limit;
debug!("fetching next page at offset {}", offset); debug!("fetching next page at offset {offset}");
if !self.at_end() { if !self.at_end() {
if let Some(next_page) = (self.fetch_page)(offset) { if let Some(next_page) = (self.fetch_page)(offset) {
*self.offset.write().unwrap() = next_page.offset; *self.offset.write().unwrap() = next_page.offset;

View File

@@ -34,7 +34,7 @@ type DynError = Box<dyn std::error::Error>;
fn main() { fn main() {
if let Err(e) = try_main() { if let Err(e) = try_main() {
eprintln!("{}", e); eprintln!("{e}");
std::process::exit(-1); std::process::exit(-1);
} }
} }
@@ -136,7 +136,7 @@ fn generate_shell_completion(subcommand_arguments: &ArgMatches) -> Result<(), Dy
"elvish" => Shell::Elvish, "elvish" => Shell::Elvish,
"powershell" => Shell::PowerShell, "powershell" => Shell::PowerShell,
_ => { _ => {
eprintln!("Unrecognized shell: {}", shell); eprintln!("Unrecognized shell: {shell}");
std::process::exit(-1); std::process::exit(-1);
} }
}) })