diff --git a/crates/matrix-sdk-base/src/client.rs b/crates/matrix-sdk-base/src/client.rs index b5022a196..b05647a9c 100644 --- a/crates/matrix-sdk-base/src/client.rs +++ b/crates/matrix-sdk-base/src/client.rs @@ -1146,9 +1146,9 @@ impl BaseClient { /// ``` /// # use std::convert::TryFrom; /// # use matrix_sdk_base::BaseClient; - /// # use ruma::UserId; + /// # use ruma::{device_id, user_id}; /// # use futures::executor::block_on; - /// # let alice = Box::::try_from("@alice:example.org").unwrap(); + /// # let alice = user_id!("@alice:example.org").to_owned(); /// # let client = BaseClient::new().unwrap(); /// # block_on(async { /// let device = client.get_device(&alice, device_id!("DEVICEID")).await; diff --git a/crates/matrix-sdk-crypto/README.md b/crates/matrix-sdk-crypto/README.md index 66f95e791..f48d9b8bf 100644 --- a/crates/matrix-sdk-crypto/README.md +++ b/crates/matrix-sdk-crypto/README.md @@ -20,7 +20,10 @@ The state machine works in a push/pull manner: use std::{collections::BTreeMap, convert::TryFrom}; use matrix_sdk_crypto::{OlmMachine, OlmError}; -use ruma::{UserId, api::client::r0::sync::sync_events::{ToDevice, DeviceLists}}; +use ruma::{ + api::client::r0::sync::sync_events::{ToDevice, DeviceLists}, + device_id, UserId, +}; #[tokio::main] async fn main() -> Result<(), OlmError> { diff --git a/crates/matrix-sdk-crypto/src/file_encryption/key_export.rs b/crates/matrix-sdk-crypto/src/file_encryption/key_export.rs index 750b96c4c..39a97d203 100644 --- a/crates/matrix-sdk-crypto/src/file_encryption/key_export.rs +++ b/crates/matrix-sdk-crypto/src/file_encryption/key_export.rs @@ -76,7 +76,7 @@ pub enum KeyExportError { /// ```no_run /// # use std::io::Cursor; /// # use matrix_sdk_crypto::{OlmMachine, decrypt_key_export}; -/// # use ruma::user_id; +/// # use ruma::{device_id, user_id}; /// # use futures::executor::block_on; /// # let alice = user_id!("@alice:example.org"); /// # let machine = OlmMachine::new(&alice, device_id!("DEVICEID")); @@ -127,13 +127,13 @@ pub fn decrypt_key_export( /// # Examples /// ```no_run /// # use matrix_sdk_crypto::{OlmMachine, encrypt_key_export}; -/// # use ruma::{user_id, room_id}; +/// # use ruma::{device_id, user_id, room_id}; /// # use futures::executor::block_on; /// # let alice = user_id!("@alice:example.org"); /// # let machine = OlmMachine::new(&alice, device_id!("DEVICEID")); /// # block_on(async { /// let room_id = room_id!("!test:localhost"); -/// let exported_keys = machine.export_keys(|s| s.room_id() == &room_id).await.unwrap(); +/// let exported_keys = machine.export_keys(|s| s.room_id() == room_id).await.unwrap(); /// let encrypted_export = encrypt_key_export(&exported_keys, "1234", 1); /// # }); /// ``` diff --git a/crates/matrix-sdk-crypto/src/machine.rs b/crates/matrix-sdk-crypto/src/machine.rs index 150b018dd..f51ff4429 100644 --- a/crates/matrix-sdk-crypto/src/machine.rs +++ b/crates/matrix-sdk-crypto/src/machine.rs @@ -1224,9 +1224,9 @@ impl OlmMachine { /// ``` /// # use std::convert::TryFrom; /// # use matrix_sdk_crypto::OlmMachine; - /// # use ruma::UserId; + /// # use ruma::{device_id, user_id}; /// # use futures::executor::block_on; - /// # let alice = Box::::try_from("@alice:example.org").unwrap(); + /// # let alice = user_id!("@alice:example.org").to_owned(); /// # let machine = OlmMachine::new(&alice, device_id!("DEVICEID")); /// # block_on(async { /// let device = machine.get_device(&alice, device_id!("DEVICEID")).await; @@ -1265,9 +1265,9 @@ impl OlmMachine { /// ``` /// # use std::convert::TryFrom; /// # use matrix_sdk_crypto::OlmMachine; - /// # use ruma::UserId; + /// # use ruma::{device_id, user_id}; /// # use futures::executor::block_on; - /// # let alice = Box::::try_from("@alice:example.org").unwrap(); + /// # let alice = user_id!("@alice:example.org").to_owned(); /// # let machine = OlmMachine::new(&alice, device_id!("DEVICEID")); /// # block_on(async { /// let devices = machine.get_user_devices(&alice).await.unwrap(); @@ -1301,7 +1301,7 @@ impl OlmMachine { /// ```no_run /// # use std::io::Cursor; /// # use matrix_sdk_crypto::{OlmMachine, decrypt_key_export}; - /// # use ruma::user_id; + /// # use ruma::{device_id, user_id}; /// # use futures::executor::block_on; /// # let alice = user_id!("@alice:example.org"); /// # let machine = OlmMachine::new(&alice, device_id!("DEVICEID")); @@ -1413,13 +1413,13 @@ impl OlmMachine { /// /// ```no_run /// # use matrix_sdk_crypto::{OlmMachine, encrypt_key_export}; - /// # use ruma::{user_id, room_id}; + /// # use ruma::{device_id, user_id, room_id}; /// # use futures::executor::block_on; /// # let alice = user_id!("@alice:example.org"); /// # let machine = OlmMachine::new(&alice, device_id!("DEVICEID")); /// # block_on(async { /// let room_id = room_id!("!test:localhost"); - /// let exported_keys = machine.export_keys(|s| s.room_id() == &room_id).await.unwrap(); + /// let exported_keys = machine.export_keys(|s| s.room_id() == room_id).await.unwrap(); /// let encrypted_export = encrypt_key_export(&exported_keys, "1234", 1); /// # }); /// ``` diff --git a/crates/matrix-sdk-crypto/src/store/mod.rs b/crates/matrix-sdk-crypto/src/store/mod.rs index f91d7067f..371ba4a11 100644 --- a/crates/matrix-sdk-crypto/src/store/mod.rs +++ b/crates/matrix-sdk-crypto/src/store/mod.rs @@ -26,9 +26,9 @@ //! # OlmMachine, //! # store::MemoryStore, //! # }; -//! # use ruma::{user_id, DeviceId}; -//! # let user_id = user_id!("@example:localhost"); -//! # let device_id: Box = device_id!("TEST"); +//! # use ruma::{device_id, user_id}; +//! # let user_id = user_id!("@example:localhost").to_owned(); +//! # let device_id = device_id!("TEST").to_owned(); //! let store = Box::new(MemoryStore::new()); //! //! let machine = OlmMachine::new_with_store(user_id, device_id, store);