From 0d05b5e31ff0aa63f25e08a57e5bdd04f3911635 Mon Sep 17 00:00:00 2001 From: David Pedersen Date: Tue, 1 Mar 2022 00:22:21 +0100 Subject: [PATCH] Remove deprecated APIs (#800) * Remove deprecations APIs * changelog --- axum-core/src/macros.rs | 3 +-- axum/CHANGELOG.md | 2 ++ axum/src/extract/mod.rs | 1 - axum/src/macros.rs | 4 +--- axum/src/response/redirect.rs | 21 --------------------- 5 files changed, 4 insertions(+), 27 deletions(-) diff --git a/axum-core/src/macros.rs b/axum-core/src/macros.rs index 71d7d201..ee0bfd7b 100644 --- a/axum-core/src/macros.rs +++ b/axum-core/src/macros.rs @@ -54,7 +54,7 @@ macro_rules! composite_rejection { #[non_exhaustive] pub enum $name { $( - #[allow(missing_docs, deprecated)] + #[allow(missing_docs)] $variant($variant) ),+ } @@ -70,7 +70,6 @@ macro_rules! composite_rejection { } $( - #[allow(deprecated)] impl From<$variant> for $name { fn from(inner: $variant) -> Self { Self::$variant(inner) diff --git a/axum/CHANGELOG.md b/axum/CHANGELOG.md index 07d4ae76..eb8df458 100644 --- a/axum/CHANGELOG.md +++ b/axum/CHANGELOG.md @@ -54,6 +54,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - `PathRejection` - `MatchedPathRejection` - `WebSocketUpgradeRejection` +- **breaking:** `Redirect::found` has been removed ([#800]) - **fixed:** Set `Allow` header when responding with `405 Method Not Allowed` ([#733]) - **fixed:** Correctly set the `Content-Length` header for response to `HEAD` requests ([#734]) @@ -72,6 +73,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 [#783]: https://github.com/tokio-rs/axum/pull/783 [#791]: https://github.com/tokio-rs/axum/pull/791 [#797]: https://github.com/tokio-rs/axum/pull/797 +[#800]: https://github.com/tokio-rs/axum/pull/800 # 0.4.4 (13. January, 2022) diff --git a/axum/src/extract/mod.rs b/axum/src/extract/mod.rs index 128efbd3..e7ccabd7 100644 --- a/axum/src/extract/mod.rs +++ b/axum/src/extract/mod.rs @@ -20,7 +20,6 @@ mod request_parts; pub use axum_core::extract::{FromRequest, RequestParts}; #[doc(inline)] -#[allow(deprecated)] pub use self::{ connect_info::ConnectInfo, content_length_limit::ContentLengthLimit, diff --git a/axum/src/macros.rs b/axum/src/macros.rs index cc5592d5..d26cc87c 100644 --- a/axum/src/macros.rs +++ b/axum/src/macros.rs @@ -57,7 +57,6 @@ macro_rules! define_rejection { #[non_exhaustive] pub struct $name; - #[allow(deprecated)] impl $crate::response::IntoResponse for $name { fn into_response(self) -> $crate::response::Response { (http::StatusCode::$status, $body).into_response() @@ -134,7 +133,7 @@ macro_rules! composite_rejection { #[non_exhaustive] pub enum $name { $( - #[allow(missing_docs, deprecated)] + #[allow(missing_docs)] $variant($variant) ),+ } @@ -150,7 +149,6 @@ macro_rules! composite_rejection { } $( - #[allow(deprecated)] impl From<$variant> for $name { fn from(inner: $variant) -> Self { Self::$variant(inner) diff --git a/axum/src/response/redirect.rs b/axum/src/response/redirect.rs index a61cf674..77999378 100644 --- a/axum/src/response/redirect.rs +++ b/axum/src/response/redirect.rs @@ -69,27 +69,6 @@ impl Redirect { Self::with_status_code(StatusCode::PERMANENT_REDIRECT, uri) } - /// Create a new [`Redirect`] that uses a [`302 Found`][mdn] status code. - /// - /// This is the same as [`Redirect::temporary`] ([`307 Temporary Redirect`][mdn307]) except - /// this status code is older and thus supported by some legacy clients that don't understand - /// the newer one. Many clients wrongly apply [`Redirect::to`] ([`303 See Other`][mdn303]) - /// semantics for this status code, so it should be avoided where possible. - /// - /// # Panics - /// - /// If `uri` isn't a valid [`HeaderValue`]. - /// - /// [mdn]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/302 - /// [mdn307]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/307 - /// [mdn303]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/303 - #[deprecated( - note = "This results in different behavior between clients, so Redirect::temporary or Redirect::to should be used instead" - )] - pub fn found(uri: Uri) -> Self { - Self::with_status_code(StatusCode::FOUND, uri) - } - // This is intentionally not public since other kinds of redirects might not // use the `Location` header, namely `304 Not Modified`. //