diff --git a/axum-macros/src/lib.rs b/axum-macros/src/lib.rs index 22a237e5..cf319d80 100644 --- a/axum-macros/src/lib.rs +++ b/axum-macros/src/lib.rs @@ -438,7 +438,7 @@ pub fn derive_from_request_parts(item: TokenStream) -> TokenStream { /// let app = Router::new().route("/", get(handler)); /// /// let listener = tokio::net::TcpListener::bind("0.0.0.0:3000").await.unwrap(); -/// axum::serve(listener, app).await.unwrap(); +/// axum::serve(listener, app).await; /// } /// /// fn handler() -> &'static str { @@ -458,7 +458,7 @@ pub fn derive_from_request_parts(item: TokenStream) -> TokenStream { /// # let app = Router::new().route("/", get(handler)); /// # /// # let listener = tokio::net::TcpListener::bind("0.0.0.0:3000").await.unwrap(); -/// # axum::serve(listener, app).await.unwrap(); +/// # axum::serve(listener, app).await; /// # } /// # /// #[debug_handler] @@ -485,7 +485,7 @@ pub fn derive_from_request_parts(item: TokenStream) -> TokenStream { /// let app = Router::new().route("/", get(handler)); /// /// let listener = tokio::net::TcpListener::bind("0.0.0.0:3000").await.unwrap(); -/// axum::serve(listener, app).await.unwrap(); +/// axum::serve(listener, app).await; /// } /// /// #[debug_handler] @@ -607,7 +607,7 @@ pub fn debug_handler(_attr: TokenStream, input: TokenStream) -> TokenStream { /// .layer(middleware::from_fn(my_middleware)); /// /// let listener = tokio::net::TcpListener::bind("0.0.0.0:3000").await.unwrap(); -/// axum::serve(listener, app).await.unwrap(); +/// axum::serve(listener, app).await; /// } /// /// // if this wasn't a valid middleware function #[debug_middleware] would diff --git a/axum/README.md b/axum/README.md index 9d57939b..40e2cac7 100644 --- a/axum/README.md +++ b/axum/README.md @@ -47,7 +47,7 @@ async fn main() { // run our app with hyper, listening globally on port 3000 let listener = tokio::net::TcpListener::bind("0.0.0.0:3000").await.unwrap(); - axum::serve(listener, app).await.unwrap(); + axum::serve(listener, app).await; } // basic handler that responds with a static string diff --git a/axum/benches/benches.rs b/axum/benches/benches.rs index c38ef918..f2762020 100644 --- a/axum/benches/benches.rs +++ b/axum/benches/benches.rs @@ -164,8 +164,7 @@ impl BenchmarkBuilder { let addr = listener.local_addr().unwrap(); std::thread::spawn(move || { - rt.block_on(axum::serve(listener, app).into_future()) - .unwrap(); + rt.block_on(axum::serve(listener, app).into_future()); }); let mut cmd = Command::new("rewrk"); diff --git a/axum/src/docs/routing/fallback.md b/axum/src/docs/routing/fallback.md index a864b7a4..76b707bd 100644 --- a/axum/src/docs/routing/fallback.md +++ b/axum/src/docs/routing/fallback.md @@ -43,7 +43,7 @@ let app = Router::new().fallback(handler); # async { let listener = tokio::net::TcpListener::bind("0.0.0.0:3000").await.unwrap(); -axum::serve(listener, app).await.unwrap(); +axum::serve(listener, app).await; # }; ``` diff --git a/axum/src/docs/routing/with_state.md b/axum/src/docs/routing/with_state.md index 197741cf..80ebf5ef 100644 --- a/axum/src/docs/routing/with_state.md +++ b/axum/src/docs/routing/with_state.md @@ -179,7 +179,7 @@ let app = routes(AppState {}); // but `app` is a `Router` # async { let listener = tokio::net::TcpListener::bind("0.0.0.0:3000").await.unwrap(); -axum::serve(listener, app).await.unwrap(); +axum::serve(listener, app).await; # }; ``` @@ -202,7 +202,7 @@ let app = routes(AppState {}); // We can now call `Router::into_make_service` # async { let listener = tokio::net::TcpListener::bind("0.0.0.0:3000").await.unwrap(); -axum::serve(listener, app).await.unwrap(); +axum::serve(listener, app).await; # }; ``` diff --git a/axum/src/extract/connect_info.rs b/axum/src/extract/connect_info.rs index 2c7866f9..54dc8e14 100644 --- a/axum/src/extract/connect_info.rs +++ b/axum/src/extract/connect_info.rs @@ -254,8 +254,7 @@ mod tests { listener, app.into_make_service_with_connect_info::(), ) - .await - .unwrap(); + .await; }); rx.await.unwrap(); @@ -296,8 +295,7 @@ mod tests { listener, app.into_make_service_with_connect_info::(), ) - .await - .unwrap(); + .await; }); rx.await.unwrap(); @@ -343,8 +341,7 @@ mod tests { listener, app.into_make_service_with_connect_info::(), ) - .await - .unwrap(); + .await; }); let client = reqwest::Client::new(); diff --git a/axum/src/lib.rs b/axum/src/lib.rs index cdb28530..9d4e2c62 100644 --- a/axum/src/lib.rs +++ b/axum/src/lib.rs @@ -37,7 +37,7 @@ //! //! // run our app with hyper, listening globally on port 3000 //! let listener = tokio::net::TcpListener::bind("0.0.0.0:3000").await.unwrap(); -//! axum::serve(listener, app).await.unwrap(); +//! axum::serve(listener, app).await; //! } //! ``` //! diff --git a/axum/src/routing/method_routing.rs b/axum/src/routing/method_routing.rs index 42e46612..7fb613b1 100644 --- a/axum/src/routing/method_routing.rs +++ b/axum/src/routing/method_routing.rs @@ -1451,7 +1451,7 @@ mod tests { ); let listener = tokio::net::TcpListener::bind("0.0.0.0:0").await.unwrap(); - crate::serve(listener, app).await.unwrap(); + crate::serve(listener, app).await; } #[crate::test] diff --git a/axum/src/routing/mod.rs b/axum/src/routing/mod.rs index 2edf5ca1..5c131b46 100644 --- a/axum/src/routing/mod.rs +++ b/axum/src/routing/mod.rs @@ -517,7 +517,7 @@ impl Router { /// /// # async { /// let listener = tokio::net::TcpListener::bind("0.0.0.0:3000").await.unwrap(); - /// axum::serve(listener, app).await.unwrap(); + /// axum::serve(listener, app).await; /// # }; /// ``` /// diff --git a/axum/src/serve/mod.rs b/axum/src/serve/mod.rs index b5b8b573..de1cd6f9 100644 --- a/axum/src/serve/mod.rs +++ b/axum/src/serve/mod.rs @@ -224,7 +224,7 @@ where S: Service + Clone + Send + 'static, S::Future: Send, { - type Output = io::Result<()>; + type Output = (); type IntoFuture = private::ServeFuture; fn into_future(self) -> Self::IntoFuture { @@ -339,14 +339,11 @@ where S::Future: Send, F: Future + Send + 'static, { - type Output = io::Result<()>; + type Output = (); type IntoFuture = private::ServeFuture; fn into_future(self) -> Self::IntoFuture { - private::ServeFuture(Box::pin(async move { - self.run().await; - Ok(()) - })) + private::ServeFuture(Box::pin(self.run())) } } @@ -447,15 +444,14 @@ where mod private { use std::{ future::Future, - io, pin::Pin, task::{Context, Poll}, }; - pub struct ServeFuture(pub(super) futures_util::future::BoxFuture<'static, io::Result<()>>); + pub struct ServeFuture(pub(super) futures_util::future::BoxFuture<'static, ()>); impl Future for ServeFuture { - type Output = io::Result<()>; + type Output = (); #[inline] fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll { @@ -526,9 +522,7 @@ mod tests { // router serve(TcpListener::bind(addr).await.unwrap(), router.clone()); - serve(tcp_nodelay_listener().await, router.clone()) - .await - .unwrap(); + serve(tcp_nodelay_listener().await, router.clone()); #[cfg(unix)] serve(UnixListener::bind("").unwrap(), router.clone()); diff --git a/axum/src/test_helpers/test_client.rs b/axum/src/test_helpers/test_client.rs index 3981db5a..aff9ad1f 100644 --- a/axum/src/test_helpers/test_client.rs +++ b/axum/src/test_helpers/test_client.rs @@ -20,11 +20,7 @@ where let addr = listener.local_addr().unwrap(); println!("Listening on {addr}"); - tokio::spawn(async move { - serve(listener, Shared::new(svc)) - .await - .expect("server error") - }); + tokio::spawn(serve(listener, Shared::new(svc)).into_future()); addr } diff --git a/examples/anyhow-error-response/src/main.rs b/examples/anyhow-error-response/src/main.rs index fdc32d92..0c22d85e 100644 --- a/examples/anyhow-error-response/src/main.rs +++ b/examples/anyhow-error-response/src/main.rs @@ -19,7 +19,7 @@ async fn main() { .await .unwrap(); println!("listening on {}", listener.local_addr().unwrap()); - axum::serve(listener, app).await.unwrap(); + axum::serve(listener, app).await; } async fn handler() -> Result<(), AppError> { diff --git a/examples/auto-reload/src/main.rs b/examples/auto-reload/src/main.rs index 8d71805b..c5f70b65 100644 --- a/examples/auto-reload/src/main.rs +++ b/examples/auto-reload/src/main.rs @@ -26,7 +26,7 @@ async fn main() { // run it println!("listening on {}", listener.local_addr().unwrap()); - axum::serve(listener, app).await.unwrap(); + axum::serve(listener, app).await; } async fn handler() -> Html<&'static str> { diff --git a/examples/chat/src/main.rs b/examples/chat/src/main.rs index 1c07301e..68ac107a 100644 --- a/examples/chat/src/main.rs +++ b/examples/chat/src/main.rs @@ -56,7 +56,7 @@ async fn main() { .await .unwrap(); tracing::debug!("listening on {}", listener.local_addr().unwrap()); - axum::serve(listener, app).await.unwrap(); + axum::serve(listener, app).await; } async fn websocket_handler( diff --git a/examples/compression/src/main.rs b/examples/compression/src/main.rs index b487f34e..d07df511 100644 --- a/examples/compression/src/main.rs +++ b/examples/compression/src/main.rs @@ -23,7 +23,7 @@ async fn main() { .await .unwrap(); tracing::debug!("listening on {}", listener.local_addr().unwrap()); - axum::serve(listener, app).await.unwrap(); + axum::serve(listener, app).await; } fn app() -> Router { diff --git a/examples/consume-body-in-extractor-or-middleware/src/main.rs b/examples/consume-body-in-extractor-or-middleware/src/main.rs index 3239d6ac..358f4b60 100644 --- a/examples/consume-body-in-extractor-or-middleware/src/main.rs +++ b/examples/consume-body-in-extractor-or-middleware/src/main.rs @@ -34,7 +34,7 @@ async fn main() { .await .unwrap(); tracing::debug!("listening on {}", listener.local_addr().unwrap()); - axum::serve(listener, app).await.unwrap(); + axum::serve(listener, app).await; } // middleware that shows how to consume the request body upfront diff --git a/examples/cors/src/main.rs b/examples/cors/src/main.rs index bbd19206..4760619f 100644 --- a/examples/cors/src/main.rs +++ b/examples/cors/src/main.rs @@ -41,7 +41,7 @@ async fn main() { async fn serve(app: Router, port: u16) { let addr = SocketAddr::from(([127, 0, 0, 1], port)); let listener = tokio::net::TcpListener::bind(addr).await.unwrap(); - axum::serve(listener, app).await.unwrap(); + axum::serve(listener, app).await; } async fn html() -> impl IntoResponse { diff --git a/examples/customize-extractor-error/src/main.rs b/examples/customize-extractor-error/src/main.rs index 48188352..1c735905 100644 --- a/examples/customize-extractor-error/src/main.rs +++ b/examples/customize-extractor-error/src/main.rs @@ -32,5 +32,5 @@ async fn main() { .await .unwrap(); tracing::debug!("listening on {}", listener.local_addr().unwrap()); - axum::serve(listener, app).await.unwrap(); + axum::serve(listener, app).await; } diff --git a/examples/customize-path-rejection/src/main.rs b/examples/customize-path-rejection/src/main.rs index e784a969..64e4d01f 100644 --- a/examples/customize-path-rejection/src/main.rs +++ b/examples/customize-path-rejection/src/main.rs @@ -32,7 +32,7 @@ async fn main() { .await .unwrap(); tracing::debug!("listening on {}", listener.local_addr().unwrap()); - axum::serve(listener, app).await.unwrap(); + axum::serve(listener, app).await; } async fn handler(Path(params): Path) -> impl IntoResponse { diff --git a/examples/dependency-injection/src/main.rs b/examples/dependency-injection/src/main.rs index 7a4719e7..4e4688c1 100644 --- a/examples/dependency-injection/src/main.rs +++ b/examples/dependency-injection/src/main.rs @@ -69,7 +69,7 @@ async fn main() { let listener = TcpListener::bind("127.0.0.1:3000").await.unwrap(); tracing::debug!("listening on {}", listener.local_addr().unwrap()); - axum::serve(listener, app).await.unwrap(); + axum::serve(listener, app).await; } #[derive(Clone)] diff --git a/examples/diesel-async-postgres/src/main.rs b/examples/diesel-async-postgres/src/main.rs index 44fbb546..adca1cd9 100644 --- a/examples/diesel-async-postgres/src/main.rs +++ b/examples/diesel-async-postgres/src/main.rs @@ -77,7 +77,7 @@ async fn main() { let addr = SocketAddr::from(([127, 0, 0, 1], 3000)); tracing::debug!("listening on {addr}"); let listener = tokio::net::TcpListener::bind(addr).await.unwrap(); - axum::serve(listener, app).await.unwrap(); + axum::serve(listener, app).await; } async fn create_user( diff --git a/examples/diesel-postgres/src/main.rs b/examples/diesel-postgres/src/main.rs index 0c5852d2..7875bd65 100644 --- a/examples/diesel-postgres/src/main.rs +++ b/examples/diesel-postgres/src/main.rs @@ -86,7 +86,7 @@ async fn main() { let addr = SocketAddr::from(([127, 0, 0, 1], 3000)); tracing::debug!("listening on {addr}"); let listener = tokio::net::TcpListener::bind(addr).await.unwrap(); - axum::serve(listener, app).await.unwrap(); + axum::serve(listener, app).await; } async fn create_user( diff --git a/examples/error-handling/src/main.rs b/examples/error-handling/src/main.rs index 0ad9f43c..629d23bc 100644 --- a/examples/error-handling/src/main.rs +++ b/examples/error-handling/src/main.rs @@ -83,7 +83,7 @@ async fn main() { .await .unwrap(); tracing::debug!("listening on {}", listener.local_addr().unwrap()); - axum::serve(listener, app).await.unwrap(); + axum::serve(listener, app).await; } #[derive(Default, Clone)] diff --git a/examples/form/src/main.rs b/examples/form/src/main.rs index cd6ff32f..2929b392 100644 --- a/examples/form/src/main.rs +++ b/examples/form/src/main.rs @@ -26,7 +26,7 @@ async fn main() { .await .unwrap(); tracing::debug!("listening on {}", listener.local_addr().unwrap()); - axum::serve(listener, app).await.unwrap(); + axum::serve(listener, app).await; } fn app() -> Router { diff --git a/examples/global-404-handler/src/main.rs b/examples/global-404-handler/src/main.rs index bf1d8a95..f5cc6730 100644 --- a/examples/global-404-handler/src/main.rs +++ b/examples/global-404-handler/src/main.rs @@ -33,7 +33,7 @@ async fn main() { .await .unwrap(); tracing::debug!("listening on {}", listener.local_addr().unwrap()); - axum::serve(listener, app).await.unwrap(); + axum::serve(listener, app).await; } async fn handler() -> Html<&'static str> { diff --git a/examples/graceful-shutdown/src/main.rs b/examples/graceful-shutdown/src/main.rs index 533cf8f1..dc1e6f95 100644 --- a/examples/graceful-shutdown/src/main.rs +++ b/examples/graceful-shutdown/src/main.rs @@ -48,8 +48,7 @@ async fn main() { // Run the server with graceful shutdown axum::serve(listener, app) .with_graceful_shutdown(shutdown_signal()) - .await - .unwrap(); + .await; } async fn shutdown_signal() { diff --git a/examples/handle-head-request/src/main.rs b/examples/handle-head-request/src/main.rs index 6cb71f5f..d5a8e5c7 100644 --- a/examples/handle-head-request/src/main.rs +++ b/examples/handle-head-request/src/main.rs @@ -17,7 +17,7 @@ async fn main() { .await .unwrap(); println!("listening on {}", listener.local_addr().unwrap()); - axum::serve(listener, app()).await.unwrap(); + axum::serve(listener, app()).await; } // GET routes will also be called for HEAD requests but will have the response body removed. diff --git a/examples/hello-world/src/main.rs b/examples/hello-world/src/main.rs index de018335..a0971bb7 100644 --- a/examples/hello-world/src/main.rs +++ b/examples/hello-world/src/main.rs @@ -16,7 +16,7 @@ async fn main() { .await .unwrap(); println!("listening on {}", listener.local_addr().unwrap()); - axum::serve(listener, app).await.unwrap(); + axum::serve(listener, app).await; } async fn handler() -> Html<&'static str> { diff --git a/examples/jwt/src/main.rs b/examples/jwt/src/main.rs index f7877d74..90b78a38 100644 --- a/examples/jwt/src/main.rs +++ b/examples/jwt/src/main.rs @@ -73,7 +73,7 @@ async fn main() { .await .unwrap(); tracing::debug!("listening on {}", listener.local_addr().unwrap()); - axum::serve(listener, app).await.unwrap(); + axum::serve(listener, app).await; } async fn protected(claims: Claims) -> Result { diff --git a/examples/key-value-store/src/main.rs b/examples/key-value-store/src/main.rs index c2b3f51c..f5da7722 100644 --- a/examples/key-value-store/src/main.rs +++ b/examples/key-value-store/src/main.rs @@ -78,7 +78,7 @@ async fn main() { .await .unwrap(); tracing::debug!("listening on {}", listener.local_addr().unwrap()); - axum::serve(listener, app).await.unwrap(); + axum::serve(listener, app).await; } type SharedState = Arc>; diff --git a/examples/mongodb/src/main.rs b/examples/mongodb/src/main.rs index 2cf25f4f..7d20949d 100644 --- a/examples/mongodb/src/main.rs +++ b/examples/mongodb/src/main.rs @@ -50,7 +50,7 @@ async fn main() { .await .unwrap(); tracing::debug!("Listening on {}", listener.local_addr().unwrap()); - axum::serve(listener, app(client)).await.unwrap(); + axum::serve(listener, app(client)).await; } // defining routes and state diff --git a/examples/multipart-form/src/main.rs b/examples/multipart-form/src/main.rs index 30fcfc70..0019e5f3 100644 --- a/examples/multipart-form/src/main.rs +++ b/examples/multipart-form/src/main.rs @@ -38,7 +38,7 @@ async fn main() { .await .unwrap(); tracing::debug!("listening on {}", listener.local_addr().unwrap()); - axum::serve(listener, app).await.unwrap(); + axum::serve(listener, app).await; } async fn show_form() -> Html<&'static str> { diff --git a/examples/oauth/src/main.rs b/examples/oauth/src/main.rs index 8bea2c29..c59dac5a 100644 --- a/examples/oauth/src/main.rs +++ b/examples/oauth/src/main.rs @@ -69,7 +69,7 @@ async fn main() { .unwrap() ); - axum::serve(listener, app).await.unwrap(); + axum::serve(listener, app).await; } #[derive(Clone)] diff --git a/examples/parse-body-based-on-content-type/src/main.rs b/examples/parse-body-based-on-content-type/src/main.rs index 1e4fc1ac..18ea8a98 100644 --- a/examples/parse-body-based-on-content-type/src/main.rs +++ b/examples/parse-body-based-on-content-type/src/main.rs @@ -33,7 +33,7 @@ async fn main() { .await .unwrap(); tracing::debug!("listening on {}", listener.local_addr().unwrap()); - axum::serve(listener, app).await.unwrap(); + axum::serve(listener, app).await; } #[derive(Debug, Serialize, Deserialize)] diff --git a/examples/print-request-response/src/main.rs b/examples/print-request-response/src/main.rs index 84f14f2d..7c610bfe 100644 --- a/examples/print-request-response/src/main.rs +++ b/examples/print-request-response/src/main.rs @@ -35,7 +35,7 @@ async fn main() { .await .unwrap(); tracing::debug!("listening on {}", listener.local_addr().unwrap()); - axum::serve(listener, app).await.unwrap(); + axum::serve(listener, app).await; } async fn print_request_response( diff --git a/examples/prometheus-metrics/src/main.rs b/examples/prometheus-metrics/src/main.rs index fe76121c..2551594f 100644 --- a/examples/prometheus-metrics/src/main.rs +++ b/examples/prometheus-metrics/src/main.rs @@ -45,7 +45,7 @@ async fn start_main_server() { .await .unwrap(); tracing::debug!("listening on {}", listener.local_addr().unwrap()); - axum::serve(listener, app).await.unwrap(); + axum::serve(listener, app).await; } async fn start_metrics_server() { @@ -56,7 +56,7 @@ async fn start_metrics_server() { .await .unwrap(); tracing::debug!("listening on {}", listener.local_addr().unwrap()); - axum::serve(listener, app).await.unwrap(); + axum::serve(listener, app).await; } #[tokio::main] diff --git a/examples/readme/src/main.rs b/examples/readme/src/main.rs index cd2120cb..2e931e3d 100644 --- a/examples/readme/src/main.rs +++ b/examples/readme/src/main.rs @@ -29,7 +29,7 @@ async fn main() { .await .unwrap(); tracing::debug!("listening on {}", listener.local_addr().unwrap()); - axum::serve(listener, app).await.unwrap(); + axum::serve(listener, app).await; } // basic handler that responds with a static string diff --git a/examples/request-id/src/main.rs b/examples/request-id/src/main.rs index 552d8d4a..4c6874b6 100644 --- a/examples/request-id/src/main.rs +++ b/examples/request-id/src/main.rs @@ -72,7 +72,7 @@ async fn main() { .await .unwrap(); println!("listening on {}", listener.local_addr().unwrap()); - axum::serve(listener, app).await.unwrap(); + axum::serve(listener, app).await; } async fn handler() -> Html<&'static str> { diff --git a/examples/reqwest-response/src/main.rs b/examples/reqwest-response/src/main.rs index a1ba33cf..be4edfed 100644 --- a/examples/reqwest-response/src/main.rs +++ b/examples/reqwest-response/src/main.rs @@ -47,7 +47,7 @@ async fn main() { .await .unwrap(); tracing::debug!("listening on {}", listener.local_addr().unwrap()); - axum::serve(listener, app).await.unwrap(); + axum::serve(listener, app).await; } async fn stream_reqwest_response(State(client): State) -> Response { diff --git a/examples/reverse-proxy/src/main.rs b/examples/reverse-proxy/src/main.rs index db391246..1802f9d7 100644 --- a/examples/reverse-proxy/src/main.rs +++ b/examples/reverse-proxy/src/main.rs @@ -34,7 +34,7 @@ async fn main() { .await .unwrap(); println!("listening on {}", listener.local_addr().unwrap()); - axum::serve(listener, app).await.unwrap(); + axum::serve(listener, app).await; } async fn handler(State(client): State, mut req: Request) -> Result { @@ -63,5 +63,5 @@ async fn server() { .await .unwrap(); println!("listening on {}", listener.local_addr().unwrap()); - axum::serve(listener, app).await.unwrap(); + axum::serve(listener, app).await; } diff --git a/examples/routes-and-handlers-close-together/src/main.rs b/examples/routes-and-handlers-close-together/src/main.rs index 50721e70..57be50ec 100644 --- a/examples/routes-and-handlers-close-together/src/main.rs +++ b/examples/routes-and-handlers-close-together/src/main.rs @@ -20,7 +20,7 @@ async fn main() { .await .unwrap(); println!("listening on {}", listener.local_addr().unwrap()); - axum::serve(listener, app).await.unwrap(); + axum::serve(listener, app).await; } fn root() -> Router { diff --git a/examples/sqlx-postgres/src/main.rs b/examples/sqlx-postgres/src/main.rs index 904a5a8a..729d35d4 100644 --- a/examples/sqlx-postgres/src/main.rs +++ b/examples/sqlx-postgres/src/main.rs @@ -57,7 +57,7 @@ async fn main() { // run it with hyper let listener = TcpListener::bind("127.0.0.1:3000").await.unwrap(); tracing::debug!("listening on {}", listener.local_addr().unwrap()); - axum::serve(listener, app).await.unwrap(); + axum::serve(listener, app).await; } // we can extract the connection pool with `State` diff --git a/examples/sse/src/main.rs b/examples/sse/src/main.rs index 4f616f6b..f4ab9e3e 100644 --- a/examples/sse/src/main.rs +++ b/examples/sse/src/main.rs @@ -39,7 +39,7 @@ async fn main() { .await .unwrap(); tracing::debug!("listening on {}", listener.local_addr().unwrap()); - axum::serve(listener, app).await.unwrap(); + axum::serve(listener, app).await; } fn app() -> Router { diff --git a/examples/stream-to-file/src/main.rs b/examples/stream-to-file/src/main.rs index 8bb2cb7e..c1951dbf 100644 --- a/examples/stream-to-file/src/main.rs +++ b/examples/stream-to-file/src/main.rs @@ -43,7 +43,7 @@ async fn main() { .await .unwrap(); tracing::debug!("listening on {}", listener.local_addr().unwrap()); - axum::serve(listener, app).await.unwrap(); + axum::serve(listener, app).await; } // Handler that streams the request body to a file. diff --git a/examples/templates-minijinja/src/main.rs b/examples/templates-minijinja/src/main.rs index 2903b824..7ba3d336 100644 --- a/examples/templates-minijinja/src/main.rs +++ b/examples/templates-minijinja/src/main.rs @@ -44,7 +44,7 @@ async fn main() { .await .unwrap(); println!("listening on {}", listener.local_addr().unwrap()); - axum::serve(listener, app).await.unwrap(); + axum::serve(listener, app).await; } async fn handler_home(State(state): State>) -> Result, StatusCode> { diff --git a/examples/templates/src/main.rs b/examples/templates/src/main.rs index 4bce0ec1..7271a3ad 100644 --- a/examples/templates/src/main.rs +++ b/examples/templates/src/main.rs @@ -32,7 +32,7 @@ async fn main() { .await .unwrap(); tracing::debug!("listening on {}", listener.local_addr().unwrap()); - axum::serve(listener, app).await.unwrap(); + axum::serve(listener, app).await; } fn app() -> Router { diff --git a/examples/tls-graceful-shutdown/src/main.rs b/examples/tls-graceful-shutdown/src/main.rs index 50256e28..0d5350d2 100644 --- a/examples/tls-graceful-shutdown/src/main.rs +++ b/examples/tls-graceful-shutdown/src/main.rs @@ -146,6 +146,5 @@ where tracing::debug!("listening on {addr}"); axum::serve(listener, redirect.into_make_service()) .with_graceful_shutdown(signal) - .await - .unwrap(); + .await; } diff --git a/examples/tls-rustls/src/main.rs b/examples/tls-rustls/src/main.rs index 53620eff..5a3e7532 100644 --- a/examples/tls-rustls/src/main.rs +++ b/examples/tls-rustls/src/main.rs @@ -110,7 +110,5 @@ async fn redirect_http_to_https(ports: Ports) { let addr = SocketAddr::from(([127, 0, 0, 1], ports.http)); let listener = tokio::net::TcpListener::bind(addr).await.unwrap(); tracing::debug!("listening on {}", listener.local_addr().unwrap()); - axum::serve(listener, redirect.into_make_service()) - .await - .unwrap(); + axum::serve(listener, redirect.into_make_service()).await; } diff --git a/examples/todos/src/main.rs b/examples/todos/src/main.rs index cef395b7..185958b0 100644 --- a/examples/todos/src/main.rs +++ b/examples/todos/src/main.rs @@ -72,7 +72,7 @@ async fn main() { .await .unwrap(); tracing::debug!("listening on {}", listener.local_addr().unwrap()); - axum::serve(listener, app).await.unwrap(); + axum::serve(listener, app).await; } // The query parameters for todos index diff --git a/examples/tokio-postgres/src/main.rs b/examples/tokio-postgres/src/main.rs index 7df9917b..18f94ff5 100644 --- a/examples/tokio-postgres/src/main.rs +++ b/examples/tokio-postgres/src/main.rs @@ -44,7 +44,7 @@ async fn main() { .await .unwrap(); tracing::debug!("listening on {}", listener.local_addr().unwrap()); - axum::serve(listener, app).await.unwrap(); + axum::serve(listener, app).await; } type ConnectionPool = Pool>; diff --git a/examples/tokio-redis/src/main.rs b/examples/tokio-redis/src/main.rs index 105b1de4..71939813 100644 --- a/examples/tokio-redis/src/main.rs +++ b/examples/tokio-redis/src/main.rs @@ -53,7 +53,7 @@ async fn main() { .await .unwrap(); tracing::debug!("listening on {}", listener.local_addr().unwrap()); - axum::serve(listener, app).await.unwrap(); + axum::serve(listener, app).await; } type ConnectionPool = Pool; diff --git a/examples/tracing-aka-logging/src/main.rs b/examples/tracing-aka-logging/src/main.rs index 30c16f19..06a8c08d 100644 --- a/examples/tracing-aka-logging/src/main.rs +++ b/examples/tracing-aka-logging/src/main.rs @@ -87,7 +87,7 @@ async fn main() { // run it let listener = TcpListener::bind("127.0.0.1:3000").await.unwrap(); tracing::debug!("listening on {}", listener.local_addr().unwrap()); - axum::serve(listener, app).await.unwrap(); + axum::serve(listener, app).await; } async fn handler() -> Html<&'static str> { diff --git a/examples/unix-domain-socket/src/main.rs b/examples/unix-domain-socket/src/main.rs index 07b38d91..40baf9f5 100644 --- a/examples/unix-domain-socket/src/main.rs +++ b/examples/unix-domain-socket/src/main.rs @@ -52,7 +52,7 @@ mod unix { .route("/", get(handler)) .into_make_service_with_connect_info::(); - axum::serve(uds, app).await.unwrap(); + axum::serve(uds, app).await; }); let stream = TokioIo::new(UnixStream::connect(path).await.unwrap()); diff --git a/examples/validator/src/main.rs b/examples/validator/src/main.rs index f02e2ca9..3f7c1641 100644 --- a/examples/validator/src/main.rs +++ b/examples/validator/src/main.rs @@ -39,7 +39,7 @@ async fn main() { // run it let listener = TcpListener::bind("127.0.0.1:3000").await.unwrap(); tracing::debug!("listening on {}", listener.local_addr().unwrap()); - axum::serve(listener, app).await.unwrap(); + axum::serve(listener, app).await; } fn app() -> Router { diff --git a/examples/versioning/src/main.rs b/examples/versioning/src/main.rs index c30e52d1..63ca32b9 100644 --- a/examples/versioning/src/main.rs +++ b/examples/versioning/src/main.rs @@ -32,7 +32,7 @@ async fn main() { .await .unwrap(); tracing::debug!("listening on {}", listener.local_addr().unwrap()); - axum::serve(listener, app).await.unwrap(); + axum::serve(listener, app).await; } fn app() -> Router { diff --git a/examples/websockets/src/main.rs b/examples/websockets/src/main.rs index 18e8ee32..d5cee8da 100644 --- a/examples/websockets/src/main.rs +++ b/examples/websockets/src/main.rs @@ -73,8 +73,7 @@ async fn main() { listener, app.into_make_service_with_connect_info::(), ) - .await - .unwrap(); + .await; } /// The handler for the HTTP request (this gets called when the HTTP request lands at the start