Skip to content

Commit ea076b3

Browse files
jplatteHywan
authored andcommitted
chore: Upgrade testing crates to Rust Edition 2024
1 parent 8aa6f97 commit ea076b3

36 files changed

+163
-148
lines changed

testing/matrix-sdk-integration-testing/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name = "matrix-sdk-integration-testing"
33
description = "Internal integration testing for matrix-sdk crate"
44
version = "0.1.0"
5-
edition = "2021"
5+
edition = "2024"
66
publish = false
77
license = "Apache-2.0"
88

testing/matrix-sdk-integration-testing/src/helpers.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,21 +10,21 @@ use std::{
1010
use anyhow::Result;
1111
use assign::assign;
1212
use matrix_sdk::{
13+
Client, ClientBuilder, Room,
1314
config::{RequestConfig, SyncSettings},
1415
encryption::EncryptionSettings,
1516
ruma::{
17+
RoomId,
1618
api::client::{account::register::v3::Request as RegistrationRequest, uiaa},
1719
time::Instant,
18-
RoomId,
1920
},
2021
sliding_sync::VersionBuilder,
2122
sync::SyncResponse,
2223
timeout::ElapsedError,
23-
Client, ClientBuilder, Room,
2424
};
2525
use once_cell::sync::Lazy;
2626
use rand::Rng as _;
27-
use tempfile::{tempdir, TempDir};
27+
use tempfile::{TempDir, tempdir};
2828
use tokio::{sync::Mutex, time::sleep};
2929

3030
/// This global maintains temp directories alive for the whole lifetime of the
@@ -47,7 +47,7 @@ pub struct TestClientBuilder {
4747

4848
impl TestClientBuilder {
4949
pub fn new(username: impl AsRef<str>) -> Self {
50-
let suffix: u128 = rand::thread_rng().gen();
50+
let suffix: u128 = rand::thread_rng().r#gen();
5151
let randomized_username = format!("{}{}", username.as_ref(), suffix);
5252
Self::with_exact_username(randomized_username)
5353
}

testing/matrix-sdk-integration-testing/src/tests/e2ee/mod.rs

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,31 +8,30 @@ use assert_matches::assert_matches;
88
use assert_matches2::assert_let;
99
use assign::assign;
1010
use matrix_sdk::{
11-
assert_next_eq_with_timeout,
12-
crypto::{format_emojis, SasState},
11+
Client, assert_next_eq_with_timeout,
12+
crypto::{SasState, format_emojis},
1313
encryption::{
14+
BackupDownloadStrategy, EncryptionSettings, LocalTrust,
1415
backups::BackupState,
1516
recovery::{Recovery, RecoveryState},
1617
verification::{
1718
QrVerificationData, QrVerificationState, Verification, VerificationRequestState,
1819
},
19-
BackupDownloadStrategy, EncryptionSettings, LocalTrust,
2020
},
2121
ruma::{
22+
OwnedEventId,
2223
api::client::room::create_room::v3::Request as CreateRoomRequest,
2324
events::{
24-
key::verification::{request::ToDeviceKeyVerificationRequestEvent, VerificationMethod},
25+
GlobalAccountDataEventType, OriginalSyncMessageLikeEvent,
26+
key::verification::{VerificationMethod, request::ToDeviceKeyVerificationRequestEvent},
2527
room::message::{
2628
MessageType, OriginalSyncRoomMessageEvent, RoomMessageEventContent,
2729
SyncRoomMessageEvent,
2830
},
2931
secret_storage::secret::SecretEventContent,
30-
GlobalAccountDataEventType, OriginalSyncMessageLikeEvent,
3132
},
32-
OwnedEventId,
3333
},
3434
timeout::timeout,
35-
Client,
3635
};
3736
use matrix_sdk_ui::{
3837
notification_client::{NotificationClient, NotificationProcessSetup},
@@ -51,8 +50,8 @@ mod shared_history;
5150
// processed twice, meaning incorrect verification states will be found and the
5251
// process will fail, especially with user verification.
5352
#[tokio::test(flavor = "multi_thread", worker_threads = 4)]
54-
async fn test_mutual_sas_verification_with_notification_client_ignores_verification_events(
55-
) -> Result<()> {
53+
async fn test_mutual_sas_verification_with_notification_client_ignores_verification_events()
54+
-> Result<()> {
5655
let encryption_settings =
5756
EncryptionSettings { auto_enable_cross_signing: true, ..Default::default() };
5857
let alice = TestClientBuilder::new("alice")

testing/matrix-sdk-integration-testing/src/tests/e2ee/shared_history.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use std::ops::Deref;
33
use anyhow::Result;
44
use assert_matches2::assert_let;
55
use assign::assign;
6-
use futures::{pin_mut, FutureExt, StreamExt};
6+
use futures::{FutureExt, StreamExt, pin_mut};
77
use matrix_sdk::{
88
assert_decrypted_message_eq,
99
encryption::EncryptionSettings,
@@ -15,7 +15,7 @@ use matrix_sdk::{
1515
use matrix_sdk_common::deserialized_responses::ProcessedToDeviceEvent;
1616
use matrix_sdk_ui::sync_service::SyncService;
1717
use similar_asserts::assert_eq;
18-
use tracing::{info, Instrument};
18+
use tracing::{Instrument, info};
1919

2020
use crate::helpers::{SyncTokenAwareClient, TestClientBuilder};
2121

testing/matrix-sdk-integration-testing/src/tests/invitations.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
use anyhow::{ensure, Result};
1+
use anyhow::{Result, ensure};
22
use assign::assign;
33
use matrix_sdk::{
4-
ruma::api::client::room::create_room::v3::Request as CreateRoomRequest, RoomState,
4+
RoomState, ruma::api::client::room::create_room::v3::Request as CreateRoomRequest,
55
};
66

77
use crate::helpers::TestClientBuilder;

testing/matrix-sdk-integration-testing/src/tests/nse.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,22 @@ use anyhow::Result;
88
use assign::assign;
99
use futures::Future;
1010
use matrix_sdk::{
11+
Client, Room,
1112
encryption::EncryptionSettings,
1213
ruma::{
14+
EventEncryptionAlgorithm, OwnedEventId, OwnedRoomId, RoomId,
1315
api::client::room::create_room::v3::Request as CreateRoomRequest,
1416
events::{
17+
AnyMessageLikeEventContent, AnySyncTimelineEvent, OriginalSyncMessageLikeEvent,
1518
room::{
1619
encrypted::{OriginalSyncRoomEncryptedEvent, RoomEncryptedEventContent},
1720
encryption::RoomEncryptionEventContent,
1821
message::{MessageType, OriginalSyncRoomMessageEvent, RoomMessageEventContent},
1922
},
2023
room_key::ToDeviceRoomKeyEvent,
21-
AnyMessageLikeEventContent, AnySyncTimelineEvent, OriginalSyncMessageLikeEvent,
2224
},
2325
serde::Raw,
24-
EventEncryptionAlgorithm, OwnedEventId, OwnedRoomId, RoomId,
2526
},
26-
Client, Room,
2727
};
2828
use matrix_sdk_ui::{
2929
notification_client::{
@@ -33,7 +33,7 @@ use matrix_sdk_ui::{
3333
};
3434
use serde_json::json;
3535
use tempfile::tempdir;
36-
use tracing::{info, instrument, span, Level};
36+
use tracing::{Level, info, instrument, span};
3737

3838
use crate::helpers::{SyncTokenAwareClient, TestClientBuilder};
3939

testing/matrix-sdk-integration-testing/src/tests/redaction.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@ use anyhow::Result;
22
use assert_matches::assert_matches;
33
use assign::assign;
44
use matrix_sdk::{
5+
Client,
56
config::SyncSettings,
67
ruma::{
78
api::client::room::create_room::v3::Request as CreateRoomRequest,
89
events::{
9-
room::name::{RoomNameEventContent, SyncRoomNameEvent},
1010
AnySyncStateEvent, StateEventType,
11+
room::name::{RoomNameEventContent, SyncRoomNameEvent},
1112
},
1213
},
13-
Client,
1414
};
1515

1616
use crate::helpers::TestClientBuilder;

testing/matrix-sdk-integration-testing/src/tests/repeated_join.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@ use std::{sync::Arc, time::Duration};
33
use anyhow::Result;
44
use assign::assign;
55
use matrix_sdk::{
6+
Client, Room, RoomMemberships, RoomState, StateStoreExt,
67
event_handler::Ctx,
78
ruma::{
89
api::client::room::create_room::v3::Request as CreateRoomRequest,
910
events::room::member::{MembershipState, StrippedRoomMemberEvent},
1011
},
11-
Client, Room, RoomMemberships, RoomState, StateStoreExt,
1212
};
1313
use matrix_sdk_common::executor::spawn;
1414
use tokio::sync::Notify;

testing/matrix-sdk-integration-testing/src/tests/room.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,24 @@ use std::time::Duration;
33
use anyhow::Result;
44
use assert_matches2::{assert_let, assert_matches};
55
use matrix_sdk::{
6+
RoomState,
67
room::MessagesOptions,
78
ruma::{
89
api::client::room::create_room::v3::Request as CreateRoomRequest,
910
assign, event_id, events,
1011
events::{
11-
room::message::RoomMessageEventContent, AnyRoomAccountDataEventContent,
12-
AnySyncStateEvent, AnySyncTimelineEvent, EventContent,
12+
AnyRoomAccountDataEventContent, AnySyncStateEvent, AnySyncTimelineEvent, EventContent,
13+
room::message::RoomMessageEventContent,
1314
},
1415
serde::Raw,
1516
uint,
1617
},
1718
test_utils::assert_event_matches_msg,
18-
RoomState,
1919
};
2020
use tokio::{spawn, time::sleep};
2121
use tracing::error;
2222

23-
use crate::helpers::{wait_for_room, TestClientBuilder};
23+
use crate::helpers::{TestClientBuilder, wait_for_room};
2424

2525
#[tokio::test]
2626
async fn test_event_with_context() -> Result<()> {

testing/matrix-sdk-integration-testing/src/tests/room_directory_search.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ use eyeball_im::VectorDiff;
2121
use futures::StreamExt;
2222
use matrix_sdk::{
2323
room_directory_search::RoomDirectorySearch,
24-
ruma::api::client::room::{create_room::v3::Request as CreateRoomRequest, Visibility},
24+
ruma::api::client::room::{Visibility, create_room::v3::Request as CreateRoomRequest},
2525
};
26-
use rand::{thread_rng, Rng};
26+
use rand::{Rng, thread_rng};
2727
use stream_assert::assert_pending;
2828
use tokio::time::sleep;
2929
use tracing::warn;

0 commit comments

Comments
 (0)