From f45e81751328b0700ddc390ee4a344c2e61086f8 Mon Sep 17 00:00:00 2001 From: Benjamin Bouvier Date: Tue, 15 Oct 2024 15:29:50 +0200 Subject: [PATCH] timeline: get rid of conversions from string to `TimelineEventItemId` I suppose these were useful at the FFI layer at some point, but they aren't anymore, so they could be removed. Changelog: Got rid of `From` for `TimelineEventItemId`. --- .../src/timeline/event_item/mod.rs | 33 +------------------ 1 file changed, 1 insertion(+), 32 deletions(-) diff --git a/crates/matrix-sdk-ui/src/timeline/event_item/mod.rs b/crates/matrix-sdk-ui/src/timeline/event_item/mod.rs index 291b6f4760c..57debe06999 100644 --- a/crates/matrix-sdk-ui/src/timeline/event_item/mod.rs +++ b/crates/matrix-sdk-ui/src/timeline/event_item/mod.rs @@ -115,23 +115,6 @@ impl From for TimelineEventItemId { } } -// TODO remove those two -impl From for TimelineEventItemId { - fn from(value: String) -> Self { - value.as_str().into() - } -} - -impl From<&str> for TimelineEventItemId { - fn from(value: &str) -> Self { - if let Ok(event_id) = EventId::parse(value) { - TimelineEventItemId::EventId(event_id) - } else { - TimelineEventItemId::TransactionId(value.into()) - } - } -} - /// An handle that usually allows to perform an action on a timeline event. /// /// If the item represents a remote item, then the event id is usually @@ -762,7 +745,7 @@ mod tests { }; use super::{EventTimelineItem, Profile}; - use crate::timeline::{TimelineDetails, TimelineEventItemId}; + use crate::timeline::TimelineDetails; #[async_test] async fn test_latest_message_event_can_be_wrapped_as_a_timeline_item() { @@ -987,20 +970,6 @@ mod tests { ); } - #[test] - fn test_raw_event_id_into_timeline_event_item_id_gets_event_id() { - let raw_id = "$123:example.com"; - let id: TimelineEventItemId = raw_id.into(); - assert_matches!(id, TimelineEventItemId::EventId(_)); - } - - #[test] - fn test_raw_str_into_timeline_event_item_id_gets_transaction_id() { - let raw_id = "something something"; - let id: TimelineEventItemId = raw_id.into(); - assert_matches!(id, TimelineEventItemId::TransactionId(_)); - } - fn member_event( room_id: &RoomId, user_id: &UserId,