Skip to content

Commit

Permalink
Add must_use attribute to Serve
Browse files Browse the repository at this point in the history
This commit adds the `must_use` attribute to `Serve` and
`WithGracefulShutdown` so that a failure to await these raises a
diagnostic message.
  • Loading branch information
sam-kirby committed Jan 2, 2024
1 parent af13c53 commit 71a9097
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions axum/src/serve.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<M, S> {
tcp_listener: TcpListener,
make_service: M,
Expand Down Expand Up @@ -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<M, S, F> {
tcp_listener: TcpListener,
make_service: M,
Expand Down

0 comments on commit 71a9097

Please sign in to comment.