From b1e9930eb689322e0c1dbec2154cc7526387439b Mon Sep 17 00:00:00 2001 From: David Pedersen Date: Fri, 24 Mar 2023 15:25:29 +0100 Subject: [PATCH] serve also requires hyper/http1 --- axum/benches/benches.rs | 2 +- axum/src/lib.rs | 4 ++-- examples/testing/src/main.rs | 1 - 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/axum/benches/benches.rs b/axum/benches/benches.rs index b969070b..4b51a69d 100644 --- a/axum/benches/benches.rs +++ b/axum/benches/benches.rs @@ -148,7 +148,7 @@ impl BenchmarkBuilder { let addr = listener.local_addr().unwrap(); std::thread::spawn(move || { - rt.block_on(axum::serve(listener, app)); + rt.block_on(axum::serve(listener, app)).unwrap(); }); let mut cmd = Command::new("rewrk"); diff --git a/axum/src/lib.rs b/axum/src/lib.rs index c64c7107..3d732c19 100644 --- a/axum/src/lib.rs +++ b/axum/src/lib.rs @@ -441,7 +441,7 @@ pub mod handler; pub mod middleware; pub mod response; pub mod routing; -#[cfg(feature = "tokio")] +#[cfg(all(feature = "tokio", feature = "http1"))] pub mod serve; #[cfg(test)] @@ -477,7 +477,7 @@ pub use axum_core::{BoxError, Error, RequestExt, RequestPartsExt}; #[cfg(feature = "macros")] pub use axum_macros::debug_handler; -#[cfg(feature = "tokio")] +#[cfg(all(feature = "tokio", feature = "http1"))] #[doc(inline)] pub use self::serve::serve; diff --git a/examples/testing/src/main.rs b/examples/testing/src/main.rs index 9b62a23f..d95940cb 100644 --- a/examples/testing/src/main.rs +++ b/examples/testing/src/main.rs @@ -62,7 +62,6 @@ mod tests { use http_body_util::BodyExt; use serde_json::{json, Value}; use std::net::SocketAddr; - use tokio::net::TcpListener; use tower::Service; // for `call` use tower::ServiceExt; // for `oneshot` and `ready` // for `collect`