Skip to content

Commit

Permalink
Remove deprecated APIs (#800)
Browse files Browse the repository at this point in the history
* Remove deprecations APIs

* changelog
  • Loading branch information
davidpdrsn authored Feb 28, 2022
1 parent f12ab07 commit 0d05b5e
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 27 deletions.
3 changes: 1 addition & 2 deletions axum-core/src/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ macro_rules! composite_rejection {
#[non_exhaustive]
pub enum $name {
$(
#[allow(missing_docs, deprecated)]
#[allow(missing_docs)]
$variant($variant)
),+
}
Expand All @@ -70,7 +70,6 @@ macro_rules! composite_rejection {
}

$(
#[allow(deprecated)]
impl From<$variant> for $name {
fn from(inner: $variant) -> Self {
Self::$variant(inner)
Expand Down
2 changes: 2 additions & 0 deletions axum/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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])
Expand All @@ -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)

Expand Down
1 change: 0 additions & 1 deletion axum/src/extract/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 1 addition & 3 deletions axum/src/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -134,7 +133,7 @@ macro_rules! composite_rejection {
#[non_exhaustive]
pub enum $name {
$(
#[allow(missing_docs, deprecated)]
#[allow(missing_docs)]
$variant($variant)
),+
}
Expand All @@ -150,7 +149,6 @@ macro_rules! composite_rejection {
}

$(
#[allow(deprecated)]
impl From<$variant> for $name {
fn from(inner: $variant) -> Self {
Self::$variant(inner)
Expand Down
21 changes: 0 additions & 21 deletions axum/src/response/redirect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
//
Expand Down

0 comments on commit 0d05b5e

Please sign in to comment.