refactor: small dependency optimizations
This commit is contained in:
parent
8ec1610b2e
commit
1c07957c4e
5 changed files with 7 additions and 12 deletions
|
@ -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;
|
||||
|
||||
|
|
|
@ -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<Self, Error> {
|
||||
|
@ -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(
|
||||
|
|
|
@ -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<Self, Error> {
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue