From bb9742e84ccff9e85cc7149738ae5eb2700f98a1 Mon Sep 17 00:00:00 2001 From: Jonas Platte Date: Mon, 17 Oct 2022 15:15:44 +0200 Subject: [PATCH] client-api: Don't include extra field in Debug-format of login::CustomLoginInfo --- crates/ruma-client-api/src/session/login.rs | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/crates/ruma-client-api/src/session/login.rs b/crates/ruma-client-api/src/session/login.rs index 9766f278..741d2ec3 100644 --- a/crates/ruma-client-api/src/session/login.rs +++ b/crates/ruma-client-api/src/session/login.rs @@ -323,7 +323,7 @@ pub mod v3 { } #[doc(hidden)] - #[derive(Clone, Debug, Serialize)] + #[derive(Clone, Serialize)] #[non_exhaustive] pub struct CustomLoginInfo<'a> { #[serde(rename = "type")] @@ -332,8 +332,16 @@ pub mod v3 { extra: &'a JsonObject, } + impl<'a> fmt::Debug for CustomLoginInfo<'a> { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("CustomLoginInfo") + .field("login_type", &self.login_type) + .finish_non_exhaustive() + } + } + #[doc(hidden)] - #[derive(Clone, Debug, Deserialize)] + #[derive(Clone, Deserialize)] #[non_exhaustive] pub struct IncomingCustomLoginInfo { #[serde(rename = "type")] @@ -342,6 +350,14 @@ pub mod v3 { extra: JsonObject, } + impl fmt::Debug for IncomingCustomLoginInfo { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("IncomingCustomLoginInfo") + .field("login_type", &self.login_type) + .finish_non_exhaustive() + } + } + /// Client configuration provided by the server. #[derive(Clone, Debug, Deserialize, Serialize)] #[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]