From db0217d093ad4ce5afcfebb5c5589dd5fdd4b3b5 Mon Sep 17 00:00:00 2001 From: Jonas Platte Date: Thu, 1 Jun 2023 15:33:58 +0200 Subject: [PATCH] Box internally --- crates/matrix-sdk-ui/src/room_list/mod.rs | 4 ++-- crates/matrix-sdk-ui/tests/integration/room_list.rs | 4 ++-- crates/matrix-sdk/src/sliding_sync/list/mod.rs | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/crates/matrix-sdk-ui/src/room_list/mod.rs b/crates/matrix-sdk-ui/src/room_list/mod.rs index 2843b0b5a..8e1a5e6f9 100644 --- a/crates/matrix-sdk-ui/src/room_list/mod.rs +++ b/crates/matrix-sdk-ui/src/room_list/mod.rs @@ -54,7 +54,7 @@ impl RoomList { move |list| { *entries.lock().unwrap() = - Some(list.room_list_filtered_stream(Box::new(|_| true))); + Some(list.room_list_filtered_stream(|_| true)); list } @@ -135,7 +135,7 @@ impl RoomList { pub async fn update_entries_stream_filter( &self, - filter: Box bool + Sync + Send>, + filter: impl Fn(&RoomListEntry) -> bool + Sync + Send + 'static, ) -> Result<(), Error> { let mut entries_stream = self.entries_stream.try_write().map_err(|_| Error::CannotUpdateEntriesFilter)?; diff --git a/crates/matrix-sdk-ui/tests/integration/room_list.rs b/crates/matrix-sdk-ui/tests/integration/room_list.rs index 88b2dd294..5347f4392 100644 --- a/crates/matrix-sdk-ui/tests/integration/room_list.rs +++ b/crates/matrix-sdk-ui/tests/integration/room_list.rs @@ -646,12 +646,12 @@ async fn test_entries_stream_with_updated_filter() -> Result<(), Error> { // Second, update the filter. room_list - .update_entries_stream_filter(Box::new(|room_list_entry| { + .update_entries_stream_filter(|room_list_entry| { matches!( room_list_entry.as_room_id(), Some(room_id) if room_id.server_name() == "bar.org" ) - })) + }) .await?; // Third, let's get a new entries stream. diff --git a/crates/matrix-sdk/src/sliding_sync/list/mod.rs b/crates/matrix-sdk/src/sliding_sync/list/mod.rs index 48399429d..9a8efa764 100644 --- a/crates/matrix-sdk/src/sliding_sync/list/mod.rs +++ b/crates/matrix-sdk/src/sliding_sync/list/mod.rs @@ -135,7 +135,7 @@ impl SlidingSyncList { /// by `filter`. pub fn room_list_filtered_stream( &self, - filter: Box bool + Sync + Send>, + filter: impl Fn(&RoomListEntry) -> bool + Sync + Send + 'static, ) -> FilteredVectorSubscriber bool + Sync + Send>> { let (_, stream) =