Skip to content

Commit 5824cb6

Browse files
committed
Update tests
1 parent dfd59f4 commit 5824cb6

File tree

5 files changed

+19
-16
lines changed

5 files changed

+19
-16
lines changed

crates/matrix-sdk-base/src/client.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1146,9 +1146,9 @@ impl BaseClient {
11461146
/// ```
11471147
/// # use std::convert::TryFrom;
11481148
/// # use matrix_sdk_base::BaseClient;
1149-
/// # use ruma::UserId;
1149+
/// # use ruma::{device_id, user_id};
11501150
/// # use futures::executor::block_on;
1151-
/// # let alice = Box::<UserId>::try_from("@alice:example.org").unwrap();
1151+
/// # let alice = user_id!("@alice:example.org").to_owned();
11521152
/// # let client = BaseClient::new().unwrap();
11531153
/// # block_on(async {
11541154
/// let device = client.get_device(&alice, device_id!("DEVICEID")).await;

crates/matrix-sdk-crypto/README.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,10 @@ The state machine works in a push/pull manner:
2020
use std::{collections::BTreeMap, convert::TryFrom};
2121
2222
use matrix_sdk_crypto::{OlmMachine, OlmError};
23-
use ruma::{UserId, api::client::r0::sync::sync_events::{ToDevice, DeviceLists}};
23+
use ruma::{
24+
api::client::r0::sync::sync_events::{ToDevice, DeviceLists},
25+
device_id, UserId,
26+
};
2427
2528
#[tokio::main]
2629
async fn main() -> Result<(), OlmError> {

crates/matrix-sdk-crypto/src/file_encryption/key_export.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ pub enum KeyExportError {
7676
/// ```no_run
7777
/// # use std::io::Cursor;
7878
/// # use matrix_sdk_crypto::{OlmMachine, decrypt_key_export};
79-
/// # use ruma::user_id;
79+
/// # use ruma::{device_id, user_id};
8080
/// # use futures::executor::block_on;
8181
/// # let alice = user_id!("@alice:example.org");
8282
/// # let machine = OlmMachine::new(&alice, device_id!("DEVICEID"));
@@ -127,13 +127,13 @@ pub fn decrypt_key_export(
127127
/// # Examples
128128
/// ```no_run
129129
/// # use matrix_sdk_crypto::{OlmMachine, encrypt_key_export};
130-
/// # use ruma::{user_id, room_id};
130+
/// # use ruma::{device_id, user_id, room_id};
131131
/// # use futures::executor::block_on;
132132
/// # let alice = user_id!("@alice:example.org");
133133
/// # let machine = OlmMachine::new(&alice, device_id!("DEVICEID"));
134134
/// # block_on(async {
135135
/// let room_id = room_id!("!test:localhost");
136-
/// let exported_keys = machine.export_keys(|s| s.room_id() == &room_id).await.unwrap();
136+
/// let exported_keys = machine.export_keys(|s| s.room_id() == room_id).await.unwrap();
137137
/// let encrypted_export = encrypt_key_export(&exported_keys, "1234", 1);
138138
/// # });
139139
/// ```

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

+7-7
Original file line numberDiff line numberDiff line change
@@ -1224,9 +1224,9 @@ impl OlmMachine {
12241224
/// ```
12251225
/// # use std::convert::TryFrom;
12261226
/// # use matrix_sdk_crypto::OlmMachine;
1227-
/// # use ruma::UserId;
1227+
/// # use ruma::{device_id, user_id};
12281228
/// # use futures::executor::block_on;
1229-
/// # let alice = Box::<UserId>::try_from("@alice:example.org").unwrap();
1229+
/// # let alice = user_id!("@alice:example.org").to_owned();
12301230
/// # let machine = OlmMachine::new(&alice, device_id!("DEVICEID"));
12311231
/// # block_on(async {
12321232
/// let device = machine.get_device(&alice, device_id!("DEVICEID")).await;
@@ -1265,9 +1265,9 @@ impl OlmMachine {
12651265
/// ```
12661266
/// # use std::convert::TryFrom;
12671267
/// # use matrix_sdk_crypto::OlmMachine;
1268-
/// # use ruma::UserId;
1268+
/// # use ruma::{device_id, user_id};
12691269
/// # use futures::executor::block_on;
1270-
/// # let alice = Box::<UserId>::try_from("@alice:example.org").unwrap();
1270+
/// # let alice = user_id!("@alice:example.org").to_owned();
12711271
/// # let machine = OlmMachine::new(&alice, device_id!("DEVICEID"));
12721272
/// # block_on(async {
12731273
/// let devices = machine.get_user_devices(&alice).await.unwrap();
@@ -1301,7 +1301,7 @@ impl OlmMachine {
13011301
/// ```no_run
13021302
/// # use std::io::Cursor;
13031303
/// # use matrix_sdk_crypto::{OlmMachine, decrypt_key_export};
1304-
/// # use ruma::user_id;
1304+
/// # use ruma::{device_id, user_id};
13051305
/// # use futures::executor::block_on;
13061306
/// # let alice = user_id!("@alice:example.org");
13071307
/// # let machine = OlmMachine::new(&alice, device_id!("DEVICEID"));
@@ -1413,13 +1413,13 @@ impl OlmMachine {
14131413
///
14141414
/// ```no_run
14151415
/// # use matrix_sdk_crypto::{OlmMachine, encrypt_key_export};
1416-
/// # use ruma::{user_id, room_id};
1416+
/// # use ruma::{device_id, user_id, room_id};
14171417
/// # use futures::executor::block_on;
14181418
/// # let alice = user_id!("@alice:example.org");
14191419
/// # let machine = OlmMachine::new(&alice, device_id!("DEVICEID"));
14201420
/// # block_on(async {
14211421
/// let room_id = room_id!("!test:localhost");
1422-
/// let exported_keys = machine.export_keys(|s| s.room_id() == &room_id).await.unwrap();
1422+
/// let exported_keys = machine.export_keys(|s| s.room_id() == room_id).await.unwrap();
14231423
/// let encrypted_export = encrypt_key_export(&exported_keys, "1234", 1);
14241424
/// # });
14251425
/// ```

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

+3-3
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@
2626
//! # OlmMachine,
2727
//! # store::MemoryStore,
2828
//! # };
29-
//! # use ruma::{user_id, DeviceId};
30-
//! # let user_id = user_id!("@example:localhost");
31-
//! # let device_id: Box<DeviceId> = device_id!("TEST");
29+
//! # use ruma::{device_id, user_id};
30+
//! # let user_id = user_id!("@example:localhost").to_owned();
31+
//! # let device_id = device_id!("TEST").to_owned();
3232
//! let store = Box::new(MemoryStore::new());
3333
//!
3434
//! let machine = OlmMachine::new_with_store(user_id, device_id, store);

0 commit comments

Comments
 (0)