Skip to content

Commit

Permalink
chore(ui): Remove a useless clone.
Browse files Browse the repository at this point in the history
This patch removes a useless clone of `TimelineInner::items`. This clone
was technically cheap because it's a `Vector` behind the scene, which is
cheap to clone, but still, it's not necessary at all to clone it.
  • Loading branch information
Hywan committed Jun 10, 2024
1 parent e5487da commit d403c12
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions crates/matrix-sdk-ui/src/timeline/inner/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -425,8 +425,7 @@ impl<P: RoomDataProvider> TimelineInner<P> {
let user_id = self.room_data_provider.own_user_id();

let related_event = {
let items = state.items.clone();
let Some((_, item)) = rfind_event_by_id(&items, &annotation.event_id) else {
let Some((_, item)) = rfind_event_by_id(&state.items, &annotation.event_id) else {
warn!("Timeline item not found, can't update reaction ID");
return Err(Error::FailedToToggleReaction);
};
Expand Down

0 comments on commit d403c12

Please sign in to comment.