diff --git a/crates/ruma-events-macros/src/event.rs b/crates/ruma-events-macros/src/event.rs index 96609fe3..825bf7d1 100644 --- a/crates/ruma-events-macros/src/event.rs +++ b/crates/ruma-events-macros/src/event.rs @@ -169,9 +169,9 @@ fn expand_deserialize_event( EventKindVariation::Redacted | EventKindVariation::RedactedSync => { ty = quote! { #ruma_events::RedactedUnsignedWithPrevContent }; } - EventKindVariation::Stripped - | EventKindVariation::Initial - | EventKindVariation::RedactedStripped => unreachable!(), + EventKindVariation::Stripped | EventKindVariation::Initial => { + unreachable!() + } } } diff --git a/crates/ruma-events-macros/src/event_enum.rs b/crates/ruma-events-macros/src/event_enum.rs index 4f36bb81..fb88e721 100644 --- a/crates/ruma-events-macros/src/event_enum.rs +++ b/crates/ruma-events-macros/src/event_enum.rs @@ -341,19 +341,10 @@ fn expand_any_redacted( expand_any_with_deser(kind, events, attrs, variants, &V::Redacted, ruma_events); let sync_state = expand_any_with_deser(kind, events, attrs, variants, &V::RedactedSync, ruma_events); - let stripped_state = expand_any_with_deser( - kind, - events, - attrs, - variants, - &V::RedactedStripped, - ruma_events, - ); quote! { #full_state #sync_state - #stripped_state } } EventKind::Message => { @@ -535,13 +526,6 @@ fn expand_redact( kind.to_event_enum_ident(&EventKindVariation::RedactedSync)?, ) } - EventKindVariation::Stripped => { - let struct_id = kind.to_event_ident(&EventKindVariation::RedactedStripped)?; - ( - quote! { #ruma_events::#struct_id }, - kind.to_event_enum_ident(&EventKindVariation::RedactedStripped)?, - ) - } _ => return None, }; @@ -673,7 +657,7 @@ fn generate_custom_variant( let serde_json = quote! { #ruma_events::exports::serde_json }; - if matches!(var, V::Redacted | V::RedactedSync | V::RedactedStripped) { + if matches!(var, V::Redacted | V::RedactedSync) { ( quote! { /// A redacted event not defined by the Matrix specification @@ -744,7 +728,7 @@ fn accessor_methods( let ident = kind.to_event_enum_ident(var)?; // matching `EventKindVariation`s - if let V::Redacted | V::RedactedSync | V::RedactedStripped = var { + if let V::Redacted | V::RedactedSync = var { return redacted_accessor_methods(kind, var, variants, ruma_events); } @@ -822,10 +806,6 @@ fn inner_enum_idents(kind: &EventKind, var: &EventKindVariation) -> Option<(Iden kind.to_event_enum_ident(var)?, kind.to_event_enum_ident(&EventKindVariation::RedactedSync)?, ), - EventKindVariation::Stripped => ( - kind.to_event_enum_ident(var)?, - kind.to_event_enum_ident(&EventKindVariation::RedactedStripped)?, - ), _ => return None, }) } diff --git a/crates/ruma-events-macros/src/event_parse.rs b/crates/ruma-events-macros/src/event_parse.rs index 0003193d..16caf7c0 100644 --- a/crates/ruma-events-macros/src/event_parse.rs +++ b/crates/ruma-events-macros/src/event_parse.rs @@ -25,7 +25,6 @@ pub enum EventKindVariation { Initial, Redacted, RedactedSync, - RedactedStripped, } impl fmt::Display for EventKindVariation { @@ -37,21 +36,20 @@ impl fmt::Display for EventKindVariation { EventKindVariation::Initial => write!(f, "Initial"), EventKindVariation::Redacted => write!(f, "Redacted"), EventKindVariation::RedactedSync => write!(f, "RedactedSync"), - EventKindVariation::RedactedStripped => write!(f, "RedactedStripped"), } } } impl EventKindVariation { pub fn is_redacted(self) -> bool { - matches!(self, Self::Redacted | Self::RedactedSync | Self::RedactedStripped) + matches!(self, Self::Redacted | Self::RedactedSync) } pub fn to_full_variation(self) -> Self { match self { - EventKindVariation::Redacted - | EventKindVariation::RedactedSync - | EventKindVariation::RedactedStripped => EventKindVariation::Redacted, + EventKindVariation::Redacted | EventKindVariation::RedactedSync => { + EventKindVariation::Redacted + } EventKindVariation::Full | EventKindVariation::Sync | EventKindVariation::Stripped @@ -125,8 +123,7 @@ impl EventKind { | (Self::Message, V::Redacted) | (Self::State, V::Redacted) | (Self::Message, V::RedactedSync) - | (Self::State, V::RedactedSync) - | (Self::State, V::RedactedStripped) => Some(format_ident!("{}{}", var, self)), + | (Self::State, V::RedactedSync) => Some(format_ident!("{}{}", var, self)), _ => None, } } @@ -190,9 +187,6 @@ pub fn to_kind_variation(ident: &Ident) -> Option<(EventKind, EventKindVariation "InitialStateEvent" => Some((EventKind::State, EventKindVariation::Initial)), "RedactedStateEvent" => Some((EventKind::State, EventKindVariation::Redacted)), "RedactedSyncStateEvent" => Some((EventKind::State, EventKindVariation::RedactedSync)), - "RedactedStrippedStateEvent" => { - Some((EventKind::State, EventKindVariation::RedactedStripped)) - } "ToDeviceEvent" => Some((EventKind::ToDevice, EventKindVariation::Full)), "PresenceEvent" => Some((EventKind::Presence, EventKindVariation::Full)), "RedactionEvent" => Some((EventKind::Redaction, EventKindVariation::Full)), diff --git a/crates/ruma-events/src/event_kinds.rs b/crates/ruma-events/src/event_kinds.rs index 58d2d3e1..2d8c4c08 100644 --- a/crates/ruma-events/src/event_kinds.rs +++ b/crates/ruma-events/src/event_kinds.rs @@ -292,22 +292,6 @@ pub struct RedactedSyncStateEvent { pub unsigned: RedactedUnsigned, } -/// A stripped-down redacted state event. -#[derive(Clone, Debug, Event)] -pub struct RedactedStrippedStateEvent { - /// Data specific to the event type. - pub content: C, - - /// The fully-qualified ID of the user who sent this event. - pub sender: UserId, - - /// A unique key which defines the overwriting semantics for this piece of room state. - /// - /// This is often an empty string, but some events send a `UserId` to show which user the event - /// affects. - pub state_key: String, -} - /// An event sent using send-to-device messaging. #[derive(Clone, Debug, Event)] pub struct ToDeviceEvent {