From 851784c8c0ef7e97baba74cb9c1ba7bb49972e37 Mon Sep 17 00:00:00 2001 From: Benjamin Bouvier Date: Thu, 11 Jul 2024 16:42:36 +0200 Subject: [PATCH] nit(timeline): remove `else` after `return` --- .../src/timeline/event_handler.rs | 54 +++++++++---------- 1 file changed, 26 insertions(+), 28 deletions(-) diff --git a/crates/matrix-sdk-ui/src/timeline/event_handler.rs b/crates/matrix-sdk-ui/src/timeline/event_handler.rs index 1af5d11cf..b5f5e4c7e 100644 --- a/crates/matrix-sdk-ui/src/timeline/event_handler.rs +++ b/crates/matrix-sdk-ui/src/timeline/event_handler.rs @@ -554,35 +554,33 @@ impl<'a, 'o> TimelineEventHandler<'a, 'o> { if let TimelineItemContent::RedactedMessage = event_item.content() { debug!("Ignoring reaction on redacted event"); return; - } else { - let mut reactions = remote_event_item.reactions.clone(); - let reaction_group = reactions.entry(c.relates_to.key.clone()).or_default(); - - if let Some(txn_id) = old_txn_id { - let id = TimelineEventItemId::TransactionId(txn_id.clone()); - // Remove the local echo from the related event. - if reaction_group.0.swap_remove(&id).is_none() { - warn!( - "Received reaction with transaction ID, but didn't \ - find matching reaction in the related event's reactions" - ); - } - } - reaction_group.0.insert( - reaction_id.clone(), - ReactionSenderData { - sender_id: self.ctx.sender.clone(), - timestamp: self.ctx.timestamp, - }, - ); - - trace!("Adding reaction"); - self.items.set( - idx, - event_item.with_inner_kind(remote_event_item.with_reactions(reactions)), - ); - self.result.items_updated += 1; } + + let mut reactions = remote_event_item.reactions.clone(); + let reaction_group = reactions.entry(c.relates_to.key.clone()).or_default(); + + if let Some(txn_id) = old_txn_id { + let id = TimelineEventItemId::TransactionId(txn_id.clone()); + // Remove the local echo from the related event. + if reaction_group.0.swap_remove(&id).is_none() { + warn!( + "Received reaction with transaction ID, but didn't \ + find matching reaction in the related event's reactions" + ); + } + } + reaction_group.0.insert( + reaction_id.clone(), + ReactionSenderData { + sender_id: self.ctx.sender.clone(), + timestamp: self.ctx.timestamp, + }, + ); + + trace!("Adding reaction"); + self.items + .set(idx, event_item.with_inner_kind(remote_event_item.with_reactions(reactions))); + self.result.items_updated += 1; } else { trace!("Timeline item not found, adding reaction to the pending list"); let TimelineEventItemId::EventId(reaction_event_id) = reaction_id.clone() else {