mirror of
https://github.com/tokio-rs/axum.git
synced 2025-03-08 08:56:24 +01:00
Silence "unnecessary use of to_string
" lint for #[derive(TypedPath)]
(#1117)
* Fix "unnecessary use of `to_string`" lint for `#[derive(TypedPath)]` * changelog * Update axum-macros/CHANGELOG.md
This commit is contained in:
parent
f6b1d35c51
commit
11179b8033
2 changed files with 16 additions and 2 deletions
|
@ -8,8 +8,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
# Unreleased
|
||||
|
||||
- **change:** axum's MSRV is now 1.56 ([#1098])
|
||||
- **fixed:** Silence "unnecessary use of `to_string`" lint for `#[derive(TypedPath)]` ([#1117])
|
||||
|
||||
[#1098]: https://github.com/tokio-rs/axum/pull/1098
|
||||
[#1117]: https://github.com/tokio-rs/axum/pull/1117
|
||||
|
||||
# 0.2.2 (18. May, 2022)
|
||||
|
||||
|
|
|
@ -104,12 +104,18 @@ fn expand_named_fields(
|
|||
let display_impl = quote_spanned! {path.span()=>
|
||||
#[automatically_derived]
|
||||
impl ::std::fmt::Display for #ident {
|
||||
#[allow(clippy::unnecessary_to_owned)]
|
||||
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
|
||||
let Self { #(#captures,)* } = self;
|
||||
write!(
|
||||
f,
|
||||
#format_str,
|
||||
#(#captures = ::axum_extra::__private::utf8_percent_encode(&#captures.to_string(), ::axum_extra::__private::PATH_SEGMENT)),*
|
||||
#(
|
||||
#captures = ::axum_extra::__private::utf8_percent_encode(
|
||||
&#captures.to_string(),
|
||||
::axum_extra::__private::PATH_SEGMENT,
|
||||
)
|
||||
),*
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -200,12 +206,18 @@ fn expand_unnamed_fields(
|
|||
let display_impl = quote_spanned! {path.span()=>
|
||||
#[automatically_derived]
|
||||
impl ::std::fmt::Display for #ident {
|
||||
#[allow(clippy::unnecessary_to_owned)]
|
||||
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
|
||||
let Self { #(#destructure_self)* } = self;
|
||||
write!(
|
||||
f,
|
||||
#format_str,
|
||||
#(#captures = ::axum_extra::__private::utf8_percent_encode(&#captures.to_string(), ::axum_extra::__private::PATH_SEGMENT)),*
|
||||
#(
|
||||
#captures = ::axum_extra::__private::utf8_percent_encode(
|
||||
&#captures.to_string(),
|
||||
::axum_extra::__private::PATH_SEGMENT,
|
||||
)
|
||||
),*
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue