From 42f0d83b5396fbca07414b76110ec6b1dbebbe11 Mon Sep 17 00:00:00 2001 From: Richard van der Hoff Date: Wed, 9 Oct 2024 15:01:59 +0100 Subject: [PATCH] timeline: remove redundant `Debug` implementations These are no longer required now that the event itself lives in an inner class. --- .../src/deserialized_responses.rs | 32 ++----------------- 1 file changed, 2 insertions(+), 30 deletions(-) diff --git a/crates/matrix-sdk-common/src/deserialized_responses.rs b/crates/matrix-sdk-common/src/deserialized_responses.rs index 5cd859cab67..c0717b28c96 100644 --- a/crates/matrix-sdk-common/src/deserialized_responses.rs +++ b/crates/matrix-sdk-common/src/deserialized_responses.rs @@ -303,7 +303,7 @@ pub struct EncryptionInfo { /// Previously, this differed from [`TimelineEvent`] by wrapping an /// [`AnySyncTimelineEvent`] instead of an [`AnyTimelineEvent`], but nowadays /// they are essentially identical, and one of them should probably be removed. -#[derive(Clone, Serialize)] +#[derive(Clone, Debug, Serialize)] pub struct SyncTimelineEvent { /// The event itself, together with any information on decryption. pub kind: TimelineEventKind, @@ -364,19 +364,6 @@ impl SyncTimelineEvent { } } -#[cfg(not(tarpaulin_include))] -impl fmt::Debug for SyncTimelineEvent { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - let SyncTimelineEvent { kind, push_actions } = self; - let mut s = f.debug_struct("SyncTimelineEvent"); - s.field("kind", &kind); - if !push_actions.is_empty() { - s.field("push_actions", push_actions); - } - s.finish() - } -} - impl From> for SyncTimelineEvent { fn from(inner: Raw) -> Self { Self::new(inner) @@ -448,7 +435,7 @@ impl<'de> Deserialize<'de> for SyncTimelineEvent { /// Previously, this differed from [`SyncTimelineEvent`] by wrapping an /// [`AnyTimelineEvent`] instead of an [`AnySyncTimelineEvent`], but nowadays /// they are essentially identical, and one of them should probably be removed. -#[derive(Clone)] +#[derive(Clone, Debug)] pub struct TimelineEvent { /// The event itself, together with any information on decryption. pub kind: TimelineEventKind, @@ -499,21 +486,6 @@ impl From for TimelineEvent { } } -#[cfg(not(tarpaulin_include))] -impl fmt::Debug for TimelineEvent { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - let TimelineEvent { kind, push_actions } = self; - let mut s = f.debug_struct("TimelineEvent"); - s.field("kind", &kind); - if let Some(push_actions) = &push_actions { - if !push_actions.is_empty() { - s.field("push_actions", push_actions); - } - } - s.finish() - } -} - /// The event within a [`TimelineEvent`] or [`SyncTimelineEvent`], together with /// encryption data. #[derive(Clone, Serialize, Deserialize)]