From a73f921c5f0446790807fd4f31febf70f3ef6fa3 Mon Sep 17 00:00:00 2001 From: Igor Katson Date: Fri, 13 Sep 2024 12:36:32 +0100 Subject: [PATCH] one line anyhow error formatting --- crates/librqbit/src/api.rs | 4 ++-- crates/librqbit/src/session.rs | 10 +++++----- crates/librqbit/src/torrent_state/streaming.rs | 2 +- crates/peer_binary_protocol/src/lib.rs | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/crates/librqbit/src/api.rs b/crates/librqbit/src/api.rs index 2fc78e4..4dfc0d5 100644 --- a/crates/librqbit/src/api.rs +++ b/crates/librqbit/src/api.rs @@ -72,7 +72,7 @@ impl<'de> Deserialize<'de> for TorrentIdOrHash { macro_rules! visit_int { ($v:expr) => {{ - let tid: TorrentId = $v.try_into().map_err(|e| E::custom(format!("{e:?}")))?; + let tid: TorrentId = $v.try_into().map_err(|e| E::custom(format!("{e:#}")))?; Ok(TorrentIdOrHash::from(tid)) }}; } @@ -118,7 +118,7 @@ impl<'de> Deserialize<'de> for TorrentIdOrHash { { TorrentIdOrHash::parse(v).map_err(|e| { E::custom(format!( - "expected integer or 40 byte info hash, couldn't parse string: {e:?}" + "expected integer or 40 byte info hash, couldn't parse string: {e:#}" )) }) } diff --git a/crates/librqbit/src/session.rs b/crates/librqbit/src/session.rs index 0ddf83e..3b8c59a 100644 --- a/crates/librqbit/src/session.rs +++ b/crates/librqbit/src/session.rs @@ -673,7 +673,7 @@ impl Session { tokio::select! { Some(res) = futs.next(), if !futs.is_empty() => { if let Err(e) = res { - error!("error adding torrent to session: {e:?}"); + error!("error adding torrent to session: {e:#}"); } } st = ps.next(), if !added_all => { @@ -1248,7 +1248,7 @@ impl Session { .with_context(|| format!("torrent with id {} did not exist", id))?; if let Err(e) = removed.pause() { - debug!("error pausing torrent before deletion: {e:?}") + debug!("error pausing torrent before deletion: {e:#}") } let storage = removed @@ -1259,7 +1259,7 @@ impl Session { .pause() // inspect_err not available in 1.75 .map_err(|e| { - warn!("error pausing torrent: {e:?}"); + warn!("error pausing torrent: {e:#}"); e }) .ok() @@ -1285,7 +1285,7 @@ impl Session { if removed.shared().options.output_folder != self.output_folder { if let Err(e) = storage.remove_directory_if_empty(Path::new("")) { warn!( - "error removing {:?}: {e:?}", + "error removing {:?}: {e:#}", removed.shared().options.output_folder ) } @@ -1398,7 +1398,7 @@ fn remove_files_and_dirs(info: &ManagedTorrentShared, files: &dyn TorrentStorage }; for dir in all_dirs { if let Err(e) = files.remove_directory_if_empty(dir) { - warn!("error removing {dir:?}: {e:?}"); + warn!("error removing {dir:?}: {e:#}"); } else { debug!("removed {dir:?}") } diff --git a/crates/librqbit/src/torrent_state/streaming.rs b/crates/librqbit/src/torrent_state/streaming.rs index deadf3b..73fb9ea 100644 --- a/crates/librqbit/src/torrent_state/streaming.rs +++ b/crates/librqbit/src/torrent_state/streaming.rs @@ -154,7 +154,7 @@ macro_rules! poll_try_io { match e { Ok(r) => r, Err(e) => { - debug!("stream error {e:?}"); + debug!("stream error {e:#}"); return Poll::Ready(Err(e)); } } diff --git a/crates/peer_binary_protocol/src/lib.rs b/crates/peer_binary_protocol/src/lib.rs index 27926df..bd9a83e 100644 --- a/crates/peer_binary_protocol/src/lib.rs +++ b/crates/peer_binary_protocol/src/lib.rs @@ -163,7 +163,7 @@ impl std::fmt::Display for MessageDeserializeError { len_prefix, } => write!( f, - "error deserializing {name} (msg_id={msg_id}, len_prefix={len_prefix}): {error:?}" + "error deserializing {name} (msg_id={msg_id}, len_prefix={len_prefix}): {error:#}" ), MessageDeserializeError::Other(e) => write!(f, "{e}"), }