From 1c07957c4e77422a472dea3538e66499dc37ab9f Mon Sep 17 00:00:00 2001 From: Radical Date: Sun, 20 Jul 2025 18:45:50 +0200 Subject: [PATCH] refactor: small dependency optimizations --- Cargo.toml | 6 +----- src/api/v1/channels/uuid/socket.rs | 3 +-- src/objects/channel.rs | 4 ++-- src/objects/guild.rs | 2 +- src/objects/me.rs | 4 ++-- 5 files changed, 7 insertions(+), 12 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 3decea6..cdbcc0f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -22,7 +22,6 @@ clap = { version = "4.5", features = ["derive"] } log = "0.4" # async -futures = "0.3" tokio = { version = "1.46", features = ["full"] } futures-util = "0.3.31" @@ -31,7 +30,6 @@ serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" toml = "0.9" bytes = "1.10.1" -rmpv = { version = "1.3.0", features = ["with-serde"] } # File Storage bindet = "0.3.2" @@ -39,8 +37,8 @@ bunny-api-tokio = { version = "0.4", features = ["edge_storage"], default-featur # Web Server axum = { version = "0.8.4", features = ["multipart", "ws"] } -tower-http = { version = "0.6.6", features = ["cors"] } axum-extra = { version = "0.10.1", features = ["cookie", "typed-header"] } +tower-http = { version = "0.6.6", features = ["cors"] } #socketioxide = { version = "0.17.2", features = ["state"] } url = { version = "2.5", features = ["serde"] } time = "0.3.41" @@ -63,5 +61,3 @@ lettre = { version = "0.11", features = ["tokio1", "tokio1-native-tls"] } chrono = { version = "0.4.41", features = ["serde"] } tracing-subscriber = "0.3.19" rand = "0.9.1" - - diff --git a/src/api/v1/channels/uuid/socket.rs b/src/api/v1/channels/uuid/socket.rs index 46a7334..dd020e3 100644 --- a/src/api/v1/channels/uuid/socket.rs +++ b/src/api/v1/channels/uuid/socket.rs @@ -5,8 +5,7 @@ use axum::{ http::HeaderMap, response::IntoResponse, }; -use futures::SinkExt; -use futures_util::StreamExt as _; +use futures_util::{SinkExt, StreamExt}; use serde::Deserialize; use uuid::Uuid; diff --git a/src/objects/channel.rs b/src/objects/channel.rs index 3b34ac6..cacb153 100644 --- a/src/objects/channel.rs +++ b/src/objects/channel.rs @@ -102,7 +102,7 @@ impl Channel { c.clone().build(&mut conn).await }); - futures::future::try_join_all(channel_futures).await + futures_util::future::try_join_all(channel_futures).await } pub async fn fetch_one(app_state: &AppState, channel_uuid: Uuid) -> Result { @@ -267,7 +267,7 @@ impl Channel { let message_futures = messages.iter().map(async move |b| b.build(app_state).await); - futures::future::try_join_all(message_futures).await + futures_util::future::try_join_all(message_futures).await } pub async fn new_message( diff --git a/src/objects/guild.rs b/src/objects/guild.rs index e27e129..9514e49 100644 --- a/src/objects/guild.rs +++ b/src/objects/guild.rs @@ -96,7 +96,7 @@ impl Guild { }); // Execute all futures concurrently and collect results - futures::future::try_join_all(guild_futures).await + futures_util::future::try_join_all(guild_futures).await } pub async fn new(conn: &mut Conn, name: String, owner_uuid: Uuid) -> Result { diff --git a/src/objects/me.rs b/src/objects/me.rs index 3b51da4..a0b399d 100644 --- a/src/objects/me.rs +++ b/src/objects/me.rs @@ -391,13 +391,13 @@ impl Me { User::fetch_one_with_friendship(app_state, self, friend.uuid2).await }); - let mut friends = futures::future::try_join_all(friend_futures).await?; + let mut friends = futures_util::future::try_join_all(friend_futures).await?; let friend_futures = friends2.iter().map(async move |friend| { User::fetch_one_with_friendship(app_state, self, friend.uuid1).await }); - friends.append(&mut futures::future::try_join_all(friend_futures).await?); + friends.append(&mut futures_util::future::try_join_all(friend_futures).await?); Ok(friends) }