From 59b1fa00df0ff960e67c8d4b3d813857da29b68f Mon Sep 17 00:00:00 2001 From: Jonas Platte Date: Wed, 17 May 2023 13:19:35 +0200 Subject: [PATCH] Replace futures dependencies with futures-* dependencies --- Cargo.lock | 12 ++++++------ Cargo.toml | 1 + crates/matrix-sdk-base/Cargo.toml | 2 +- crates/matrix-sdk-crypto/Cargo.toml | 4 ++-- crates/matrix-sdk-crypto/src/machine.rs | 6 ++---- .../matrix-sdk-crypto/src/verification/sas/mod.rs | 2 +- crates/matrix-sdk/Cargo.toml | 2 +- crates/matrix-sdk/src/client/mod.rs | 14 +++++--------- .../matrix-sdk/src/encryption/verification/sas.rs | 2 +- crates/matrix-sdk/src/sliding_sync/README.md | 6 +++--- crates/matrix-sdk/src/sliding_sync/cache.rs | 2 +- crates/matrix-sdk/src/sliding_sync/list/mod.rs | 2 +- crates/matrix-sdk/src/sliding_sync/mod.rs | 2 +- .../matrix-sdk/tests/integration/refresh_token.rs | 2 +- crates/matrix-sdk/tests/integration/room/joined.rs | 2 +- examples/emoji_verification/Cargo.toml | 2 +- examples/emoji_verification/src/main.rs | 2 +- examples/timeline/Cargo.toml | 2 +- examples/timeline/src/main.rs | 2 +- testing/sliding-sync-integration-test/Cargo.toml | 2 +- testing/sliding-sync-integration-test/src/lib.rs | 2 +- 21 files changed, 34 insertions(+), 39 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 0fff09997..ad6910dce 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1473,7 +1473,7 @@ version = "0.1.0" dependencies = [ "anyhow", "clap 4.2.4", - "futures", + "futures-util", "matrix-sdk", "tokio", "tracing-subscriber", @@ -1544,7 +1544,7 @@ version = "0.1.0" dependencies = [ "anyhow", "clap 4.2.4", - "futures", + "futures-util", "matrix-sdk", "matrix-sdk-ui", "tokio", @@ -2623,8 +2623,8 @@ dependencies = [ "eyeball", "eyeball-im", "eyre", - "futures", "futures-core", + "futures-executor", "futures-util", "getrandom 0.2.9", "gloo-timers", @@ -2693,7 +2693,7 @@ dependencies = [ "ctor 0.2.0", "dashmap", "eyeball", - "futures", + "futures-executor", "futures-util", "http", "matrix-sdk-common", @@ -2746,8 +2746,8 @@ dependencies = [ "ctr", "dashmap", "eyeball", - "futures", "futures-core", + "futures-executor", "futures-util", "hmac", "http", @@ -4859,7 +4859,7 @@ dependencies = [ "assert_matches", "eyeball", "eyeball-im", - "futures", + "futures-util", "matrix-sdk", "matrix-sdk-integration-testing", "tokio", diff --git a/Cargo.toml b/Cargo.toml index 18d43dfe5..f65b84509 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -30,6 +30,7 @@ ctor = "0.2.0" dashmap = "5.2.0" eyeball = "0.6.0" eyeball-im = "0.2.0" +futures-executor = "0.3.21" futures-util = { version = "0.3.26", default-features = false, features = ["alloc"] } http = "0.2.6" ruma = { git = "https://github.com/ruma/ruma", rev = "54a4223caa1c1052464ecdba0f1e08f126e07bcd", features = ["client-api-c", "compat-user-id"] } diff --git a/crates/matrix-sdk-base/Cargo.toml b/crates/matrix-sdk-base/Cargo.toml index 90fccb8d8..12c569178 100644 --- a/crates/matrix-sdk-base/Cargo.toml +++ b/crates/matrix-sdk-base/Cargo.toml @@ -50,7 +50,7 @@ tracing = { workspace = true } assert_matches = { workspace = true } assign = "1.1.1" ctor = { workspace = true } -futures = { version = "0.3.21", default-features = false, features = ["executor"] } +futures-executor = { workspace = true } http = { workspace = true } matrix-sdk-test = { version = "0.6.0", path = "../../testing/matrix-sdk-test" } tracing-subscriber = { version = "0.3.11", features = ["env-filter"] } diff --git a/crates/matrix-sdk-crypto/Cargo.toml b/crates/matrix-sdk-crypto/Cargo.toml index f9a01656e..5e78f57ea 100644 --- a/crates/matrix-sdk-crypto/Cargo.toml +++ b/crates/matrix-sdk-crypto/Cargo.toml @@ -68,8 +68,8 @@ tokio = { workspace = true, features = ["time"] } [dev-dependencies] anyhow = { workspace = true } assert_matches = { workspace = true } -ctor.workspace = true -futures = { version = "0.3.21", features = ["executor"] } +ctor = { workspace = true } +futures-executor = { workspace = true } http = { workspace = true } indoc = "1.0.4" matrix-sdk-test = { version = "0.6.0", path = "../../testing/matrix-sdk-test" } diff --git a/crates/matrix-sdk-crypto/src/machine.rs b/crates/matrix-sdk-crypto/src/machine.rs index 3c2a36eb3..58fea4c25 100644 --- a/crates/matrix-sdk-crypto/src/machine.rs +++ b/crates/matrix-sdk-crypto/src/machine.rs @@ -1416,9 +1416,8 @@ impl OlmMachine { /// ``` /// # use matrix_sdk_crypto::OlmMachine; /// # use ruma::{device_id, user_id}; - /// # use futures::executor::block_on; /// # let alice = user_id!("@alice:example.org").to_owned(); - /// # block_on(async { + /// # futures_executor::block_on(async { /// # let machine = OlmMachine::new(&alice, device_id!("DEVICEID")).await; /// let device = machine.get_device(&alice, device_id!("DEVICEID"), None).await; /// @@ -1473,9 +1472,8 @@ impl OlmMachine { /// ``` /// # use matrix_sdk_crypto::OlmMachine; /// # use ruma::{device_id, user_id}; - /// # use futures::executor::block_on; /// # let alice = user_id!("@alice:example.org").to_owned(); - /// # block_on(async { + /// # futures_executor::block_on(async { /// # let machine = OlmMachine::new(&alice, device_id!("DEVICEID")).await; /// let devices = machine.get_user_devices(&alice, None).await.unwrap(); /// diff --git a/crates/matrix-sdk-crypto/src/verification/sas/mod.rs b/crates/matrix-sdk-crypto/src/verification/sas/mod.rs index e1193a514..0f52b5886 100644 --- a/crates/matrix-sdk-crypto/src/verification/sas/mod.rs +++ b/crates/matrix-sdk-crypto/src/verification/sas/mod.rs @@ -691,7 +691,7 @@ impl Sas { /// # Examples /// /// ```no_run - /// use futures::stream::{Stream, StreamExt}; + /// use futures_util::{Stream, StreamExt}; /// use matrix_sdk_crypto::{Sas, SasState}; /// /// # async { diff --git a/crates/matrix-sdk/Cargo.toml b/crates/matrix-sdk/Cargo.toml index 926b3e22c..62ad016ae 100644 --- a/crates/matrix-sdk/Cargo.toml +++ b/crates/matrix-sdk/Cargo.toml @@ -125,7 +125,7 @@ tokio = { workspace = true, features = ["fs", "rt", "macros"] } anyhow = { workspace = true } assert_matches = { workspace = true } dirs = "4.0.0" -futures = { version = "0.3.21", default-features = false, features = ["executor"] } +futures-executor = { workspace = true } matrix-sdk-test = { version = "0.6.0", path = "../../testing/matrix-sdk-test" } tracing-subscriber = { version = "0.3.11", features = ["env-filter"] } diff --git a/crates/matrix-sdk/src/client/mod.rs b/crates/matrix-sdk/src/client/mod.rs index 69d9ad61f..d06348f46 100644 --- a/crates/matrix-sdk/src/client/mod.rs +++ b/crates/matrix-sdk/src/client/mod.rs @@ -581,7 +581,6 @@ impl Client { /// # Examples /// /// ``` - /// # use futures::executor::block_on; /// # use url::Url; /// # let homeserver = Url::parse("http://localhost:8080").unwrap(); /// use matrix_sdk::{ @@ -601,7 +600,7 @@ impl Client { /// }; /// use serde::{Deserialize, Serialize}; /// - /// # block_on(async { + /// # futures_executor::block_on(async { /// # let client = matrix_sdk::Client::builder() /// # .homeserver_url(homeserver) /// # .server_versions([ruma::api::MatrixVersion::V1_0]) @@ -738,7 +737,6 @@ impl Client { /// # Examples /// /// ``` - /// # use futures::executor::block_on; /// # use url::Url; /// # use tokio::sync::mpsc; /// # @@ -749,7 +747,7 @@ impl Client { /// ruma::events::room::member::SyncRoomMemberEvent, Client, /// }; /// # - /// # block_on(async { + /// # futures_executor::block_on(async { /// # let client = matrix_sdk::Client::builder() /// # .homeserver_url(homeserver) /// # .server_versions([ruma::api::MatrixVersion::V1_0]) @@ -791,7 +789,6 @@ impl Client { /// # Examples /// /// ``` - /// # use futures::executor::block_on; /// use matrix_sdk::{ /// event_handler::Ctx, room::Room, /// ruma::events::room::message::SyncRoomMessageEvent, @@ -800,7 +797,7 @@ impl Client { /// # struct SomeType; /// # fn obtain_gui_handle() -> SomeType { SomeType } /// # let homeserver = url::Url::parse("http://localhost:8080").unwrap(); - /// # block_on(async { + /// # futures_executor::block_on(async { /// # let client = matrix_sdk::Client::builder() /// # .homeserver_url(homeserver) /// # .server_versions([ruma::api::MatrixVersion::V1_0]) @@ -1019,10 +1016,9 @@ impl Client { /// # Examples /// /// ```no_run - /// # use futures::executor::block_on; /// # use url::Url; /// # let homeserver = Url::parse("http://example.com").unwrap(); - /// # block_on(async { + /// # futures_executor::block_on(async { /// use matrix_sdk::Client; /// /// let client = Client::new(homeserver).await?; @@ -2421,7 +2417,7 @@ impl Client { /// # let homeserver = Url::parse("http://localhost:8080")?; /// # let username = ""; /// # let password = ""; - /// use futures::StreamExt; + /// use futures_util::StreamExt; /// use matrix_sdk::{config::SyncSettings, Client}; /// /// let client = Client::new(homeserver).await?; diff --git a/crates/matrix-sdk/src/encryption/verification/sas.rs b/crates/matrix-sdk/src/encryption/verification/sas.rs index be66a6f93..dc6f8cf80 100644 --- a/crates/matrix-sdk/src/encryption/verification/sas.rs +++ b/crates/matrix-sdk/src/encryption/verification/sas.rs @@ -264,7 +264,7 @@ impl SasVerification { /// # Examples /// /// ```no_run - /// use futures::stream::{Stream, StreamExt}; + /// use futures_util::{Stream, StreamExt}; /// use matrix_sdk::encryption::verification::{SasState, SasVerification}; /// /// # async { diff --git a/crates/matrix-sdk/src/sliding_sync/README.md b/crates/matrix-sdk/src/sliding_sync/README.md index 198c4b64b..534a5d614 100644 --- a/crates/matrix-sdk/src/sliding_sync/README.md +++ b/crates/matrix-sdk/src/sliding_sync/README.md @@ -256,7 +256,7 @@ sure to look at both for all subscribed objects. In full, this typically looks like this: ```rust,no_run -# use futures::{pin_mut, StreamExt}; +# use futures_util::{pin_mut, StreamExt}; # use matrix_sdk::{ # sliding_sync::{SlidingSyncMode, SlidingSyncListBuilder}, # Client, @@ -403,9 +403,9 @@ start up and retrieve only the data needed to actually run. ```rust,no_run use matrix_sdk::{Client, sliding_sync::{SlidingSyncList, SlidingSyncMode}}; -use ruma::{assign, {api::client::sync::sync_events::v4, events::StateEventType}}; +use ruma::{assign, api::client::sync::sync_events::v4, events::StateEventType}; use tracing::{warn, error, info, debug}; -use futures::{StreamExt, pin_mut}; +use futures_util::{pin_mut, StreamExt}; use url::Url; # async { # let homeserver = Url::parse("http://example.com")?; diff --git a/crates/matrix-sdk/src/sliding_sync/cache.rs b/crates/matrix-sdk/src/sliding_sync/cache.rs index b5cf5fbbe..c971930c1 100644 --- a/crates/matrix-sdk/src/sliding_sync/cache.rs +++ b/crates/matrix-sdk/src/sliding_sync/cache.rs @@ -204,7 +204,7 @@ pub(super) async fn restore_sliding_sync_state( mod tests { use std::sync::{Arc, RwLock}; - use futures::executor::block_on; + use futures_executor::block_on; use futures_util::StreamExt; use url::Url; diff --git a/crates/matrix-sdk/src/sliding_sync/list/mod.rs b/crates/matrix-sdk/src/sliding_sync/list/mod.rs index e6a922613..6fe25215f 100644 --- a/crates/matrix-sdk/src/sliding_sync/list/mod.rs +++ b/crates/matrix-sdk/src/sliding_sync/list/mod.rs @@ -940,7 +940,7 @@ mod tests { sync::{Arc, Mutex}, }; - use futures::StreamExt; + use futures_util::StreamExt; use imbl::vector; use ruma::{api::client::sync::sync_events::v4::SlidingOp, room_id, uint}; use serde_json::json; diff --git a/crates/matrix-sdk/src/sliding_sync/mod.rs b/crates/matrix-sdk/src/sliding_sync/mod.rs index 0f92f5acb..8c7536eed 100644 --- a/crates/matrix-sdk/src/sliding_sync/mod.rs +++ b/crates/matrix-sdk/src/sliding_sync/mod.rs @@ -747,7 +747,7 @@ pub struct UpdateSummary { #[cfg(test)] mod test { use assert_matches::assert_matches; - use futures::pin_mut; + use futures_util::pin_mut; use ruma::{ api::client::sync::sync_events::v4::{E2EEConfig, ToDeviceConfig}, room_id, diff --git a/crates/matrix-sdk/tests/integration/refresh_token.rs b/crates/matrix-sdk/tests/integration/refresh_token.rs index cf1b33de0..f2718694b 100644 --- a/crates/matrix-sdk/tests/integration/refresh_token.rs +++ b/crates/matrix-sdk/tests/integration/refresh_token.rs @@ -1,7 +1,7 @@ use std::time::Duration; use assert_matches::assert_matches; -use futures::StreamExt; +use futures_util::StreamExt; use matrix_sdk::{config::RequestConfig, executor::spawn, HttpError, RefreshTokenError, Session}; use matrix_sdk_test::{async_test, test_json}; use ruma::{ diff --git a/crates/matrix-sdk/tests/integration/room/joined.rs b/crates/matrix-sdk/tests/integration/room/joined.rs index adcb62049..9086d2586 100644 --- a/crates/matrix-sdk/tests/integration/room/joined.rs +++ b/crates/matrix-sdk/tests/integration/room/joined.rs @@ -1,6 +1,6 @@ use std::time::Duration; -use futures::future::join_all; +use futures_util::future::join_all; use matrix_sdk::{ attachment::{ AttachmentConfig, AttachmentInfo, BaseImageInfo, BaseThumbnailInfo, BaseVideoInfo, diff --git a/examples/emoji_verification/Cargo.toml b/examples/emoji_verification/Cargo.toml index 6203b4ad8..c26f746e0 100644 --- a/examples/emoji_verification/Cargo.toml +++ b/examples/emoji_verification/Cargo.toml @@ -12,7 +12,7 @@ test = false anyhow = "1" tokio = { version = "1.24.2", features = ["macros", "rt-multi-thread"] } clap = { version = "4.0.15", features = ["derive"] } -futures = "0.3.24" +futures-util = "0.3.24" tracing-subscriber = "0.3.16" url = "2.3.1" diff --git a/examples/emoji_verification/src/main.rs b/examples/emoji_verification/src/main.rs index 7e8a8d644..708caf4dd 100644 --- a/examples/emoji_verification/src/main.rs +++ b/examples/emoji_verification/src/main.rs @@ -2,7 +2,7 @@ use std::io::Write; use anyhow::Result; use clap::Parser; -use futures::stream::StreamExt; +use futures_util::stream::StreamExt; use matrix_sdk::{ config::SyncSettings, encryption::verification::{format_emojis, Emoji, SasState, SasVerification, Verification}, diff --git a/examples/timeline/Cargo.toml b/examples/timeline/Cargo.toml index b9c0e1520..1f5335f57 100644 --- a/examples/timeline/Cargo.toml +++ b/examples/timeline/Cargo.toml @@ -11,7 +11,7 @@ test = false [dependencies] anyhow = "1" clap = "4.0.16" -futures = "0.3" +futures-util = "0.3" tokio = { version = "1.24.2", features = ["macros", "rt-multi-thread"] } tracing-subscriber = "0.3.15" url = "2.2.2" diff --git a/examples/timeline/src/main.rs b/examples/timeline/src/main.rs index 74a110dc3..7b5d9f4f3 100644 --- a/examples/timeline/src/main.rs +++ b/examples/timeline/src/main.rs @@ -1,6 +1,6 @@ use anyhow::Result; use clap::Parser; -use futures::StreamExt; +use futures_util::StreamExt; use matrix_sdk::{self, config::SyncSettings, ruma::OwnedRoomId, Client}; use matrix_sdk_ui::timeline::RoomExt; use url::Url; diff --git a/testing/sliding-sync-integration-test/Cargo.toml b/testing/sliding-sync-integration-test/Cargo.toml index df656c50e..1445d1bb5 100644 --- a/testing/sliding-sync-integration-test/Cargo.toml +++ b/testing/sliding-sync-integration-test/Cargo.toml @@ -9,7 +9,7 @@ anyhow = { workspace = true } assert_matches = { workspace = true } eyeball = { workspace = true } eyeball-im = { workspace = true } -futures = { version = "0.3.25" } +futures-util = { workspace = true } matrix-sdk-integration-testing = { path = "../matrix-sdk-integration-testing", features = ["helpers"] } matrix-sdk = { path = "../../crates/matrix-sdk", features = ["experimental-sliding-sync", "testing"] } tokio = { workspace = true, features = ["rt", "rt-multi-thread", "macros"] } diff --git a/testing/sliding-sync-integration-test/src/lib.rs b/testing/sliding-sync-integration-test/src/lib.rs index d002e01db..0bde59c22 100644 --- a/testing/sliding-sync-integration-test/src/lib.rs +++ b/testing/sliding-sync-integration-test/src/lib.rs @@ -1,7 +1,7 @@ #![cfg(test)] use anyhow::Context; -use futures::{pin_mut, stream::StreamExt}; +use futures_util::{pin_mut, stream::StreamExt}; use matrix_sdk::{Client, RoomListEntry, SlidingSyncBuilder, SlidingSyncList, SlidingSyncMode}; use matrix_sdk_integration_testing::helpers::get_client_for_user;