From 0ac2b84c026f53441e9b945f2b025ee9b80eab44 Mon Sep 17 00:00:00 2001 From: Devin Ragotzy Date: Sun, 2 Aug 2020 08:05:43 -0400 Subject: [PATCH] Unify import style across workspace --- matrix_sdk/src/client.rs | 35 ++++------ matrix_sdk/src/error.rs | 10 ++- matrix_sdk/src/lib.rs | 10 +-- matrix_sdk_base/src/client.rs | 77 ++++++++++----------- matrix_sdk_base/src/models/message.rs | 7 +- matrix_sdk_base/src/models/room.rs | 23 +++--- matrix_sdk_base/src/session.rs | 2 +- matrix_sdk_base/src/state/mod.rs | 6 +- matrix_sdk_common/src/lib.rs | 1 - matrix_sdk_crypto/src/device.rs | 7 +- matrix_sdk_crypto/src/machine.rs | 38 +++++----- matrix_sdk_crypto/src/memory_stores.rs | 6 +- matrix_sdk_crypto/src/olm/account.rs | 24 +++---- matrix_sdk_crypto/src/olm/group_sessions.rs | 35 +++++----- matrix_sdk_crypto/src/olm/session.rs | 28 ++++---- matrix_sdk_crypto/src/store/memorystore.rs | 7 +- matrix_sdk_crypto/src/store/mod.rs | 14 ++-- matrix_sdk_crypto/src/store/sqlite.rs | 16 ++--- 18 files changed, 164 insertions(+), 182 deletions(-) diff --git a/matrix_sdk/src/client.rs b/matrix_sdk/src/client.rs index 40ccf616..e619fb82 100644 --- a/matrix_sdk/src/client.rs +++ b/matrix_sdk/src/client.rs @@ -19,44 +19,37 @@ use std::{ collections::HashMap, convert::{TryFrom, TryInto}, fmt::{self, Debug}, + future::Future, path::Path, result::Result as StdResult, sync::Arc, }; +#[cfg(not(target_arch = "wasm32"))] +use crate::VERSION; +use crate::{Error, EventEmitter, Result}; +use futures_timer::Delay as sleep; +use http::{Method as HttpMethod, Response as HttpResponse}; +use matrix_sdk_base::{BaseClient, BaseClientConfig, Room, Session, StateStore}; +#[cfg(feature = "encryption")] +use matrix_sdk_common::identifiers::DeviceId; use matrix_sdk_common::{ - identifiers::ServerName, + api, + events::{room::message::MessageEventContent, EventType}, + identifiers::{EventId, RoomId, RoomIdOrAliasId, ServerName, UserId}, instant::{Duration, Instant}, js_int::UInt, locks::RwLock, presence::PresenceState, uuid::Uuid, + Endpoint, }; - -use futures_timer::Delay as sleep; -use std::future::Future; +use reqwest::header::{HeaderValue, InvalidHeaderValue, AUTHORIZATION}; #[cfg(feature = "encryption")] use tracing::{debug, warn}; use tracing::{error, info, instrument, trace}; - -use http::{Method as HttpMethod, Response as HttpResponse}; -use reqwest::header::{HeaderValue, InvalidHeaderValue, AUTHORIZATION}; use url::Url; -use crate::{ - events::{room::message::MessageEventContent, EventType}, - identifiers::{EventId, RoomId, RoomIdOrAliasId, UserId}, - Endpoint, -}; - -#[cfg(feature = "encryption")] -use crate::identifiers::DeviceId; - -#[cfg(not(target_arch = "wasm32"))] -use crate::VERSION; -use crate::{api, Error, EventEmitter, Result}; -use matrix_sdk_base::{BaseClient, BaseClientConfig, Room, Session, StateStore}; - const DEFAULT_SYNC_TIMEOUT: Duration = Duration::from_secs(30); /// An async/await enabled Matrix client. diff --git a/matrix_sdk/src/error.rs b/matrix_sdk/src/error.rs index e26fcf80..fbfdc716 100644 --- a/matrix_sdk/src/error.rs +++ b/matrix_sdk/src/error.rs @@ -14,16 +14,14 @@ //! Error conditions. -use reqwest::Error as ReqwestError; -use serde_json::Error as JsonError; -use thiserror::Error; - use matrix_sdk_base::Error as MatrixError; - -use crate::{ +use matrix_sdk_common::{ api::{r0::uiaa::UiaaResponse as UiaaError, Error as RumaClientError}, FromHttpResponseError as RumaResponseError, IntoHttpError as RumaIntoHttpError, }; +use reqwest::Error as ReqwestError; +use serde_json::Error as JsonError; +use thiserror::Error; /// Result type of the rust-sdk. pub type Result = std::result::Result; diff --git a/matrix_sdk/src/lib.rs b/matrix_sdk/src/lib.rs index f3e0e4ad..7215703e 100644 --- a/matrix_sdk/src/lib.rs +++ b/matrix_sdk/src/lib.rs @@ -42,17 +42,17 @@ pub use matrix_sdk_base::{ CustomOrRawEvent, Error as BaseError, EventEmitter, Room, RoomState, Session, StateStore, SyncRoom, }; -#[cfg(feature = "messages")] -pub use matrix_sdk_base::{MessageQueue, MessageWrapper, PossiblyRedactedExt}; -pub use matrix_sdk_common::*; -pub use reqwest::header::InvalidHeaderValue; - #[cfg(feature = "encryption")] pub use matrix_sdk_base::{Device, TrustState}; +#[cfg(feature = "messages")] +pub use matrix_sdk_base::{MessageQueue, PossiblyRedactedExt}; +pub use matrix_sdk_common::*; +pub use reqwest::header::InvalidHeaderValue; mod client; mod error; mod request_builder; + pub use client::{Client, ClientConfig, SyncSettings}; pub use error::{Error, Result}; pub use request_builder::{ diff --git a/matrix_sdk_base/src/client.rs b/matrix_sdk_base/src/client.rs index 99f60be9..9f70bdec 100644 --- a/matrix_sdk_base/src/client.rs +++ b/matrix_sdk_base/src/client.rs @@ -18,58 +18,53 @@ use std::collections::{BTreeMap, HashSet}; use std::{ collections::HashMap, fmt, + ops::Deref, path::{Path, PathBuf}, + result::Result as StdResult, sync::Arc, }; -use zeroize::Zeroizing; - -use std::result::Result as StdResult; - -use crate::{api::r0 as api, error::Result, events::presence::PresenceEvent}; -// `NonRoomEvent` is what it is aliased as -use crate::{ - event_emitter::CustomOrRawEvent, - events::{ - ignored_user_list::IgnoredUserListEvent, push_rules::PushRulesEvent, - room::member::MemberEventContent, - }, - identifiers::{RoomId, UserId}, - models::Room, - push::Ruleset, - session::Session, - state::{AllRooms, ClientState, StateStore}, - EventEmitter, -}; -use matrix_sdk_common::{ - events::{ - AnyBasicEvent, AnyStrippedStateEvent, AnySyncEphemeralRoomEvent, AnySyncMessageEvent, - AnySyncRoomEvent, AnySyncStateEvent, - }, - Raw, -}; #[cfg(feature = "encryption")] use matrix_sdk_common::locks::Mutex; -use matrix_sdk_common::locks::RwLock; -use std::ops::Deref; - #[cfg(feature = "encryption")] -use crate::api::r0::keys::{ - claim_keys::Response as KeysClaimResponse, get_keys::Response as KeysQueryResponse, - upload_keys::Response as KeysUploadResponse, DeviceKeys, KeyAlgorithm, +use matrix_sdk_common::{ + api::r0 as api, + api::r0::keys::{ + claim_keys::Response as KeysClaimResponse, get_keys::Response as KeysQueryResponse, + upload_keys::Response as KeysUploadResponse, DeviceKeys, KeyAlgorithm, + }, + api::r0::to_device::send_event_to_device, + events::room::{ + encrypted::EncryptedEventContent, message::MessageEventContent as MsgEventContent, + }, + identifiers::DeviceId, }; -#[cfg(feature = "encryption")] -use crate::api::r0::to_device::send_event_to_device; -#[cfg(feature = "encryption")] -use crate::events::room::{ - encrypted::EncryptedEventContent, message::MessageEventContent as MsgEventContent, +use matrix_sdk_common::{ + events::{ + ignored_user_list::IgnoredUserListEvent, push_rules::PushRulesEvent, + room::member::MemberEventContent, AnyBasicEvent, AnyStrippedStateEvent, + AnySyncEphemeralRoomEvent, AnySyncMessageEvent, AnySyncRoomEvent, AnySyncStateEvent, + }, + identifiers::{RoomId, UserId}, + locks::RwLock, + push::Ruleset, + Raw, }; #[cfg(feature = "encryption")] -use crate::identifiers::DeviceId; -#[cfg(not(target_arch = "wasm32"))] -use crate::JsonStore; -#[cfg(feature = "encryption")] use matrix_sdk_crypto::{CryptoStore, OlmError, OlmMachine, OneTimeKeys}; +use zeroize::Zeroizing; + +#[cfg(not(target_arch = "wasm32"))] +use crate::JsonStore; +use crate::{ + error::Result, + event_emitter::CustomOrRawEvent, + events::presence::PresenceEvent, + models::Room, + session::Session, + state::{AllRooms, ClientState, StateStore}, + EventEmitter, +}; pub type Token = String; diff --git a/matrix_sdk_base/src/models/message.rs b/matrix_sdk_base/src/models/message.rs index 29b9a582..bf3f0be2 100644 --- a/matrix_sdk_base/src/models/message.rs +++ b/matrix_sdk_base/src/models/message.rs @@ -5,11 +5,12 @@ use std::{time::SystemTime, vec::IntoIter}; -use matrix_sdk_common::identifiers::{EventId, UserId}; +use matrix_sdk_common::{ + events::AnyPossiblyRedactedSyncMessageEvent, + identifiers::{EventId, UserId}, +}; use serde::{de, ser, Serialize}; -use crate::events::AnyPossiblyRedactedSyncMessageEvent; - /// Exposes some of the field access methods found in the event held by /// `AnyPossiblyRedacted*` enums. /// diff --git a/matrix_sdk_base/src/models/room.rs b/matrix_sdk_base/src/models/room.rs index 6802f1e9..3db38be5 100644 --- a/matrix_sdk_base/src/models/room.rs +++ b/matrix_sdk_base/src/models/room.rs @@ -20,13 +20,11 @@ use std::{ convert::TryFrom, }; -use serde::{Deserialize, Serialize}; -use tracing::{debug, error, trace}; - #[cfg(feature = "messages")] -use super::message::MessageQueue; -use super::RoomMember; -use crate::{ +use matrix_sdk_common::events::{ + room::redaction::SyncRedactionEvent, AnyPossiblyRedactedSyncMessageEvent, AnySyncMessageEvent, +}; +use matrix_sdk_common::{ api::r0::sync::sync_events::{RoomSummary, UnreadNotificationsCount}, events::{ presence::{PresenceEvent, PresenceEventContent}, @@ -42,16 +40,15 @@ use crate::{ Algorithm, AnyStrippedStateEvent, AnySyncRoomEvent, AnySyncStateEvent, EventType, StrippedStateEvent, SyncStateEvent, }, + identifiers::{RoomAliasId, RoomId, UserId}, + js_int::{int, uint, Int, UInt}, }; +use serde::{Deserialize, Serialize}; +use tracing::{debug, error, trace}; #[cfg(feature = "messages")] -use crate::events::{ - room::redaction::SyncRedactionEvent, AnyPossiblyRedactedSyncMessageEvent, AnySyncMessageEvent, -}; - -use crate::identifiers::{RoomAliasId, RoomId, UserId}; - -use crate::js_int::{int, uint, Int, UInt}; +use super::message::MessageQueue; +use super::RoomMember; #[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] /// `RoomName` allows the calculation of a text room name. diff --git a/matrix_sdk_base/src/session.rs b/matrix_sdk_base/src/session.rs index 55b3c4bf..b240b5d0 100644 --- a/matrix_sdk_base/src/session.rs +++ b/matrix_sdk_base/src/session.rs @@ -15,7 +15,7 @@ //! User sessions. -use crate::identifiers::{DeviceId, UserId}; +use matrix_sdk_common::identifiers::{DeviceId, UserId}; /// A user session, containing an access token and information about the /// associated user account. diff --git a/matrix_sdk_base/src/state/mod.rs b/matrix_sdk_base/src/state/mod.rs index 6e7ac5a2..6d76e0b8 100644 --- a/matrix_sdk_base/src/state/mod.rs +++ b/matrix_sdk_base/src/state/mod.rs @@ -15,6 +15,10 @@ use std::collections::HashMap; +use matrix_sdk_common::{ + identifiers::{RoomId, UserId}, + push::Ruleset, +}; use serde::{Deserialize, Serialize}; #[cfg(not(target_arch = "wasm32"))] @@ -24,8 +28,6 @@ pub use json_store::JsonStore; use crate::{ client::{BaseClient, Token}, - identifiers::{RoomId, UserId}, - push::Ruleset, Result, Room, RoomState, Session, }; diff --git a/matrix_sdk_common/src/lib.rs b/matrix_sdk_common/src/lib.rs index 155c6ec4..bb478f9b 100644 --- a/matrix_sdk_common/src/lib.rs +++ b/matrix_sdk_common/src/lib.rs @@ -1,6 +1,5 @@ pub use instant; pub use js_int; - pub use ruma::{ api::{ client as api, diff --git a/matrix_sdk_crypto/src/device.rs b/matrix_sdk_crypto/src/device.rs index fe59f1d4..7aff977f 100644 --- a/matrix_sdk_crypto/src/device.rs +++ b/matrix_sdk_crypto/src/device.rs @@ -22,16 +22,15 @@ use std::{ }; use atomic::Atomic; -use serde_json::{json, Value}; - -#[cfg(test)] -use super::OlmMachine; use matrix_sdk_common::{ api::r0::keys::{AlgorithmAndDeviceId, DeviceKeys, KeyAlgorithm, SignedKey}, events::Algorithm, identifiers::{DeviceId, UserId}, }; +use serde_json::{json, Value}; +#[cfg(test)] +use super::OlmMachine; use crate::{error::SignatureError, verify_json}; /// A device represents a E2EE capable client of an user. diff --git a/matrix_sdk_crypto/src/machine.rs b/matrix_sdk_crypto/src/machine.rs index 67ba2f21..480070a6 100644 --- a/matrix_sdk_crypto/src/machine.rs +++ b/matrix_sdk_crypto/src/machine.rs @@ -21,19 +21,12 @@ use std::{ result::Result as StdResult, }; -#[cfg(feature = "sqlite-cryptostore")] -use super::store::sqlite::SqliteStore; -use super::{ - device::Device, - error::{EventError, MegolmError, MegolmResult, OlmError, OlmResult}, - olm::{ - Account, GroupSessionKey, IdentityKeys, InboundGroupSession, OlmMessage, - OutboundGroupSession, - }, - store::{memorystore::MemoryStore, Result as StoreResult}, - CryptoStore, +use api::r0::{ + keys, + keys::{AlgorithmAndDeviceId, DeviceKeys, KeyAlgorithm, OneTimeKey}, + sync::sync_events::Response as SyncResponse, + to_device::{send_event_to_device::Request as ToDeviceRequest, DeviceIdOrAllDevices}, }; - use matrix_sdk_common::{ api, events::{ @@ -47,17 +40,22 @@ use matrix_sdk_common::{ uuid::Uuid, Raw, }; - -use api::r0::{ - keys, - keys::{AlgorithmAndDeviceId, DeviceKeys, KeyAlgorithm, OneTimeKey}, - sync::sync_events::Response as SyncResponse, - to_device::{send_event_to_device::Request as ToDeviceRequest, DeviceIdOrAllDevices}, -}; - use serde_json::Value; use tracing::{debug, error, info, instrument, trace, warn}; +#[cfg(feature = "sqlite-cryptostore")] +use super::store::sqlite::SqliteStore; +use super::{ + device::Device, + error::{EventError, MegolmError, MegolmResult, OlmError, OlmResult}, + olm::{ + Account, GroupSessionKey, IdentityKeys, InboundGroupSession, OlmMessage, + OutboundGroupSession, + }, + store::{memorystore::MemoryStore, Result as StoreResult}, + CryptoStore, +}; + /// A map from the algorithm and device id to a one-time key. /// /// These keys need to be periodically uploaded to the server. diff --git a/matrix_sdk_crypto/src/memory_stores.rs b/matrix_sdk_crypto/src/memory_stores.rs index 0b465c4a..b91fbacc 100644 --- a/matrix_sdk_crypto/src/memory_stores.rs +++ b/matrix_sdk_crypto/src/memory_stores.rs @@ -15,13 +15,15 @@ use std::{collections::HashMap, sync::Arc}; use dashmap::{DashMap, ReadOnlyView}; -use matrix_sdk_common::locks::Mutex; +use matrix_sdk_common::{ + identifiers::{DeviceId, RoomId, UserId}, + locks::Mutex, +}; use super::{ device::Device, olm::{InboundGroupSession, Session}, }; -use matrix_sdk_common::identifiers::{DeviceId, RoomId, UserId}; /// In-memory store for Olm Sessions. #[derive(Debug, Default)] diff --git a/matrix_sdk_crypto/src/olm/account.rs b/matrix_sdk_crypto/src/olm/account.rs index 9fa2c17f..793fd1a1 100644 --- a/matrix_sdk_crypto/src/olm/account.rs +++ b/matrix_sdk_crypto/src/olm/account.rs @@ -12,8 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -use matrix_sdk_common::instant::Instant; use std::{ + collections::BTreeMap, convert::{TryFrom, TryInto}, fmt, sync::{ @@ -22,30 +22,28 @@ use std::{ }, }; -use matrix_sdk_common::locks::Mutex; -use serde_json::{json, Value}; -use std::collections::BTreeMap; - -pub use olm_rs::account::IdentityKeys; +use matrix_sdk_common::{ + api::r0::keys::{AlgorithmAndDeviceId, DeviceKeys, KeyAlgorithm, OneTimeKey, SignedKey}, + events::Algorithm, + identifiers::{DeviceId, RoomId, UserId}, + instant::Instant, + locks::Mutex, +}; use olm_rs::{ account::{OlmAccount, OneTimeKeys}, errors::{OlmAccountError, OlmSessionError}, PicklingMode, }; +use serde_json::{json, Value}; -use crate::{device::Device, error::SessionCreationError}; pub use olm_rs::{ + account::IdentityKeys, session::{OlmMessage, PreKeyMessage}, utility::OlmUtility, }; -use matrix_sdk_common::{ - api::r0::keys::{AlgorithmAndDeviceId, DeviceKeys, KeyAlgorithm, OneTimeKey, SignedKey}, - events::Algorithm, - identifiers::{DeviceId, RoomId, UserId}, -}; - use super::{InboundGroupSession, OutboundGroupSession, Session}; +use crate::{device::Device, error::SessionCreationError}; /// Account holding identity keys for which sessions can be created. /// diff --git a/matrix_sdk_crypto/src/olm/group_sessions.rs b/matrix_sdk_crypto/src/olm/group_sessions.rs index e3725d04..bbb36227 100644 --- a/matrix_sdk_crypto/src/olm/group_sessions.rs +++ b/matrix_sdk_crypto/src/olm/group_sessions.rs @@ -12,7 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -use matrix_sdk_common::instant::Instant; use std::{ convert::TryInto, fmt, @@ -22,31 +21,31 @@ use std::{ }, }; -use matrix_sdk_common::locks::Mutex; -use serde::Serialize; -use serde_json::{json, Value}; -use zeroize::Zeroize; - -pub use olm_rs::account::IdentityKeys; -use olm_rs::{ - errors::OlmGroupSessionError, inbound_group_session::OlmInboundGroupSession, - outbound_group_session::OlmOutboundGroupSession, PicklingMode, -}; - -use crate::error::{EventError, MegolmResult}; -pub use olm_rs::{ - session::{OlmMessage, PreKeyMessage}, - utility::OlmUtility, -}; - use matrix_sdk_common::{ events::{ room::{encrypted::EncryptedEventContent, message::MessageEventContent}, Algorithm, AnySyncRoomEvent, EventType, SyncMessageEvent, }, identifiers::{DeviceId, RoomId}, + instant::Instant, + locks::Mutex, Raw, }; +use olm_rs::{ + errors::OlmGroupSessionError, inbound_group_session::OlmInboundGroupSession, + outbound_group_session::OlmOutboundGroupSession, PicklingMode, +}; +use serde::Serialize; +use serde_json::{json, Value}; +use zeroize::Zeroize; + +pub use olm_rs::{ + account::IdentityKeys, + session::{OlmMessage, PreKeyMessage}, + utility::OlmUtility, +}; + +use crate::error::{EventError, MegolmResult}; /// The private session key of a group session. /// Can be used to create a new inbound group session. diff --git a/matrix_sdk_crypto/src/olm/session.rs b/matrix_sdk_crypto/src/olm/session.rs index eb52cebc..a1ca78b9 100644 --- a/matrix_sdk_crypto/src/olm/session.rs +++ b/matrix_sdk_crypto/src/olm/session.rs @@ -14,21 +14,6 @@ use std::{collections::BTreeMap, fmt, sync::Arc}; -use olm_rs::{errors::OlmSessionError, session::OlmSession, PicklingMode}; - -use serde_json::{json, Value}; - -pub use olm_rs::{ - session::{OlmMessage, PreKeyMessage}, - utility::OlmUtility, -}; - -use super::IdentityKeys; -use crate::{ - error::{EventError, OlmResult}, - Device, -}; - use matrix_sdk_common::{ api::r0::keys::KeyAlgorithm, events::{ @@ -39,6 +24,19 @@ use matrix_sdk_common::{ instant::Instant, locks::Mutex, }; +use olm_rs::{errors::OlmSessionError, session::OlmSession, PicklingMode}; +use serde_json::{json, Value}; + +use super::IdentityKeys; +use crate::{ + error::{EventError, OlmResult}, + Device, +}; + +pub use olm_rs::{ + session::{OlmMessage, PreKeyMessage}, + utility::OlmUtility, +}; /// Cryptographic session that enables secure communication between two /// `Account`s diff --git a/matrix_sdk_crypto/src/store/memorystore.rs b/matrix_sdk_crypto/src/store/memorystore.rs index 071c697a..77c53538 100644 --- a/matrix_sdk_crypto/src/store/memorystore.rs +++ b/matrix_sdk_crypto/src/store/memorystore.rs @@ -15,15 +15,16 @@ use std::{collections::HashSet, sync::Arc}; use async_trait::async_trait; -use matrix_sdk_common::locks::Mutex; +use matrix_sdk_common::{ + identifiers::{DeviceId, RoomId, UserId}, + locks::Mutex, +}; use super::{Account, CryptoStore, InboundGroupSession, Result, Session}; use crate::{ device::Device, memory_stores::{DeviceStore, GroupSessionStore, SessionStore, UserDevices}, }; -use matrix_sdk_common::identifiers::{DeviceId, RoomId, UserId}; - #[derive(Debug)] pub struct MemoryStore { sessions: SessionStore, diff --git a/matrix_sdk_crypto/src/store/mod.rs b/matrix_sdk_crypto/src/store/mod.rs index ab0f2a24..c45f2d17 100644 --- a/matrix_sdk_crypto/src/store/mod.rs +++ b/matrix_sdk_crypto/src/store/mod.rs @@ -12,23 +12,25 @@ // See the License for the specific language governing permissions and // limitations under the License. -use core::fmt::Debug; use std::{collections::HashSet, io::Error as IoError, sync::Arc}; -use url::ParseError; use async_trait::async_trait; -use matrix_sdk_common::locks::Mutex; +use core::fmt::Debug; +use matrix_sdk_common::{ + identifiers::{DeviceId, RoomId, UserId}, + locks::Mutex, +}; +use matrix_sdk_common_macros::send_sync; +use olm_rs::errors::{OlmAccountError, OlmGroupSessionError, OlmSessionError}; use serde_json::Error as SerdeError; use thiserror::Error; +use url::ParseError; use super::{ device::Device, memory_stores::UserDevices, olm::{Account, InboundGroupSession, Session}, }; -use matrix_sdk_common::identifiers::{DeviceId, RoomId, UserId}; -use matrix_sdk_common_macros::send_sync; -use olm_rs::errors::{OlmAccountError, OlmGroupSessionError, OlmSessionError}; pub mod memorystore; diff --git a/matrix_sdk_crypto/src/store/sqlite.rs b/matrix_sdk_crypto/src/store/sqlite.rs index 6f407be4..544fb62f 100644 --- a/matrix_sdk_crypto/src/store/sqlite.rs +++ b/matrix_sdk_crypto/src/store/sqlite.rs @@ -12,7 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -use matrix_sdk_common::instant::{Duration, Instant}; use std::{ collections::{BTreeMap, HashSet}, convert::TryFrom, @@ -20,12 +19,18 @@ use std::{ result::Result as StdResult, sync::Arc, }; -use url::Url; use async_trait::async_trait; -use matrix_sdk_common::locks::Mutex; +use matrix_sdk_common::{ + api::r0::keys::{AlgorithmAndDeviceId, KeyAlgorithm}, + events::Algorithm, + identifiers::{DeviceId, RoomId, UserId}, + instant::{Duration, Instant}, + locks::Mutex, +}; use olm_rs::PicklingMode; use sqlx::{query, query_as, sqlite::SqliteQueryAs, Connect, Executor, SqliteConnection}; +use url::Url; use zeroize::Zeroizing; use super::{CryptoStore, CryptoStoreError, Result}; @@ -34,11 +39,6 @@ use crate::{ memory_stores::{DeviceStore, GroupSessionStore, SessionStore, UserDevices}, Account, IdentityKeys, InboundGroupSession, Session, }; -use matrix_sdk_common::{ - api::r0::keys::{AlgorithmAndDeviceId, KeyAlgorithm}, - events::Algorithm, - identifiers::{DeviceId, RoomId, UserId}, -}; /// SQLite based implementation of a `CryptoStore`. pub struct SqliteStore {