Skip to content

Commit

Permalink
timeline: remove redundant Debug implementations
Browse files Browse the repository at this point in the history
These are no longer required now that the event itself lives in an inner class.
  • Loading branch information
richvdh committed Oct 9, 2024
1 parent d9167f2 commit 42f0d83
Showing 1 changed file with 2 additions and 30 deletions.
32 changes: 2 additions & 30 deletions crates/matrix-sdk-common/src/deserialized_responses.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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<Raw<AnySyncTimelineEvent>> for SyncTimelineEvent {
fn from(inner: Raw<AnySyncTimelineEvent>) -> Self {
Self::new(inner)
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -499,21 +486,6 @@ impl From<DecryptedRoomEvent> 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)]
Expand Down

0 comments on commit 42f0d83

Please sign in to comment.