client-api: Simplify Debug output for LoginInfo
@@ -140,9 +140,9 @@ pub mod v3 {
///
/// To construct the custom `LoginInfo` variant you first have to construct
/// [`IncomingLoginInfo::new`] and then call [`IncomingLoginInfo::to_outgoing`] on it.
- #[derive(Clone, Debug, Incoming, Serialize)]
+ #[derive(Clone, Incoming, Serialize)]
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
- #[incoming_derive(!Deserialize)]
+ #[incoming_derive(!Debug, !Deserialize)]
#[serde(untagged)]
pub enum LoginInfo<'a> {
/// An identifier and password are supplied to authenticate.
@@ -158,6 +158,18 @@ pub mod v3 {
_Custom(CustomLoginInfo<'a>),
}
+ impl fmt::Debug for LoginInfo<'_> {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+ // Print `Password { .. }` instead of `Password(Password { .. })`
+ match self {
+ Self::Password(inner) => inner.fmt(f),
+ Self::Token(inner) => inner.fmt(f),
+ Self::ApplicationService(inner) => inner.fmt(f),
+ Self::_Custom(inner) => inner.fmt(f),
+ }
+ }
+ }
+
impl IncomingLoginInfo {
/// Creates a new `IncomingLoginInfo` with the given `login_type` string, session and data.
///
@@ -199,6 +211,18 @@ pub mod v3 {
}
}
+ impl fmt::Debug for IncomingLoginInfo {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+ // Print `Password { .. }` instead of `Password(Password { .. })`
+ match self {
+ Self::Password(inner) => inner.fmt(f),
+ Self::Token(inner) => inner.fmt(f),
+ Self::ApplicationService(inner) => inner.fmt(f),
+ Self::_Custom(inner) => inner.fmt(f),
+ }
+ }
+ }
+
impl<'de> Deserialize<'de> for IncomingLoginInfo {
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where
