Skip to content

Commit 44fe3a6

Browse files
committed
remove unneeded helper function
1 parent ba1b3e0 commit 44fe3a6

File tree

1 file changed

+8
-33
lines changed

1 file changed

+8
-33
lines changed

crates/matrix-sdk-crypto/src/machine.rs

Lines changed: 8 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -436,31 +436,6 @@ impl OlmMachine {
436436
}
437437
}
438438

439-
/// Should device or one-time keys be uploaded to the server.
440-
///
441-
/// This needs to be checked periodically, ideally after every sync request.
442-
///
443-
/// # Example
444-
///
445-
/// ```
446-
/// # use std::convert::TryFrom;
447-
/// # use matrix_sdk_crypto::OlmMachine;
448-
/// # use ruma::{user_id, device_id};
449-
/// # use futures::executor::block_on;
450-
/// # let alice = user_id!("@alice:example.org");
451-
/// # let machine = OlmMachine::new(alice, device_id!("DEVICEID"));
452-
/// # block_on(async {
453-
/// if machine.should_upload_keys().await {
454-
/// // Upload the keys here.
455-
/// }
456-
/// # });
457-
/// ```
458-
#[cfg(any(test, feature = "testing"))]
459-
#[allow(dead_code)]
460-
async fn should_upload_keys(&self) -> bool {
461-
self.account.should_upload_keys().await
462-
}
463-
464439
/// Get the underlying Olm account of the machine.
465440
#[cfg(any(test, feature = "testing"))]
466441
#[allow(dead_code)]
@@ -1710,7 +1685,7 @@ pub(crate) mod test {
17101685
#[async_test]
17111686
async fn create_olm_machine() {
17121687
let machine = OlmMachine::new(user_id(), alice_device_id());
1713-
assert!(machine.should_upload_keys().await);
1688+
assert!(machine.account().should_upload_keys().await);
17141689
}
17151690

17161691
#[async_test]
@@ -1720,21 +1695,21 @@ pub(crate) mod test {
17201695

17211696
response.one_time_key_counts.remove(&DeviceKeyAlgorithm::SignedCurve25519).unwrap();
17221697

1723-
assert!(machine.should_upload_keys().await);
1698+
assert!(machine.account().should_upload_keys().await);
17241699
machine.receive_keys_upload_response(&response).await.unwrap();
1725-
assert!(machine.should_upload_keys().await);
1700+
assert!(machine.account().should_upload_keys().await);
17261701

17271702
response.one_time_key_counts.insert(DeviceKeyAlgorithm::SignedCurve25519, uint!(10));
17281703
machine.receive_keys_upload_response(&response).await.unwrap();
1729-
assert!(machine.should_upload_keys().await);
1704+
assert!(machine.account().should_upload_keys().await);
17301705

17311706
response.one_time_key_counts.insert(DeviceKeyAlgorithm::SignedCurve25519, uint!(50));
17321707
machine.receive_keys_upload_response(&response).await.unwrap();
1733-
assert!(!machine.should_upload_keys().await);
1708+
assert!(!machine.account().should_upload_keys().await);
17341709

17351710
response.one_time_key_counts.remove(&DeviceKeyAlgorithm::SignedCurve25519);
17361711
machine.receive_keys_upload_response(&response).await.unwrap();
1737-
assert!(!machine.should_upload_keys().await);
1712+
assert!(!machine.account().should_upload_keys().await);
17381713
}
17391714

17401715
#[async_test]
@@ -1743,10 +1718,10 @@ pub(crate) mod test {
17431718

17441719
let mut response = keys_upload_response();
17451720

1746-
assert!(machine.should_upload_keys().await);
1721+
assert!(machine.account().should_upload_keys().await);
17471722

17481723
machine.receive_keys_upload_response(&response).await.unwrap();
1749-
assert!(machine.should_upload_keys().await);
1724+
assert!(machine.account().should_upload_keys().await);
17501725
assert!(machine.account.generate_one_time_keys().await.is_ok());
17511726

17521727
response.one_time_key_counts.insert(DeviceKeyAlgorithm::SignedCurve25519, uint!(50));

0 commit comments

Comments
 (0)