diff --git a/crates/ruma-client-api/src/lib.rs b/crates/ruma-client-api/src/lib.rs index cf8ff79b..f53f1d8f 100644 --- a/crates/ruma-client-api/src/lib.rs +++ b/crates/ruma-client-api/src/lib.rs @@ -13,11 +13,19 @@ pub mod r0; pub mod session; pub mod unversioned; +use std::fmt; + pub use error::Error; // Wrapper around `Box` that cannot be used in a meaningful way outside of // this crate. Used for string enums because their `_Custom` variant can't be // truly private (only `#[doc(hidden)]`). #[doc(hidden)] -#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord)] +#[derive(Clone, PartialEq, Eq, PartialOrd, Ord)] pub struct PrivOwnedStr(Box); + +impl fmt::Debug for PrivOwnedStr { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + self.0.fmt(f) + } +} diff --git a/crates/ruma-common/src/lib.rs b/crates/ruma-common/src/lib.rs index 9438a211..ee6d5feb 100644 --- a/crates/ruma-common/src/lib.rs +++ b/crates/ruma-common/src/lib.rs @@ -16,11 +16,19 @@ pub mod thirdparty; mod time; pub mod to_device; +use std::fmt; + pub use time::{MilliSecondsSinceUnixEpoch, SecondsSinceUnixEpoch}; // Wrapper around `Box` that cannot be used in a meaningful way outside of // this crate. Used for string enums because their `_Custom` variant can't be // truly private (only `#[doc(hidden)]`). #[doc(hidden)] -#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord)] +#[derive(Clone, PartialEq, Eq, PartialOrd, Ord)] pub struct PrivOwnedStr(Box); + +impl fmt::Debug for PrivOwnedStr { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + self.0.fmt(f) + } +} diff --git a/crates/ruma-events/src/lib.rs b/crates/ruma-events/src/lib.rs index e52e166a..df563bb9 100644 --- a/crates/ruma-events/src/lib.rs +++ b/crates/ruma-events/src/lib.rs @@ -115,7 +115,7 @@ #![warn(missing_docs)] #![cfg_attr(docsrs, feature(doc_auto_cfg))] -use std::fmt::Debug; +use std::fmt; use ruma_identifiers::{EventEncryptionAlgorithm, RoomVersionId}; use ruma_serde::Raw; @@ -391,9 +391,15 @@ pub struct UnsignedDeHelper { // this crate. Used for string enums because their `_Custom` variant can't be // truly private (only `#[doc(hidden)]`). #[doc(hidden)] -#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] +#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash)] pub struct PrivOwnedStr(Box); +impl fmt::Debug for PrivOwnedStr { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + self.0.fmt(f) + } +} + /// Helper function for erroring when trying to serialize an event enum _Custom variant that can /// only be created by deserializing from an unknown event type. #[doc(hidden)] diff --git a/crates/ruma-federation-api/src/lib.rs b/crates/ruma-federation-api/src/lib.rs index 9ebb0134..9b182c74 100644 --- a/crates/ruma-federation-api/src/lib.rs +++ b/crates/ruma-federation-api/src/lib.rs @@ -8,6 +8,8 @@ #![warn(missing_docs)] #![cfg_attr(docsrs, feature(doc_auto_cfg))] +use std::fmt; + mod serde; pub mod authorization; @@ -28,5 +30,11 @@ pub mod transactions; // this crate. Used for string enums because their `_Custom` variant can't be // truly private (only `#[doc(hidden)]`). #[doc(hidden)] -#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] +#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash)] pub struct PrivOwnedStr(Box); + +impl fmt::Debug for PrivOwnedStr { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + self.0.fmt(f) + } +} diff --git a/crates/ruma-identifiers/src/lib.rs b/crates/ruma-identifiers/src/lib.rs index 1b839a83..08627820 100644 --- a/crates/ruma-identifiers/src/lib.rs +++ b/crates/ruma-identifiers/src/lib.rs @@ -18,6 +18,7 @@ extern crate rand_crate as rand; #[cfg(feature = "serde")] use std::convert::TryFrom; +use std::fmt; #[cfg(feature = "serde")] use serde::de::{self, Deserializer, Unexpected}; @@ -188,5 +189,11 @@ macro_rules! user_id { // this crate. Used for string enums because their `_Custom` variant can't be // truly private (only `#[doc(hidden)]`). #[doc(hidden)] -#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord)] +#[derive(Clone, PartialEq, Eq, PartialOrd, Ord)] pub struct PrivOwnedStr(Box); + +impl fmt::Debug for PrivOwnedStr { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + self.0.fmt(f) + } +} diff --git a/crates/ruma-identity-service-api/src/lib.rs b/crates/ruma-identity-service-api/src/lib.rs index 9c725b5d..5c458d96 100644 --- a/crates/ruma-identity-service-api/src/lib.rs +++ b/crates/ruma-identity-service-api/src/lib.rs @@ -7,6 +7,8 @@ #![warn(missing_docs)] +use std::fmt; + pub mod association; pub mod authentication; pub mod invitation; @@ -19,5 +21,11 @@ pub mod tos; // this crate. Used for string enums because their `_Custom` variant can't be // truly private (only `#[doc(hidden)]`). #[doc(hidden)] -#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord)] +#[derive(Clone, PartialEq, Eq, PartialOrd, Ord)] pub struct PrivOwnedStr(Box); + +impl fmt::Debug for PrivOwnedStr { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + self.0.fmt(f) + } +} diff --git a/crates/ruma-push-gateway-api/src/lib.rs b/crates/ruma-push-gateway-api/src/lib.rs index e640b667..dc329f4e 100644 --- a/crates/ruma-push-gateway-api/src/lib.rs +++ b/crates/ruma-push-gateway-api/src/lib.rs @@ -7,11 +7,19 @@ #![warn(missing_docs)] +use std::fmt; + pub mod send_event_notification; // Wrapper around `Box` that cannot be used in a meaningful way outside of // this crate. Used for string enums because their `_Custom` variant can't be // truly private (only `#[doc(hidden)]`). #[doc(hidden)] -#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] +#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash)] pub struct PrivOwnedStr(Box); + +impl fmt::Debug for PrivOwnedStr { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + self.0.fmt(f) + } +}