Skip to content

Commit 4705389

Browse files
jplattepoljar
authored andcommitted
refactor: Use native async fn in traits for testing traits
1 parent db931c5 commit 4705389

File tree

3 files changed

+3
-15
lines changed

3 files changed

+3
-15
lines changed

crates/matrix-sdk-base/src/event_cache/store/integration_tests.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
//! Trait and macro of integration tests for `EventCacheStore` implementations.
1616
1717
use assert_matches::assert_matches;
18-
use async_trait::async_trait;
1918
use matrix_sdk_common::{
2019
deserialized_responses::{
2120
AlgorithmInfo, DecryptedRoomEvent, EncryptionInfo, TimelineEvent, TimelineEventKind,
@@ -114,8 +113,7 @@ pub fn check_test_event(event: &TimelineEvent, text: &str) {
114113
///
115114
/// This trait is not meant to be used directly, but will be used with the
116115
/// `event_cache_store_integration_tests!` macro.
117-
#[cfg_attr(target_arch = "wasm32", async_trait(?Send))]
118-
#[cfg_attr(not(target_arch = "wasm32"), async_trait)]
116+
#[allow(async_fn_in_trait)]
119117
pub trait EventCacheStoreIntegrationTests {
120118
/// Test media content storage.
121119
async fn test_media_content(&self);
@@ -154,8 +152,6 @@ pub trait EventCacheStoreIntegrationTests {
154152
async fn test_save_event(&self);
155153
}
156154

157-
#[cfg_attr(target_arch = "wasm32", async_trait(?Send))]
158-
#[cfg_attr(not(target_arch = "wasm32"), async_trait)]
159155
impl EventCacheStoreIntegrationTests for DynEventCacheStore {
160156
async fn test_media_content(&self) {
161157
let uri = mxc_uri!("mxc://localhost/media");

crates/matrix-sdk-base/src/event_cache/store/media/integration_tests.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
//! Trait and macro of integration tests for `EventCacheStoreMedia`
1616
//! implementations.
1717
18-
use async_trait::async_trait;
1918
use ruma::{
2019
events::room::MediaSource,
2120
mxc_uri, owned_mxc_uri,
@@ -31,8 +30,7 @@ use crate::media::{MediaFormat, MediaRequestParameters};
3130
///
3231
/// This trait is not meant to be used directly, but will be used with the
3332
/// `event_cache_store_media_integration_tests!` macro.
34-
#[cfg_attr(target_arch = "wasm32", async_trait(?Send))]
35-
#[cfg_attr(not(target_arch = "wasm32"), async_trait)]
33+
#[allow(async_fn_in_trait)]
3634
pub trait EventCacheStoreMediaIntegrationTests {
3735
/// Test media retention policy storage.
3836
async fn test_store_media_retention_policy(&self);
@@ -58,8 +56,6 @@ pub trait EventCacheStoreMediaIntegrationTests {
5856
async fn test_store_last_media_cleanup_time(&self);
5957
}
6058

61-
#[cfg_attr(target_arch = "wasm32", async_trait(?Send))]
62-
#[cfg_attr(not(target_arch = "wasm32"), async_trait)]
6359
impl<Store> EventCacheStoreMediaIntegrationTests for Store
6460
where
6561
Store: EventCacheStoreMedia + std::fmt::Debug,

crates/matrix-sdk-base/src/store/integration_tests.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ use std::collections::{BTreeMap, BTreeSet, HashMap};
44

55
use assert_matches::assert_matches;
66
use assert_matches2::assert_let;
7-
use async_trait::async_trait;
87
use growable_bloom_filter::GrowableBloomBuilder;
98
use matrix_sdk_test::{event_factory::EventFactory, test_json};
109
use ruma::{
@@ -47,8 +46,7 @@ use crate::{
4746
///
4847
/// This trait is not meant to be used directly, but will be used with the
4948
/// `statestore_integration_tests!` macro.
50-
#[cfg_attr(target_arch = "wasm32", async_trait(?Send))]
51-
#[cfg_attr(not(target_arch = "wasm32"), async_trait)]
49+
#[allow(async_fn_in_trait)]
5250
pub trait StateStoreIntegrationTests {
5351
/// Populate the given `StateStore`.
5452
async fn populate(&self) -> Result<()>;
@@ -98,8 +96,6 @@ pub trait StateStoreIntegrationTests {
9896
async fn test_get_room_infos(&self);
9997
}
10098

101-
#[cfg_attr(target_arch = "wasm32", async_trait(?Send))]
102-
#[cfg_attr(not(target_arch = "wasm32"), async_trait)]
10399
impl StateStoreIntegrationTests for DynStateStore {
104100
async fn populate(&self) -> Result<()> {
105101
let mut changes = StateChanges::default();

0 commit comments

Comments
 (0)