diff --git a/crates/matrix-sdk-common/src/deserialized_responses.rs b/crates/matrix-sdk-common/src/deserialized_responses.rs index 54366b475fd..0a25b539374 100644 --- a/crates/matrix-sdk-common/src/deserialized_responses.rs +++ b/crates/matrix-sdk-common/src/deserialized_responses.rs @@ -14,6 +14,8 @@ use std::{collections::BTreeMap, fmt}; +#[cfg(doc)] +use ruma::events::AnyTimelineEvent; use ruma::{ events::{AnyMessageLikeEvent, AnySyncTimelineEvent}, push::Action, diff --git a/crates/matrix-sdk-ui/src/timeline/controller/state.rs b/crates/matrix-sdk-ui/src/timeline/controller/state.rs index 18fa85cbe05..75bd8512f81 100644 --- a/crates/matrix-sdk-ui/src/timeline/controller/state.rs +++ b/crates/matrix-sdk-ui/src/timeline/controller/state.rs @@ -279,7 +279,7 @@ impl TimelineState { let handle_one_res = txn .handle_remote_event( - event.into(), + event, TimelineItemPosition::UpdateAt { timeline_item_index: idx }, room_data_provider, settings, @@ -759,7 +759,7 @@ impl TimelineStateTransaction<'_> { }, is_highlighted: push_actions .as_ref() - .map_or(false, |actions| actions.iter().any(Action::is_highlight)), + .is_some_and(|actions| actions.iter().any(Action::is_highlight)), flow: Flow::Remote { event_id: event_id.clone(), raw_event: raw, diff --git a/crates/matrix-sdk-ui/src/timeline/pinned_events_loader.rs b/crates/matrix-sdk-ui/src/timeline/pinned_events_loader.rs index 53b8444119e..28a9ed9a772 100644 --- a/crates/matrix-sdk-ui/src/timeline/pinned_events_loader.rs +++ b/crates/matrix-sdk-ui/src/timeline/pinned_events_loader.rs @@ -163,7 +163,7 @@ impl PinnedEventsRoom for Room { debug!("Loading pinned event {event_id} from HS"); self.event(event_id, request_config) .await - .map(|e| (e.into(), Vec::new())) + .map(|e| (e, Vec::new())) .map_err(|err| PaginatorError::SdkError(Box::new(err))) }) } diff --git a/crates/matrix-sdk/src/room/mod.rs b/crates/matrix-sdk/src/room/mod.rs index df74cffb391..c9b60222c41 100644 --- a/crates/matrix-sdk/src/room/mod.rs +++ b/crates/matrix-sdk/src/room/mod.rs @@ -326,7 +326,11 @@ impl Room { start: http_response.start, end: http_response.end, #[cfg(not(feature = "e2e-encryption"))] - chunk: http_response.chunk.into_iter().map(TimelineEvent::new).collect(), + chunk: http_response + .chunk + .into_iter() + .map(|raw| TimelineEvent::new(raw.cast())) + .collect(), #[cfg(feature = "e2e-encryption")] chunk: Vec::with_capacity(http_response.chunk.len()), state: http_response.state, @@ -481,7 +485,7 @@ impl Room { // Save the event into the event cache, if it's set up. if let Ok((cache, _handles)) = self.event_cache().await { - cache.save_event(event.clone().into()).await; + cache.save_event(event.clone()).await; } Ok(event) @@ -527,15 +531,15 @@ impl Room { if let Ok((cache, _handles)) = self.event_cache().await { let mut events_to_save: Vec = Vec::new(); if let Some(event) = &target_event { - events_to_save.push(event.clone().into()); + events_to_save.push(event.clone()); } for event in &events_before { - events_to_save.push(event.clone().into()); + events_to_save.push(event.clone()); } for event in &events_after { - events_to_save.push(event.clone().into()); + events_to_save.push(event.clone()); } cache.save_events(events_to_save).await; diff --git a/crates/matrix-sdk/src/sliding_sync/room.rs b/crates/matrix-sdk/src/sliding_sync/room.rs index 4615fb1d715..49ce04a0fe7 100644 --- a/crates/matrix-sdk/src/sliding_sync/room.rs +++ b/crates/matrix-sdk/src/sliding_sync/room.rs @@ -325,7 +325,7 @@ mod tests { })) .unwrap() .cast() - ).into() + ) }; } @@ -616,8 +616,7 @@ mod tests { })) .unwrap() .cast(), - ) - .into()], + )], }; let serialized = serde_json::to_value(&frozen_room).unwrap(); @@ -669,7 +668,6 @@ mod tests { .unwrap() .cast(), ) - .into() }) .collect::>(); @@ -706,7 +704,6 @@ mod tests { .unwrap() .cast(), ) - .into() }) .collect::>();