Skip to content

Commit 1d2e451

Browse files
committed
Make Debug impl for RequestConfig less verbose
… for the common case, and more verbose for some uncommon options that were just never printed before.
1 parent 30eee70 commit 1d2e451

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

crates/matrix-sdk/src/config/request.rs

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ use std::{
1717
time::Duration,
1818
};
1919

20+
use matrix_sdk_common::debug::DebugStructExt;
21+
2022
use crate::http_client::DEFAULT_REQUEST_TIMEOUT;
2123

2224
/// Configuration for requests the `Client` makes.
@@ -49,12 +51,21 @@ pub struct RequestConfig {
4951
#[cfg(not(tarpaulin_include))]
5052
impl Debug for RequestConfig {
5153
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
54+
let Self { timeout, retry_limit, retry_timeout, force_auth, assert_identity } = self;
55+
5256
let mut res = fmt.debug_struct("RequestConfig");
57+
res.field("timeout", timeout)
58+
.maybe_field("retry_limit", retry_limit)
59+
.maybe_field("retry_timeout", retry_timeout);
60+
61+
if *force_auth {
62+
res.field("force_auth", &true);
63+
}
64+
if *assert_identity {
65+
res.field("assert_identity", &true);
66+
}
5367

54-
res.field("timeout", &self.timeout)
55-
.field("retry_limit", &self.retry_limit)
56-
.field("retry_timeout", &self.retry_timeout)
57-
.finish()
68+
res.finish()
5869
}
5970
}
6071

0 commit comments

Comments
 (0)