Skip to content

Commit dd6466b

Browse files
authored
refactor: improve fmt::Debug for legacy::Error (#99)
1 parent 8f29948 commit dd6466b

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/client/legacy/client.rs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ struct Config {
5252
}
5353

5454
/// Client errors
55-
#[derive(Debug)]
5655
pub struct Error {
5756
kind: ErrorKind,
5857
source: Option<Box<dyn StdError + Send + Sync>>,
@@ -1566,6 +1565,17 @@ impl fmt::Debug for Builder {
15661565

15671566
// ==== impl Error ====
15681567

1568+
impl fmt::Debug for Error {
1569+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
1570+
let mut f = f.debug_tuple("hyper_util::client::legacy::Error");
1571+
f.field(&self.kind);
1572+
if let Some(ref cause) = self.cause {
1573+
f.field(cause);
1574+
}
1575+
f.finish()
1576+
}
1577+
}
1578+
15691579
impl fmt::Display for Error {
15701580
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
15711581
write!(f, "client error ({:?})", self.kind)

0 commit comments

Comments
 (0)