diff --git a/crates/ruma-common/src/events/content.rs b/crates/ruma-common/src/events/content.rs index af07624e..f2de1e88 100644 --- a/crates/ruma-common/src/events/content.rs +++ b/crates/ruma-common/src/events/content.rs @@ -126,7 +126,7 @@ pub trait StateEventContent: EventContent { type StateKey: AsRef + Clone + fmt::Debug + DeserializeOwned + Serialize; /// The type of the event's `unsigned` field. - type Unsigned: Clone + fmt::Debug + Default + CanBeEmpty + StateUnsignedFromParts + Serialize; + type Unsigned: Clone + fmt::Debug + Default + CanBeEmpty + StateUnsignedFromParts; } /// Content of a redacted state event. diff --git a/crates/ruma-common/src/events/room/member.rs b/crates/ruma-common/src/events/room/member.rs index 50630a9a..8fea4b22 100644 --- a/crates/ruma-common/src/events/room/member.rs +++ b/crates/ruma-common/src/events/room/member.rs @@ -496,7 +496,7 @@ impl StrippedRoomMemberEvent { } /// Extra information about a message event that is not incorporated into the event's hash. -#[derive(Clone, Debug, Default, Deserialize, Serialize)] +#[derive(Clone, Debug, Default, Deserialize)] #[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)] pub struct RoomMemberUnsigned { /// The time in milliseconds that has elapsed since the event was sent. @@ -504,26 +504,23 @@ pub struct RoomMemberUnsigned { /// This field is generated by the local homeserver, and may be incorrect if the local time on /// at least one of the two servers is out of sync, which can cause the age to either be /// negative or greater than it actually is. - #[serde(skip_serializing_if = "Option::is_none")] pub age: Option, /// The client-supplied transaction ID, if the client being given the event is the same one /// which sent it. - #[serde(skip_serializing_if = "Option::is_none")] pub transaction_id: Option, /// Optional previous content of the event. - #[serde(skip_serializing_if = "Option::is_none")] pub prev_content: Option, /// State events to assist the receiver in identifying the room. - #[serde(default, skip_serializing_if = "Vec::is_empty")] + #[serde(default)] pub invite_room_state: Vec>, /// [Bundled aggregations] of related child events. /// /// [Bundled aggregations]: https://spec.matrix.org/v1.4/client-server-api/#aggregations - #[serde(rename = "m.relations", default, skip_serializing_if = "BundledRelations::is_empty")] + #[serde(rename = "m.relations", default)] pub relations: BundledRelations, } diff --git a/crates/ruma-common/src/events/unsigned.rs b/crates/ruma-common/src/events/unsigned.rs index ff20b843..ef65f289 100644 --- a/crates/ruma-common/src/events/unsigned.rs +++ b/crates/ruma-common/src/events/unsigned.rs @@ -1,5 +1,5 @@ use js_int::Int; -use serde::{Deserialize, Serialize}; +use serde::Deserialize; use serde_json::{from_str as from_json_str, value::RawValue as RawJsonValue}; use super::{ @@ -11,7 +11,7 @@ use crate::{ }; /// Extra information about a message event that is not incorporated into the event's hash. -#[derive(Clone, Debug, Default, Deserialize, Serialize)] +#[derive(Clone, Debug, Default, Deserialize)] #[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)] pub struct MessageLikeUnsigned { /// The time in milliseconds that has elapsed since the event was sent. @@ -19,18 +19,16 @@ pub struct MessageLikeUnsigned { /// This field is generated by the local homeserver, and may be incorrect if the local time on /// at least one of the two servers is out of sync, which can cause the age to either be /// negative or greater than it actually is. - #[serde(skip_serializing_if = "Option::is_none")] pub age: Option, /// The client-supplied transaction ID, if the client being given the event is the same one /// which sent it. - #[serde(skip_serializing_if = "Option::is_none")] pub transaction_id: Option, /// [Bundled aggregations] of related child events. /// /// [Bundled aggregations]: https://spec.matrix.org/v1.4/client-server-api/#aggregations - #[serde(rename = "m.relations", default, skip_serializing_if = "BundledRelations::is_empty")] + #[serde(rename = "m.relations", default)] pub relations: BundledRelations, } @@ -53,7 +51,7 @@ impl CanBeEmpty for MessageLikeUnsigned { } /// Extra information about a state event that is not incorporated into the event's hash. -#[derive(Clone, Debug, Deserialize, Serialize)] +#[derive(Clone, Debug, Deserialize)] #[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)] pub struct StateUnsigned { /// The time in milliseconds that has elapsed since the event was sent. @@ -61,22 +59,19 @@ pub struct StateUnsigned { /// This field is generated by the local homeserver, and may be incorrect if the local time on /// at least one of the two servers is out of sync, which can cause the age to either be /// negative or greater than it actually is. - #[serde(skip_serializing_if = "Option::is_none")] pub age: Option, /// The client-supplied transaction ID, if the client being given the event is the same one /// which sent it. - #[serde(skip_serializing_if = "Option::is_none")] pub transaction_id: Option, /// Optional previous content of the event. - #[serde(skip_serializing_if = "Option::is_none")] pub prev_content: Option, /// [Bundled aggregations] of related child events. /// /// [Bundled aggregations]: https://spec.matrix.org/v1.4/client-server-api/#aggregations - #[serde(rename = "m.relations", default, skip_serializing_if = "BundledRelations::is_empty")] + #[serde(rename = "m.relations", default)] pub relations: BundledRelations, }