From 417e38b679c71cb051d8e82d2f0944542435aa09 Mon Sep 17 00:00:00 2001 From: Erik Johnston Date: Mon, 29 Jun 2026 10:00:08 +0100 Subject: [PATCH] Remove clone --- rust/src/events/formats/mod.rs | 13 +++++-------- rust/src/events/mod.rs | 1 - 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/rust/src/events/formats/mod.rs b/rust/src/events/formats/mod.rs index 8f24ffd757..9b6e636e68 100644 --- a/rust/src/events/formats/mod.rs +++ b/rust/src/events/formats/mod.rs @@ -95,13 +95,10 @@ pub use vmsc4242::EventFormatVMSC4242; /// pyclass. /// /// The `signatures` and `unsigned` fields are kept separate from the other -/// fields as they are mutable. Note the derived [`Clone`] is *shallow*: it -/// shares the mutable `signatures`/`unsigned`/internal state behind their -/// `Arc`s (cheap, and fine for read-only uses such as bundled aggregations). -/// Use [`FormattedEvent::deep_copy`] when an independently-mutable copy is -/// required. `common_fields` and `specific_fields` are both -/// `#[serde(flatten)]`ed so that the serialised JSON is a single flat object -/// matching the Matrix spec. +/// fields as they are mutable. Use [`FormattedEvent::deep_copy`] when an +/// independently-mutable copy is required. `common_fields` and +/// `specific_fields` are both `#[serde(flatten)]`ed so that the serialised JSON +/// is a single flat object matching the Matrix spec. /// /// Note, deserialization of this struct must not be done from /// [`serde_json::Value`] nor [`pythonize::depythonize`], due to a bug with @@ -109,7 +106,7 @@ pub use vmsc4242::EventFormatVMSC4242; /// Instead, deserialize directly from a JSON string with /// `serde_json::from_str`. See https://github.com/serde-rs/serde/issues/2230 /// for details. -#[derive(Clone, Serialize, Deserialize)] +#[derive(Serialize, Deserialize)] pub struct FormattedEvent> { /// The event's signatures. /// diff --git a/rust/src/events/mod.rs b/rust/src/events/mod.rs index 21d56e8e7a..3ed65689ee 100644 --- a/rust/src/events/mod.rs +++ b/rust/src/events/mod.rs @@ -141,7 +141,6 @@ pub fn register_module(py: Python<'_>, m: &Bound<'_, PyModule>) -> PyResult<()> /// `Clone` is shallow (see [`FormattedEvent`]) and lets an `Event` be held by /// value, e.g. inside [`BundledAggregations`](crate::events::relations::BundledAggregations). #[pyclass(frozen, weakref, skip_from_py_object)] -#[derive(Clone)] pub struct Event { /// The parsed event JSON. parsed_event: FormattedEvent,