From 279fbddebc90410ddc7b88e55cc6ad2926d51833 Mon Sep 17 00:00:00 2001 From: David Pedersen Date: Thu, 3 Aug 2023 00:06:14 +0200 Subject: [PATCH] Implement `IntoResponse` for `(R,) where R: IntoResponse` I just happened to notice we were missing this impl. Probably isn't the most useful thing but still nice to have for consistency and maybe some cursed macro stuff. --- axum-core/src/response/into_response.rs | 10 ++++++++++ axum/CHANGELOG.md | 1 + 2 files changed, 11 insertions(+) diff --git a/axum-core/src/response/into_response.rs b/axum-core/src/response/into_response.rs index 91355b6957a..6b4516691ba 100644 --- a/axum-core/src/response/into_response.rs +++ b/axum-core/src/response/into_response.rs @@ -398,6 +398,16 @@ where } } +impl IntoResponse for (R,) +where + R: IntoResponse, +{ + fn into_response(self) -> Response { + let (res,) = self; + res.into_response() + } +} + macro_rules! impl_into_response { ( $($ty:ident),* $(,)? ) => { #[allow(non_snake_case)] diff --git a/axum/CHANGELOG.md b/axum/CHANGELOG.md index 8cbca279373..f548bdbbd41 100644 --- a/axum/CHANGELOG.md +++ b/axum/CHANGELOG.md @@ -63,6 +63,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - **change:** Update tokio-tungstenite to 0.19 ([#2021]) - **change:** axum's MSRV is now 1.63 ([#2021]) - **added:** Implement `Handler` for `T: IntoResponse` ([#2140]) +- **added:** Implement `IntoResponse` for `(R,) where R: IntoResponse` [#2021]: https://github.com/tokio-rs/axum/pull/2021 [#2014]: https://github.com/tokio-rs/axum/pull/2014