diff --git a/crates/matrix-sdk-crypto/src/machine.rs b/crates/matrix-sdk-crypto/src/machine.rs index 9645441dd8d..df1d7f0d453 100644 --- a/crates/matrix-sdk-crypto/src/machine.rs +++ b/crates/matrix-sdk-crypto/src/machine.rs @@ -1830,13 +1830,9 @@ impl OlmMachine { ) -> StoreResult> { let mut exported = Vec::new(); - let sessions: Vec = self - .store() - .get_inbound_group_sessions() - .await? - .into_iter() - .filter(|s| predicate(s)) - .collect(); + let mut sessions = self.store().get_inbound_group_sessions().await?; + + sessions.retain(|s| predicate(s)); for session in sessions { let export = session.export().await;