diff --git a/Cargo.lock b/Cargo.lock index 7ffe93b6a6..9116723f8e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -234,28 +234,6 @@ dependencies = [ "sha2 0.9.9", ] -[[package]] -name = "async-stream" -version = "0.3.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b5a71a6f37880a80d1d7f19efd781e4b5de42c88f0722cc13bcb6cc2cfe8476" -dependencies = [ - "async-stream-impl", - "futures-core", - "pin-project-lite", -] - -[[package]] -name = "async-stream-impl" -version = "0.3.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7c24de15d275a1ecfd47a380fb4d5ec9bfe0933f309ed5e705b775596a3574d" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.93", -] - [[package]] name = "async-trait" version = "0.1.83" @@ -377,7 +355,7 @@ dependencies = [ "axum-extra", "axum-macros", "bytes", - "futures-util", + "futures-core", "http 1.2.0", "http-body 1.0.1", "http-body-util", @@ -397,7 +375,6 @@ dependencies = [ name = "axum-extra" version = "0.10.0" dependencies = [ - "async-stream", "axum", "axum-core", "axum-macros", @@ -1580,7 +1557,6 @@ dependencies = [ "hyper-util", "tokio", "tokio-native-tls", - "tower 0.5.2", "tower-service", "tracing", "tracing-subscriber", @@ -1962,7 +1938,6 @@ dependencies = [ "hyper 1.5.2", "hyper-util", "tokio", - "tower 0.5.2", "tracing-subscriber", ] diff --git a/axum-core/Cargo.toml b/axum-core/Cargo.toml index e287bc0e87..b07beb2477 100644 --- a/axum-core/Cargo.toml +++ b/axum-core/Cargo.toml @@ -19,7 +19,7 @@ __private_docs = ["dep:tower-http"] [dependencies] bytes = "1.2" -futures-util = { version = "0.3", default-features = false, features = ["alloc"] } +futures-core = "0.3" http = "1.0.0" http-body = "1.0.0" http-body-util = "0.1.0" @@ -38,7 +38,6 @@ tracing = { version = "0.1.37", default-features = false, optional = true } axum = { path = "../axum", features = ["__private"] } axum-extra = { path = "../axum-extra", features = ["typed-header"] } axum-macros = { path = "../axum-macros", features = ["__private"] } -futures-util = { version = "0.3", default-features = false, features = ["alloc"] } hyper = "1.0.0" tokio = { version = "1.25.0", features = ["macros"] } tower-http = { version = "0.6.0", features = ["limit"] } diff --git a/axum-core/src/body.rs b/axum-core/src/body.rs index 3c3f6a10d8..4ee0ffe695 100644 --- a/axum-core/src/body.rs +++ b/axum-core/src/body.rs @@ -2,13 +2,12 @@ use crate::{BoxError, Error}; use bytes::Bytes; -use futures_util::stream::Stream; -use futures_util::TryStream; +use futures_core::{Stream, TryStream}; use http_body::{Body as _, Frame}; use http_body_util::BodyExt; use pin_project_lite::pin_project; use std::pin::Pin; -use std::task::{Context, Poll}; +use std::task::{ready, Context, Poll}; use sync_wrapper::SyncWrapper; type BoxBody = http_body_util::combinators::UnsyncBoxBody; @@ -147,7 +146,7 @@ impl Stream for BodyDataStream { #[inline] fn poll_next(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll> { loop { - match futures_util::ready!(Pin::new(&mut self.inner).poll_frame(cx)?) { + match ready!(Pin::new(&mut self.inner).poll_frame(cx)?) { Some(frame) => match frame.into_data() { Ok(data) => return Poll::Ready(Some(Ok(data))), Err(_frame) => {} @@ -202,7 +201,7 @@ where cx: &mut Context<'_>, ) -> Poll, Self::Error>>> { let stream = self.project().stream.get_pin_mut(); - match futures_util::ready!(stream.try_poll_next(cx)) { + match ready!(stream.try_poll_next(cx)) { Some(Ok(chunk)) => Poll::Ready(Some(Ok(Frame::data(chunk.into())))), Some(Err(err)) => Poll::Ready(Some(Err(Error::new(err)))), None => Poll::Ready(None), diff --git a/axum-extra/CHANGELOG.md b/axum-extra/CHANGELOG.md index bda5582b7c..a100175057 100644 --- a/axum-extra/CHANGELOG.md +++ b/axum-extra/CHANGELOG.md @@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning]. # Unreleased +- **breaking:** Remove unused `async-stream` feature, which was accidentally + introduced as an implicit feature through an optional dependency which was no + longer being used ([#3145]) + +[#3145]: https://github.com/tokio-rs/axum/pull/3145 + # 0.10.0 ## since rc.1 diff --git a/axum-extra/Cargo.toml b/axum-extra/Cargo.toml index 4b29f97c68..07eaa4a3ff 100644 --- a/axum-extra/Cargo.toml +++ b/axum-extra/Cargo.toml @@ -57,7 +57,6 @@ tower-layer = "0.3" tower-service = "0.3" # optional dependencies -async-stream = { version = "0.3", optional = true } axum-macros = { path = "../axum-macros", version = "0.5.0", optional = true } cookie = { package = "cookie", version = "0.18.0", features = ["percent-encode"], optional = true } fastrand = { version = "2.1.0", optional = true } diff --git a/axum/src/extract/ws.rs b/axum/src/extract/ws.rs index 3d96d89888..96bea47130 100644 --- a/axum/src/extract/ws.rs +++ b/axum/src/extract/ws.rs @@ -109,7 +109,7 @@ use std::{ borrow::Cow, future::Future, pin::Pin, - task::{Context, Poll}, + task::{ready, Context, Poll}, }; use tokio_tungstenite::{ tungstenite::{ @@ -518,7 +518,7 @@ impl Stream for WebSocket { fn poll_next(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll> { loop { - match futures_util::ready!(self.inner.poll_next_unpin(cx)) { + match ready!(self.inner.poll_next_unpin(cx)) { Some(Ok(msg)) => { if let Some(msg) = Message::from_tungstenite(msg) { return Poll::Ready(Some(Ok(msg))); diff --git a/axum/src/middleware/from_extractor.rs b/axum/src/middleware/from_extractor.rs index cda0d97798..0c916c1d01 100644 --- a/axum/src/middleware/from_extractor.rs +++ b/axum/src/middleware/from_extractor.rs @@ -2,7 +2,7 @@ use crate::{ extract::FromRequestParts, response::{IntoResponse, Response}, }; -use futures_util::{future::BoxFuture, ready}; +use futures_util::future::BoxFuture; use http::Request; use pin_project_lite::pin_project; use std::{ @@ -10,7 +10,7 @@ use std::{ future::Future, marker::PhantomData, pin::Pin, - task::{Context, Poll}, + task::{ready, Context, Poll}, }; use tower_layer::Layer; use tower_service::Service; diff --git a/axum/src/response/sse.rs b/axum/src/response/sse.rs index b414f05725..54ec2b46a1 100644 --- a/axum/src/response/sse.rs +++ b/axum/src/response/sse.rs @@ -34,17 +34,14 @@ use axum_core::{ response::{IntoResponse, Response}, }; use bytes::{BufMut, BytesMut}; -use futures_util::{ - ready, - stream::{Stream, TryStream}, -}; +use futures_util::stream::{Stream, TryStream}; use http_body::Frame; use pin_project_lite::pin_project; use std::{ fmt, future::Future, pin::Pin, - task::{Context, Poll}, + task::{ready, Context, Poll}, time::Duration, }; use sync_wrapper::SyncWrapper; diff --git a/axum/src/routing/route.rs b/axum/src/routing/route.rs index a187c9a2a5..e520bc1ba3 100644 --- a/axum/src/routing/route.rs +++ b/axum/src/routing/route.rs @@ -230,7 +230,7 @@ impl Future for InfallibleRouteFuture { type Output = Response; fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll { - match futures_util::ready!(self.project().future.poll(cx)) { + match ready!(self.project().future.poll(cx)) { Ok(response) => Poll::Ready(response), Err(err) => match err {}, } diff --git a/examples/low-level-native-tls/Cargo.toml b/examples/low-level-native-tls/Cargo.toml index 6abf43d455..108e2303b6 100644 --- a/examples/low-level-native-tls/Cargo.toml +++ b/examples/low-level-native-tls/Cargo.toml @@ -11,7 +11,6 @@ hyper = { version = "1.0.0", features = ["full"] } hyper-util = { version = "0.1" } tokio = { version = "1", features = ["full"] } tokio-native-tls = "0.3.1" -tower = { version = "0.5.2", features = ["make"] } tower-service = "0.3.2" tracing = "0.1" tracing-subscriber = { version = "0.3", features = ["env-filter"] } diff --git a/examples/unix-domain-socket/Cargo.toml b/examples/unix-domain-socket/Cargo.toml index 37752c7d65..f59f07b632 100644 --- a/examples/unix-domain-socket/Cargo.toml +++ b/examples/unix-domain-socket/Cargo.toml @@ -10,5 +10,4 @@ http-body-util = "0.1" hyper = { version = "1.0.0", features = ["full"] } hyper-util = { version = "0.1", features = ["tokio", "server-auto", "http1"] } tokio = { version = "1.0", features = ["full"] } -tower = { version = "0.5.2", features = ["util"] } tracing-subscriber = { version = "0.3", features = ["env-filter"] }