mirror of
https://github.com/tokio-rs/axum.git
synced 2024-12-29 07:48:39 +01:00
axum-core/macros: Change Display
impl to match body_text()
result (#3118)
This commit is contained in:
parent
287bd14711
commit
53370b24e7
2 changed files with 11 additions and 3 deletions
|
@ -9,6 +9,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
|
||||
# 0.5.0
|
||||
|
||||
- **change:** The `Display` impl of all rejections generated by the
|
||||
`define_rejection!()` will now include the `Display` output of the
|
||||
inner error too. This matches the `body_text()` fn output now. ([#3118])
|
||||
|
||||
[#3118]: https://github.com/tokio-rs/axum/pull/3118
|
||||
|
||||
## rc.1
|
||||
|
||||
- **breaking:**: `Option<T>` as an extractor now requires `T` to implement the
|
||||
|
|
|
@ -50,7 +50,7 @@ macro_rules! __define_rejection {
|
|||
impl $name {
|
||||
/// Get the response body text used for this rejection.
|
||||
pub fn body_text(&self) -> String {
|
||||
$body.into()
|
||||
self.to_string()
|
||||
}
|
||||
|
||||
/// Get the status code used for this rejection.
|
||||
|
@ -107,7 +107,7 @@ macro_rules! __define_rejection {
|
|||
|
||||
/// Get the response body text used for this rejection.
|
||||
pub fn body_text(&self) -> String {
|
||||
format!(concat!($body, ": {}"), self.0).into()
|
||||
self.to_string()
|
||||
}
|
||||
|
||||
/// Get the status code used for this rejection.
|
||||
|
@ -132,7 +132,9 @@ macro_rules! __define_rejection {
|
|||
|
||||
impl std::fmt::Display for $name {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
write!(f, "{}", $body)
|
||||
f.write_str($body)?;
|
||||
f.write_str(": ")?;
|
||||
self.0.fmt(f)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue