From cdd0eccc0a673f2694e50e64dc5de27028767905 Mon Sep 17 00:00:00 2001 From: Sam Kirby Date: Tue, 2 Jan 2024 23:03:31 +0000 Subject: [PATCH] Add `must_use` attribute to `Serve` (#2484) --- axum/CHANGELOG.md | 2 ++ axum/src/serve.rs | 2 ++ 2 files changed, 4 insertions(+) diff --git a/axum/CHANGELOG.md b/axum/CHANGELOG.md index 3dd43f1a..e2e3fc45 100644 --- a/axum/CHANGELOG.md +++ b/axum/CHANGELOG.md @@ -8,8 +8,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 # Unreleased - **fixed:** Improve `debug_handler` on tuple response types ([#2201]) +- **added:** Add `must_use` attribute to `Serve` and `WithGracefulShutdown` ([#2484]) [#2201]: https://github.com/tokio-rs/axum/pull/2201 +[#2484]: https://github.com/tokio-rs/axum/pull/2484 # 0.7.3 (29. December, 2023) diff --git a/axum/src/serve.rs b/axum/src/serve.rs index 9850af27..b253cb5d 100644 --- a/axum/src/serve.rs +++ b/axum/src/serve.rs @@ -108,6 +108,7 @@ where /// Future returned by [`serve`]. #[cfg(all(feature = "tokio", any(feature = "http1", feature = "http2")))] +#[must_use = "futures must be awaited or polled"] pub struct Serve { tcp_listener: TcpListener, make_service: M, @@ -234,6 +235,7 @@ where /// Serve future with graceful shutdown enabled. #[cfg(all(feature = "tokio", any(feature = "http1", feature = "http2")))] +#[must_use = "futures must be awaited or polled"] pub struct WithGracefulShutdown { tcp_listener: TcpListener, make_service: M,