mirror of
https://github.com/matrix-org/matrix-rust-sdk.git
synced 2026-05-18 05:30:33 -04:00
Remove module::* imports
This commit is contained in:
committed by
Jonas Platte
parent
b2a1e3d268
commit
3c8a59a43a
@@ -1,6 +1,6 @@
|
||||
use std::{ops::Deref, sync::Arc};
|
||||
|
||||
use criterion::*;
|
||||
use criterion::{criterion_group, criterion_main, BatchSize, BenchmarkId, Criterion, Throughput};
|
||||
use matrix_sdk_crypto::{EncryptionSettings, OlmMachine};
|
||||
use matrix_sdk_sqlite::SqliteCryptoStore;
|
||||
use matrix_sdk_test::response_from_file;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
use std::sync::Arc;
|
||||
|
||||
use criterion::*;
|
||||
use criterion::{criterion_group, criterion_main, BenchmarkId, Criterion, Throughput};
|
||||
use matrix_sdk::{
|
||||
config::StoreConfig,
|
||||
matrix_auth::{Session, SessionTokens},
|
||||
|
||||
@@ -173,7 +173,7 @@ mod test {
|
||||
use ruma::api::client::backup::KeyBackupData;
|
||||
use serde_json::json;
|
||||
|
||||
use super::*;
|
||||
use super::BackupRecoveryKey;
|
||||
|
||||
#[test]
|
||||
fn test_decrypt_key() {
|
||||
|
||||
@@ -100,10 +100,10 @@ impl From<InnerStoreError> for DecryptionError {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
|
||||
use assert_matches::assert_matches;
|
||||
use matrix_sdk_crypto::MegolmError;
|
||||
|
||||
use super::*;
|
||||
use super::DecryptionError;
|
||||
|
||||
#[test]
|
||||
fn test_withheld_error_mapping() {
|
||||
|
||||
@@ -565,7 +565,7 @@ mod tests {
|
||||
Mock, MockServer, ResponseTemplate,
|
||||
};
|
||||
|
||||
use super::*;
|
||||
use crate::{AppService, AppServiceBuilder, AppServiceRegistration, Result};
|
||||
|
||||
fn registration_string() -> String {
|
||||
include_str!("../tests/registration.yaml").to_owned()
|
||||
|
||||
@@ -379,9 +379,9 @@ impl RoomMemberships {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
#[test]
|
||||
use super::{calculate_room_name, DisplayName};
|
||||
|
||||
#[test]
|
||||
fn test_calculate_room_name() {
|
||||
let mut actual = calculate_room_name(2, 0, vec!["a"]);
|
||||
assert_eq!(DisplayName::Calculated("a".to_owned()), actual);
|
||||
|
||||
@@ -1116,8 +1116,11 @@ mod test {
|
||||
use std::sync::Arc;
|
||||
|
||||
use assign::assign;
|
||||
#[cfg(feature = "experimental-sliding-sync")]
|
||||
use matrix_sdk_common::deserialized_responses::SyncTimelineEvent;
|
||||
use matrix_sdk_test::async_test;
|
||||
use ruma::{
|
||||
api::client::sync::sync_events::v3::RoomSummary as RumaSummary,
|
||||
events::{
|
||||
room::{
|
||||
canonical_alias::RoomCanonicalAliasEventContent,
|
||||
@@ -1131,14 +1134,16 @@ mod test {
|
||||
},
|
||||
room_alias_id, room_id,
|
||||
serde::Raw,
|
||||
user_id,
|
||||
user_id, UserId,
|
||||
};
|
||||
use serde_json::json;
|
||||
|
||||
use super::*;
|
||||
#[cfg(feature = "experimental-sliding-sync")]
|
||||
use super::SyncInfo;
|
||||
use super::{Room, RoomInfo, RoomState};
|
||||
use crate::{
|
||||
store::{MemoryStore, StateChanges, StateStore},
|
||||
MinimalStateEvent, OriginalMinimalStateEvent,
|
||||
DisplayName, MinimalStateEvent, OriginalMinimalStateEvent,
|
||||
};
|
||||
|
||||
#[test]
|
||||
@@ -1147,6 +1152,9 @@ mod test {
|
||||
// This test exists to make sure we don't accidentally change the
|
||||
// serialized format for `RoomInfo`.
|
||||
|
||||
use super::RoomSummary;
|
||||
use crate::{rooms::BaseRoomInfo, sync::UnreadNotificationsCount};
|
||||
|
||||
let info = RoomInfo {
|
||||
room_id: room_id!("!gda78o:server.tld").into(),
|
||||
room_state: RoomState::Invited,
|
||||
|
||||
@@ -535,9 +535,10 @@ mod test {
|
||||
};
|
||||
|
||||
use assert_matches::assert_matches;
|
||||
use matrix_sdk_common::ring_buffer::RingBuffer;
|
||||
use matrix_sdk_common::{deserialized_responses::SyncTimelineEvent, ring_buffer::RingBuffer};
|
||||
use matrix_sdk_test::async_test;
|
||||
use ruma::{
|
||||
api::client::sync::sync_events::v4,
|
||||
device_id, event_id,
|
||||
events::{
|
||||
direct::DirectEventContent,
|
||||
@@ -556,8 +557,8 @@ mod test {
|
||||
};
|
||||
use serde_json::json;
|
||||
|
||||
use super::*;
|
||||
use crate::{store::MemoryStore, SessionMeta};
|
||||
use super::cache_latest_events;
|
||||
use crate::{store::MemoryStore, BaseClient, Room, RoomState, SessionMeta};
|
||||
|
||||
#[async_test]
|
||||
async fn can_process_empty_sliding_sync_response() {
|
||||
|
||||
@@ -118,7 +118,7 @@ impl<T> Default for RingBuffer<T> {
|
||||
mod tests {
|
||||
use std::ops::Not;
|
||||
|
||||
use super::*;
|
||||
use super::RingBuffer;
|
||||
|
||||
#[test]
|
||||
pub fn test_fixed_size() {
|
||||
|
||||
@@ -214,8 +214,9 @@ pub enum Error {
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use olm_rs::pk::{OlmPkDecryption, OlmPkEncryption, PkMessage};
|
||||
use vodozemac::Curve25519PublicKey;
|
||||
|
||||
use super::*;
|
||||
use super::{Message, MessageDecodeError, PkDecryption, PkEncryption};
|
||||
use crate::utilities::encode;
|
||||
|
||||
impl TryFrom<PkMessage> for Message {
|
||||
|
||||
@@ -335,10 +335,16 @@ pub enum LockStoreError {
|
||||
mod tests {
|
||||
use assert_matches::assert_matches;
|
||||
use matrix_sdk_test::async_test;
|
||||
use tokio::spawn;
|
||||
use tokio::{
|
||||
spawn,
|
||||
time::{sleep, Duration},
|
||||
};
|
||||
|
||||
use super::*;
|
||||
use crate::store::{IntoCryptoStore as _, MemoryStore};
|
||||
use super::{CryptoStoreLock, CryptoStoreLockGuard, LockStoreError};
|
||||
use crate::{
|
||||
store::{IntoCryptoStore as _, MemoryStore},
|
||||
CryptoStoreError,
|
||||
};
|
||||
|
||||
async fn release_lock(guard: Option<CryptoStoreLockGuard>) {
|
||||
drop(guard);
|
||||
|
||||
@@ -241,7 +241,7 @@ mod test {
|
||||
use assert_matches::assert_matches;
|
||||
use serde_json::{json, Value};
|
||||
|
||||
use super::*;
|
||||
use super::AnyDecryptedOlmEvent;
|
||||
|
||||
const ED25519_KEY: &str = "aOfOnlaeMb5GW1TxkZ8pXnblkGMgAvps+lAukrdYaZk";
|
||||
|
||||
|
||||
@@ -11,9 +11,10 @@ pub fn new_filter() -> impl Fn(&RoomListEntry) -> bool {
|
||||
mod tests {
|
||||
use std::ops::Not;
|
||||
|
||||
use matrix_sdk::RoomListEntry;
|
||||
use ruma::room_id;
|
||||
|
||||
use super::*;
|
||||
use super::new_filter;
|
||||
|
||||
#[test]
|
||||
fn test_all_kind_of_room_list_entry() {
|
||||
|
||||
@@ -49,7 +49,7 @@ pub fn new_filter(client: &Client, pattern: &str) -> impl Fn(&RoomListEntry) ->
|
||||
mod tests {
|
||||
use std::ops::Not;
|
||||
|
||||
use super::*;
|
||||
use super::FuzzyMatcher;
|
||||
|
||||
#[test]
|
||||
fn test_no_pattern() {
|
||||
|
||||
@@ -16,7 +16,7 @@ fn normalize_string(str: &str) -> String {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use super::normalize_string;
|
||||
|
||||
#[test]
|
||||
fn test_normalize_string() {
|
||||
|
||||
@@ -49,7 +49,7 @@ pub fn new_filter(client: &Client, pattern: &str) -> impl Fn(&RoomListEntry) ->
|
||||
mod tests {
|
||||
use std::ops::Not;
|
||||
|
||||
use super::*;
|
||||
use super::NormalizedMatcher;
|
||||
|
||||
#[test]
|
||||
fn test_no_pattern() {
|
||||
|
||||
@@ -447,10 +447,14 @@ pub enum InputResult {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use std::future::ready;
|
||||
|
||||
use futures_util::{pin_mut, StreamExt};
|
||||
use matrix_sdk::{
|
||||
config::RequestConfig,
|
||||
matrix_auth::{Session, SessionTokens},
|
||||
reqwest::Url,
|
||||
Client, SlidingSyncMode,
|
||||
};
|
||||
use matrix_sdk_base::SessionMeta;
|
||||
use matrix_sdk_test::async_test;
|
||||
@@ -458,7 +462,7 @@ mod tests {
|
||||
use serde_json::json;
|
||||
use wiremock::{http::Method, Match, Mock, MockServer, Request, ResponseTemplate};
|
||||
|
||||
use super::*;
|
||||
use super::{Error, RoomListService, State, ALL_ROOMS_LIST_NAME};
|
||||
|
||||
async fn new_client() -> (Client, MockServer) {
|
||||
let session = Session {
|
||||
|
||||
@@ -467,18 +467,24 @@ pub enum EventItemOrigin {
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use assert_matches::assert_matches;
|
||||
use matrix_sdk::{config::RequestConfig, Client, ClientBuilder};
|
||||
use matrix_sdk_base::{BaseClient, SessionMeta};
|
||||
use matrix_sdk::{config::RequestConfig, Client, ClientBuilder, SlidingSyncRoom};
|
||||
use matrix_sdk_base::{deserialized_responses::SyncTimelineEvent, BaseClient, SessionMeta};
|
||||
use matrix_sdk_test::async_test;
|
||||
use ruma::{
|
||||
api::{client::sync::sync_events::v4, MatrixVersion},
|
||||
device_id,
|
||||
events::room::message::MessageFormat,
|
||||
room_id, user_id, RoomId, UInt,
|
||||
events::{
|
||||
room::message::{MessageFormat, MessageType},
|
||||
AnySyncTimelineEvent,
|
||||
},
|
||||
room_id,
|
||||
serde::Raw,
|
||||
user_id, RoomId, UInt, UserId,
|
||||
};
|
||||
use serde_json::json;
|
||||
|
||||
use super::*;
|
||||
use super::{EventTimelineItem, Profile};
|
||||
use crate::timeline::TimelineDetails;
|
||||
|
||||
#[async_test]
|
||||
async fn latest_message_event_can_be_wrapped_as_a_timeline_item() {
|
||||
|
||||
@@ -228,8 +228,12 @@ mod tests {
|
||||
use futures_util::StreamExt;
|
||||
use matrix_sdk_test::async_test;
|
||||
|
||||
use super::*;
|
||||
use crate::{test_utils::logged_in_client, Result};
|
||||
use super::{
|
||||
clean_storage, format_storage_key_for_sliding_sync,
|
||||
format_storage_key_for_sliding_sync_list, format_storage_key_prefix,
|
||||
restore_sliding_sync_state, store_sliding_sync_state,
|
||||
};
|
||||
use crate::{test_utils::logged_in_client, Result, SlidingSyncList};
|
||||
|
||||
#[allow(clippy::await_holding_lock)]
|
||||
#[async_test]
|
||||
@@ -384,6 +388,8 @@ mod tests {
|
||||
#[cfg(feature = "e2e-encryption")]
|
||||
#[async_test]
|
||||
async fn test_sliding_sync_high_level_cache_and_restore() -> Result<()> {
|
||||
use crate::sliding_sync::FrozenSlidingSync;
|
||||
|
||||
let client = logged_in_client(Some("https://foo.bar".to_owned())).await;
|
||||
|
||||
let sync_id = "test-sync-id";
|
||||
|
||||
@@ -5,10 +5,8 @@ use ruma::OwnedRoomId;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use tracing::error;
|
||||
|
||||
use super::{
|
||||
super::{FrozenSlidingSyncRoom, SlidingSyncRoom},
|
||||
RoomListEntry, SlidingSyncList,
|
||||
};
|
||||
use super::{RoomListEntry, SlidingSyncList};
|
||||
use crate::sliding_sync::{FrozenSlidingSyncRoom, SlidingSyncRoom};
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct FrozenSlidingSyncList {
|
||||
@@ -54,6 +52,8 @@ impl FrozenSlidingSyncList {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use std::collections::BTreeMap;
|
||||
|
||||
use imbl::vector;
|
||||
use matrix_sdk_base::deserialized_responses::TimelineEvent;
|
||||
use ruma::{
|
||||
@@ -62,7 +62,8 @@ mod tests {
|
||||
};
|
||||
use serde_json::json;
|
||||
|
||||
use super::*;
|
||||
use super::FrozenSlidingSyncList;
|
||||
use crate::sliding_sync::{list::RoomListEntry, FrozenSlidingSyncRoom};
|
||||
|
||||
#[test]
|
||||
fn test_frozen_sliding_sync_list_serialization() {
|
||||
|
||||
@@ -12,21 +12,19 @@ use std::{
|
||||
sync::{Arc, RwLock as StdRwLock},
|
||||
};
|
||||
|
||||
pub use builder::*;
|
||||
use eyeball::Observable;
|
||||
use eyeball_im::{ObservableVector, VectorDiff};
|
||||
use eyeball_im_util::{FilterVectorSubscriber, VectorExt};
|
||||
pub(super) use frozen::FrozenSlidingSyncList;
|
||||
use futures_core::Stream;
|
||||
use imbl::Vector;
|
||||
pub(super) use request_generator::*;
|
||||
pub use room_list_entry::RoomListEntry;
|
||||
use ruma::{api::client::sync::sync_events::v4, assign, OwnedRoomId, TransactionId};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use tokio::sync::broadcast::Sender;
|
||||
use tracing::{instrument, warn};
|
||||
|
||||
use self::sticky::SlidingSyncListStickyParameters;
|
||||
pub use self::{builder::*, room_list_entry::RoomListEntry};
|
||||
pub(super) use self::{frozen::FrozenSlidingSyncList, request_generator::*};
|
||||
use super::{
|
||||
sticky_parameters::{LazyTransactionId, SlidingSyncStickyManager},
|
||||
Error, SlidingSyncInternalMessage,
|
||||
@@ -891,13 +889,18 @@ impl SlidingSyncMode {
|
||||
mod tests {
|
||||
use std::{
|
||||
cell::Cell,
|
||||
collections::HashSet,
|
||||
sync::{Arc, Mutex},
|
||||
};
|
||||
|
||||
use eyeball_im::{ObservableVector, VectorDiff};
|
||||
use futures_util::StreamExt;
|
||||
use imbl::vector;
|
||||
use matrix_sdk_test::async_test;
|
||||
use ruma::{api::client::sync::sync_events::v4::SlidingOp, room_id, uint};
|
||||
use ruma::{
|
||||
api::client::sync::sync_events::v4::{self, SlidingOp},
|
||||
room_id, uint, OwnedRoomId,
|
||||
};
|
||||
use serde_json::json;
|
||||
use tokio::{
|
||||
spawn,
|
||||
@@ -907,7 +910,11 @@ mod tests {
|
||||
},
|
||||
};
|
||||
|
||||
use super::*;
|
||||
use super::{
|
||||
apply_sync_operations, RoomListEntry, SlidingSyncList, SlidingSyncListLoadingState,
|
||||
SlidingSyncMode,
|
||||
};
|
||||
use crate::sliding_sync::{sticky_parameters::LazyTransactionId, SlidingSyncInternalMessage};
|
||||
|
||||
macro_rules! assert_json_roundtrip {
|
||||
(from $type:ty: $rust_value:expr => $json_value:expr) => {
|
||||
|
||||
@@ -330,7 +330,10 @@ mod tests {
|
||||
|
||||
use assert_matches::assert_matches;
|
||||
|
||||
use super::*;
|
||||
use super::{
|
||||
create_range, SlidingSyncListRequestGenerator, SlidingSyncListRequestGeneratorKind,
|
||||
};
|
||||
use crate::{sliding_sync::Error, SlidingSyncMode};
|
||||
|
||||
#[test]
|
||||
fn test_create_range_from() {
|
||||
|
||||
@@ -56,7 +56,7 @@ mod tests {
|
||||
use ruma::room_id;
|
||||
use serde_json::json;
|
||||
|
||||
use super::*;
|
||||
use super::RoomListEntry;
|
||||
|
||||
macro_rules! assert_json_roundtrip {
|
||||
(from $type:ty: $rust_value:expr => $json_value:expr) => {
|
||||
|
||||
@@ -33,12 +33,8 @@ use std::{
|
||||
};
|
||||
|
||||
use async_stream::stream;
|
||||
pub use builder::*;
|
||||
pub use error::*;
|
||||
use futures_core::stream::Stream;
|
||||
pub use list::*;
|
||||
use matrix_sdk_common::ring_buffer::RingBuffer;
|
||||
pub use room::*;
|
||||
use ruma::{
|
||||
api::client::{
|
||||
error::ErrorKind,
|
||||
@@ -53,15 +49,15 @@ use tokio::{
|
||||
};
|
||||
use tracing::{debug, error, info, instrument, trace, warn, Instrument, Span};
|
||||
use url::Url;
|
||||
use utils::JoinHandleExt as _;
|
||||
|
||||
pub use self::{builder::*, error::*, list::*, room::*};
|
||||
use self::{
|
||||
cache::restore_sliding_sync_state,
|
||||
client::SlidingSyncResponseProcessor,
|
||||
sticky_parameters::{LazyTransactionId, SlidingSyncStickyManager, StickyData},
|
||||
utils::JoinHandleExt as _,
|
||||
};
|
||||
use crate::{
|
||||
config::RequestConfig, sliding_sync::client::SlidingSyncResponseProcessor, Client, Result,
|
||||
};
|
||||
use crate::{config::RequestConfig, Client, Result};
|
||||
|
||||
/// The Sliding Sync instance.
|
||||
///
|
||||
@@ -993,23 +989,37 @@ fn compute_limited(
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use std::{ops::Not, sync::Mutex};
|
||||
use std::{
|
||||
collections::BTreeMap,
|
||||
ops::Not,
|
||||
sync::{Arc, Mutex},
|
||||
};
|
||||
|
||||
use assert_matches::assert_matches;
|
||||
use futures_util::{future::join_all, pin_mut, StreamExt};
|
||||
use matrix_sdk_common::deserialized_responses::SyncTimelineEvent;
|
||||
use matrix_sdk_test::async_test;
|
||||
use ruma::{
|
||||
api::client::sync::sync_events::v4::ToDeviceConfig, owned_room_id, room_id, serde::Raw,
|
||||
uint, DeviceKeyAlgorithm, TransactionId,
|
||||
api::client::{
|
||||
error::ErrorKind,
|
||||
sync::sync_events::v4::{self, ExtensionsConfig, ToDeviceConfig},
|
||||
},
|
||||
assign, owned_room_id, room_id,
|
||||
serde::Raw,
|
||||
uint, DeviceKeyAlgorithm, OwnedRoomId, TransactionId,
|
||||
};
|
||||
use serde::Deserialize;
|
||||
use serde_json::json;
|
||||
use url::Url;
|
||||
use wiremock::{http::Method, Match, Mock, MockServer, Request, ResponseTemplate};
|
||||
|
||||
use super::*;
|
||||
use crate::{
|
||||
sliding_sync::sticky_parameters::SlidingSyncStickyManager, test_utils::logged_in_client,
|
||||
use super::{
|
||||
compute_limited,
|
||||
sticky_parameters::{LazyTransactionId, SlidingSyncStickyManager},
|
||||
FrozenSlidingSync, SlidingSync, SlidingSyncList, SlidingSyncListBuilder, SlidingSyncMode,
|
||||
SlidingSyncRoom, SlidingSyncStickyParameters,
|
||||
};
|
||||
use crate::{test_utils::logged_in_client, Result};
|
||||
|
||||
#[derive(Copy, Clone)]
|
||||
struct SlidingSyncMatcher;
|
||||
|
||||
@@ -317,16 +317,20 @@ impl From<&SlidingSyncRoom> for FrozenSlidingSyncRoom {
|
||||
mod tests {
|
||||
use imbl::vector;
|
||||
use matrix_sdk_base::deserialized_responses::TimelineEvent;
|
||||
use matrix_sdk_common::deserialized_responses::SyncTimelineEvent;
|
||||
use matrix_sdk_test::async_test;
|
||||
use ruma::{
|
||||
api::client::sync::sync_events::v4, assign, events::room::message::RoomMessageEventContent,
|
||||
mxc_uri, room_id, uint, RoomId,
|
||||
mxc_uri, room_id, serde::Raw, uint, RoomId,
|
||||
};
|
||||
use serde_json::json;
|
||||
use wiremock::MockServer;
|
||||
|
||||
use super::*;
|
||||
use crate::test_utils::logged_in_client;
|
||||
use super::NUMBER_OF_TIMELINE_EVENTS_TO_KEEP_FOR_THE_CACHE;
|
||||
use crate::{
|
||||
sliding_sync::{FrozenSlidingSyncRoom, SlidingSyncRoom, SlidingSyncRoomState},
|
||||
test_utils::logged_in_client,
|
||||
};
|
||||
|
||||
macro_rules! room_response {
|
||||
( $( $json:tt )+ ) => {
|
||||
|
||||
@@ -133,7 +133,7 @@ impl<D: StickyData> SlidingSyncStickyManager<D> {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use super::{LazyTransactionId, SlidingSyncStickyManager, StickyData};
|
||||
|
||||
struct EmptyStickyData;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user