From ee238392591bb7c759ca3a4115b023ef4f4f3048 Mon Sep 17 00:00:00 2001 From: Andy Balaam Date: Fri, 15 Mar 2024 12:10:28 +0000 Subject: [PATCH 1/3] crypto: Remove unused imports from integration_tests.rs The warnings were hidden because no-one within this crate used this macro. --- crates/matrix-sdk-crypto/src/store/integration_tests.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/crates/matrix-sdk-crypto/src/store/integration_tests.rs b/crates/matrix-sdk-crypto/src/store/integration_tests.rs index 9373300ef..1011b89ad 100644 --- a/crates/matrix-sdk-crypto/src/store/integration_tests.rs +++ b/crates/matrix-sdk-crypto/src/store/integration_tests.rs @@ -10,12 +10,11 @@ macro_rules! cryptostore_integration_tests { use matrix_sdk_test::async_test; use ruma::{ device_id, - encryption::SignedKey, events::secret::request::SecretName, room_id, - serde::{Base64, Raw}, + serde::Raw, to_device::DeviceIdOrAllDevices, - user_id, DeviceId, JsOption, OwnedDeviceId, OwnedUserId, RoomId, TransactionId, UserId + user_id, DeviceId, RoomId, TransactionId, UserId }; use serde_json::value::to_raw_value; use $crate::{ @@ -24,7 +23,7 @@ macro_rules! cryptostore_integration_tests { PrivateCrossSigningIdentity, Account, Session, }, store::{ - BackupKeys, Changes, CryptoStore, DeviceChanges, + Changes, CryptoStore, DeviceChanges, GossipRequest, IdentityChanges, BackupDecryptionKey, RoomSettings, PendingChanges, }, testing::{get_device, get_other_identity, get_own_identity}, From 69ac7e07e6496bcc2e54373a5c966775e4c0e4b7 Mon Sep 17 00:00:00 2001 From: Andy Balaam Date: Fri, 15 Mar 2024 12:24:36 +0000 Subject: [PATCH 2/3] crypto: Fix warnings in integration tests --- .../matrix-sdk-crypto/src/store/integration_tests.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/crates/matrix-sdk-crypto/src/store/integration_tests.rs b/crates/matrix-sdk-crypto/src/store/integration_tests.rs index 1011b89ad..c4abb7ec7 100644 --- a/crates/matrix-sdk-crypto/src/store/integration_tests.rs +++ b/crates/matrix-sdk-crypto/src/store/integration_tests.rs @@ -299,7 +299,7 @@ macro_rules! cryptostore_integration_tests { get_loaded_store("mark_inbound_group_sessions_as_backed_up").await; let room_id = &room_id!("!test:localhost"); let mut sessions: Vec = Vec::with_capacity(10); - for i in 0..10 { + for _i in 0..10 { sessions.push(account.create_group_session_pair_with_defaults(room_id).await.1); } let changes = Changes { inbound_group_sessions: sessions.clone(), ..Default::default() }; @@ -311,7 +311,7 @@ macro_rules! cryptostore_integration_tests { } // When I mark some as backed up - let x = store.mark_inbound_group_sessions_as_backed_up(&[ + store.mark_inbound_group_sessions_as_backed_up(&[ session_info(&sessions[1]), session_info(&sessions[3]), session_info(&sessions[5]), @@ -377,7 +377,7 @@ macro_rules! cryptostore_integration_tests { let room_id = &room_id!("!test:localhost"); let (_, session) = account.create_group_session_pair_with_defaults(room_id).await; - let mut export = session.export().await; + let export = session.export().await; let session = InboundGroupSession::from_export(&export).unwrap(); @@ -398,7 +398,7 @@ macro_rules! cryptostore_integration_tests { .unwrap() .unwrap(); assert_eq!(session, loaded_session); - let export = loaded_session.export().await; + loaded_session.export().await; assert_eq!(store.get_inbound_group_sessions().await.unwrap().len(), 1); assert_eq!(store.inbound_group_session_counts().await.unwrap().total, 1); @@ -849,7 +849,7 @@ macro_rules! cryptostore_integration_tests { #[async_test] async fn room_settings_saving() { - let (account, store) = get_loaded_store("room_settings_saving").await; + let (_, store) = get_loaded_store("room_settings_saving").await; let room_1 = room_id!("!test_1:localhost"); let settings_1 = RoomSettings { @@ -914,7 +914,7 @@ macro_rules! cryptostore_integration_tests { #[async_test] async fn custom_value_saving() { - let (account, store) = get_loaded_store("custom_value_saving").await; + let (_, store) = get_loaded_store("custom_value_saving").await; store.set_custom_value("A", "Hello".as_bytes().to_vec()).await.unwrap(); let loaded_1 = store.get_custom_value("A").await.unwrap(); From 9159a5983b188d021f0e1270220991faf3922236 Mon Sep 17 00:00:00 2001 From: Andy Balaam Date: Fri, 15 Mar 2024 12:24:55 +0000 Subject: [PATCH 3/3] crypto: Fix typo bug in integration tests --- crates/matrix-sdk-crypto/src/store/integration_tests.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/matrix-sdk-crypto/src/store/integration_tests.rs b/crates/matrix-sdk-crypto/src/store/integration_tests.rs index c4abb7ec7..d0c1ab2d7 100644 --- a/crates/matrix-sdk-crypto/src/store/integration_tests.rs +++ b/crates/matrix-sdk-crypto/src/store/integration_tests.rs @@ -426,13 +426,13 @@ macro_rules! cryptostore_integration_tests { let loaded_alice = loaded.get(alice).expect("Alice should be in the store as a tracked user"); let loaded_bob = - loaded.get(alice).expect("Bob should be in the store as as tracked user"); + loaded.get(bob).expect("Bob should be in the store as as tracked user"); assert!(!loaded.contains_key(candy), "Candy shouldn't be part of the store"); assert_eq!(loaded.len(), 2, "Candy shouldn't be part of the store"); assert!(loaded_alice.dirty, "Alice should be considered to be dirty"); - assert!(loaded_alice.dirty, "Bob should not be considered to be dirty"); + assert!(!loaded_bob.dirty, "Bob should not be considered to be dirty"); }; let loaded = store.load_tracked_users().await.unwrap();