Skip to content

Commit 24c0f0b

Browse files
refactor: slightly reduce use of futures-util (#577)
1 parent 51723d4 commit 24c0f0b

File tree

5 files changed

+7
-7
lines changed

5 files changed

+7
-7
lines changed

tower-http/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ auth = ["base64", "validate-request"]
9090
catch-panic = ["tracing", "futures-util/std", "dep:http-body", "dep:http-body-util"]
9191
cors = []
9292
follow-redirect = ["futures-util", "dep:http-body", "iri-string", "tower/util"]
93-
fs = ["futures-util", "dep:http-body", "dep:http-body-util", "tokio/fs", "tokio-util/io", "tokio/io-util", "dep:http-range-header", "mime_guess", "mime", "percent-encoding", "httpdate", "set-status", "futures-util/alloc", "tracing"]
93+
fs = ["futures-core", "futures-util", "dep:http-body", "dep:http-body-util", "tokio/fs", "tokio-util/io", "tokio/io-util", "dep:http-range-header", "mime_guess", "mime", "percent-encoding", "httpdate", "set-status", "futures-util/alloc", "tracing"]
9494
limit = ["dep:http-body", "dep:http-body-util"]
9595
map-request-body = []
9696
map-response-body = []

tower-http/src/auth/async_require_authorization.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
//! use tower_http::auth::{AsyncRequireAuthorizationLayer, AsyncAuthorizeRequest};
99
//! use http::{Request, Response, StatusCode, header::AUTHORIZATION};
1010
//! use tower::{Service, ServiceExt, ServiceBuilder, service_fn, BoxError};
11-
//! use futures_util::future::BoxFuture;
11+
//! use futures_core::future::BoxFuture;
1212
//! use bytes::Bytes;
1313
//! use http_body_util::Full;
1414
//!
@@ -80,7 +80,7 @@
8080
//! use tower_http::auth::{AsyncRequireAuthorizationLayer, AsyncAuthorizeRequest};
8181
//! use http::{Request, Response, StatusCode};
8282
//! use tower::{Service, ServiceExt, ServiceBuilder, BoxError};
83-
//! use futures_util::future::BoxFuture;
83+
//! use futures_core::future::BoxFuture;
8484
//! use http_body_util::Full;
8585
//! use bytes::Bytes;
8686
//!
@@ -312,7 +312,7 @@ mod tests {
312312
#[allow(unused_imports)]
313313
use super::*;
314314
use crate::test_helpers::Body;
315-
use futures_util::future::BoxFuture;
315+
use futures_core::future::BoxFuture;
316316
use http::{header, StatusCode};
317317
use tower::{BoxError, ServiceBuilder, ServiceExt};
318318

tower-http/src/services/fs/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//! File system related services.
22
33
use bytes::Bytes;
4-
use futures_util::Stream;
4+
use futures_core::Stream;
55
use http_body::{Body, Frame};
66
use pin_project_lite::pin_project;
77
use std::{

tower-http/src/services/fs/serve_dir/future.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ use crate::{
66
body::UnsyncBoxBody, content_encoding::Encoding, services::fs::AsyncReadBody, BoxError,
77
};
88
use bytes::Bytes;
9-
use futures_util::future::{BoxFuture, FutureExt, TryFutureExt};
9+
use futures_core::future::BoxFuture;
10+
use futures_util::future::{FutureExt, TryFutureExt};
1011
use http::{
1112
header::{self, ALLOW},
1213
HeaderValue, Request, Response, StatusCode,

tower-http/src/test_helpers.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,6 @@ pub(crate) async fn to_bytes<T>(body: T) -> Result<Bytes, T::Error>
128128
where
129129
T: http_body::Body,
130130
{
131-
futures_util::pin_mut!(body);
132131
Ok(body.collect().await?.to_bytes())
133132
}
134133

0 commit comments

Comments
 (0)