From 88a6e9995dcf4cc7e5d4a314d1e184a7e859d63a Mon Sep 17 00:00:00 2001 From: Jonas Platte Date: Mon, 17 Oct 2022 15:14:36 +0200 Subject: [PATCH] client-api: Don't include token in Debug-format of login::Token --- crates/ruma-client-api/src/session/login.rs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/crates/ruma-client-api/src/session/login.rs b/crates/ruma-client-api/src/session/login.rs index afd1806a..64f2608c 100644 --- a/crates/ruma-client-api/src/session/login.rs +++ b/crates/ruma-client-api/src/session/login.rs @@ -268,8 +268,9 @@ pub mod v3 { } /// A token to supply as authentication. - #[derive(Clone, Debug, Incoming, Serialize)] + #[derive(Clone, Incoming, Serialize)] #[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)] + #[incoming_derive(!Debug)] #[serde(tag = "type", rename = "m.login.token")] pub struct Token<'a> { /// The token. @@ -290,6 +291,18 @@ pub mod v3 { } } + impl<'a> fmt::Debug for Token<'a> { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("Token").finish_non_exhaustive() + } + } + + impl fmt::Debug for IncomingToken { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("IncomingToken").finish_non_exhaustive() + } + } + /// An identifier to supply for Application Service authentication. #[derive(Clone, Debug, Incoming, Serialize)] #[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]