Box internally

This commit is contained in:
Jonas Platte
2023-06-01 15:33:58 +02:00
parent 048b054a65
commit db0217d093
3 changed files with 5 additions and 5 deletions

View File

@@ -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<dyn Fn(&RoomListEntry) -> 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)?;

View File

@@ -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.

View File

@@ -135,7 +135,7 @@ impl SlidingSyncList {
/// by `filter`.
pub fn room_list_filtered_stream(
&self,
filter: Box<dyn Fn(&RoomListEntry) -> bool + Sync + Send>,
filter: impl Fn(&RoomListEntry) -> bool + Sync + Send + 'static,
) -> FilteredVectorSubscriber<RoomListEntry, Box<dyn Fn(&RoomListEntry) -> bool + Sync + Send>>
{
let (_, stream) =