From 40648f69981bdff3fa04d2d6860ccfe0778aeb85 Mon Sep 17 00:00:00 2001 From: Benjamin Bouvier Date: Mon, 2 Jun 2025 10:52:41 +0200 Subject: [PATCH] chore: formatting, clippy and review comments --- crates/matrix-sdk-ui/src/timeline/event_handler.rs | 1 + crates/matrix-sdk/src/event_cache/room/mod.rs | 10 ++++++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/crates/matrix-sdk-ui/src/timeline/event_handler.rs b/crates/matrix-sdk-ui/src/timeline/event_handler.rs index fff18125b..dcc6c979d 100644 --- a/crates/matrix-sdk-ui/src/timeline/event_handler.rs +++ b/crates/matrix-sdk-ui/src/timeline/event_handler.rs @@ -192,6 +192,7 @@ impl TimelineAction { /// /// The return value may be `None` if handling the event (be it a new item /// or an aggregation) is not supported for this event type. + #[allow(clippy::too_many_arguments)] pub async fn from_event( event: AnySyncTimelineEvent, raw_event: &Raw, diff --git a/crates/matrix-sdk/src/event_cache/room/mod.rs b/crates/matrix-sdk/src/event_cache/room/mod.rs index d9654c80a..4a523453a 100644 --- a/crates/matrix-sdk/src/event_cache/room/mod.rs +++ b/crates/matrix-sdk/src/event_cache/room/mod.rs @@ -1178,7 +1178,7 @@ mod private { for event in &events_to_post_process { self.maybe_apply_new_redaction(event).await?; - self.extract_thread_root(event).await?; + self.analyze_thread_root(event).await?; } // If we've never waited for an initial previous-batch token, and we now have at @@ -1194,15 +1194,17 @@ mod private { Ok(updates_as_vector_diffs) } - /// If the event has a thread root, ensure the thread root event has a thread summary. + /// If the event is a threaded reply, ensure the related thread's root + /// event (i.e. first thread event) has a thread summary. #[instrument(skip_all)] - async fn extract_thread_root(&mut self, event: &Event) -> Result<(), EventCacheError> { + async fn analyze_thread_root(&mut self, event: &Event) -> Result<(), EventCacheError> { let Some(thread_root) = extract_thread_root(event.raw()) else { // No thread root, carry on. return Ok(()); }; - // Add a thread summary to the event which has the thread root, if we knew about it. + // Add a thread summary to the event which has the thread root, if we knew about + // it. let Some((location, mut target_event)) = self.find_event(&thread_root).await? else { trace!("thread root event is missing from the linked chunk"); return Ok(());