From 70f48be58241bcbb4405ce69fd71abab9e5101df Mon Sep 17 00:00:00 2001 From: Benjamin Bouvier Date: Thu, 26 Jun 2025 11:09:59 +0200 Subject: [PATCH] refactor(sliding sync): avoid an unwrap by inlining a function into its one caller --- crates/matrix-sdk/src/sliding_sync/client.rs | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/crates/matrix-sdk/src/sliding_sync/client.rs b/crates/matrix-sdk/src/sliding_sync/client.rs index d6c9f1387..d1d643fdb 100644 --- a/crates/matrix-sdk/src/sliding_sync/client.rs +++ b/crates/matrix-sdk/src/sliding_sync/client.rs @@ -198,16 +198,9 @@ impl SlidingSyncResponseProcessor { .await?; handle_receipts_extension(&self.client, response, &mut sync_response).await?; + update_in_memory_caches(&self.client, &sync_response).await?; + self.response = Some(sync_response); - self.post_process().await - } - - async fn post_process(&mut self) -> Result<()> { - // This is an internal API misuse if this is triggered (calling - // `handle_room_response` after this function), so panic is fine. - let response = self.response.as_ref().unwrap(); - - update_in_memory_caches(&self.client, response).await?; Ok(()) }