Skip to content

Commit b122797

Browse files
committed
Further review comments and formatting
1 parent 6ff8478 commit b122797

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

crates/matrix-sdk-crypto/src/store/memorystore.rs

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ impl MemoryStore {
161161
*self.private_identity.write().unwrap() = private_identity;
162162
}
163163

164-
/// Return all the ['InboundGroupSession']s we have, paired with the
164+
/// Return all the [`InboundGroupSession`]s we have, paired with the
165165
/// `backed_up_to` value for each one (or "" where it is missing, which
166166
/// should never happen).
167167
async fn get_inbound_group_sessions_and_backed_up_to(
@@ -340,8 +340,9 @@ impl CryptoStore for MemoryStore {
340340
.filter(|(_, o)| o.as_ref().is_some_and(|o| o.as_str() == backup_version))
341341
.count()
342342
} else {
343-
// We asked about a nonexistent backup version - this doesn't make much sense, but we
344-
// can easily answer that nothing is backed up in this nonexistent backup.
343+
// We asked about a nonexistent backup version - this doesn't make much sense,
344+
// but we can easily answer that nothing is backed up in this
345+
// nonexistent backup.
345346
0
346347
};
347348

@@ -379,19 +380,21 @@ impl CryptoStore for MemoryStore {
379380
let mut inbound_group_sessions_backed_up_to =
380381
self.inbound_group_sessions_backed_up_to.write().unwrap();
381382

382-
for (room_id, session_id) in room_and_session_ids {
383+
for &(room_id, session_id) in room_and_session_ids {
383384
let session = self.inbound_group_sessions.get(room_id, session_id);
385+
384386
if let Some(session) = session {
385387
session.mark_as_backed_up();
386388

387389
inbound_group_sessions_backed_up_to
388-
.entry((*room_id).to_owned())
390+
.entry(room_id.to_owned())
389391
.or_default()
390-
.insert((*session_id).to_owned(), BackupVersion::from(backup_version));
392+
.insert(session_id.to_owned(), BackupVersion::from(backup_version));
391393

392394
self.inbound_group_sessions.add(session);
393395
}
394396
}
397+
395398
Ok(())
396399
}
397400

@@ -583,6 +586,7 @@ mod tests {
583586
use ruma::{room_id, user_id, RoomId};
584587
use vodozemac::{Curve25519PublicKey, Ed25519PublicKey};
585588

589+
use super::SessionId;
586590
use crate::{
587591
identities::device::testing::get_device,
588592
olm::{
@@ -592,8 +596,6 @@ mod tests {
592596
store::{memorystore::MemoryStore, Changes, CryptoStore, PendingChanges},
593597
};
594598

595-
use super::SessionId;
596-
597599
#[async_test]
598600
async fn test_session_store() {
599601
let (account, session) = get_account_and_session_test_helper();

0 commit comments

Comments
 (0)