Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Rust] [Axum] Fix clippy warning: to_string_trait_impl #17995

Merged
merged 2 commits into from
Mar 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -387,9 +387,9 @@ impl std::convert::From<{{{dataType}}}> for {{{classname}}} {
}
{{#vendorExtensions.x-is-string}}

impl std::string::ToString for {{{classname}}} {
fn to_string(&self) -> String {
self.0.to_string()
impl std::fmt::Display for {{{classname}}} {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "{:?}", self.0)
}
}

Expand Down Expand Up @@ -424,10 +424,10 @@ impl std::ops::DerefMut for {{{classname}}} {
/// Converts the {{{classname}}} value to the Query Parameters representation (style=form, explode=false)
/// specified in https://swagger.io/docs/specification/serialization/
/// Should be implemented in a serde serializer
impl ::std::string::ToString for {{{classname}}} {
fn to_string(&self) -> String {
impl std::fmt::Display for {{{classname}}} {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
// Skipping additionalProperties in query parameter serialization
"".to_string()
write!(f, "")
}
}

Expand Down Expand Up @@ -517,9 +517,9 @@ impl std::ops::DerefMut for {{{classname}}} {
/// Converts the {{{classname}}} value to the Query Parameters representation (style=form, explode=false)
/// specified in https://swagger.io/docs/specification/serialization/
/// Should be implemented in a serde serializer
impl std::string::ToString for {{{classname}}} {
fn to_string(&self) -> String {
self.iter().map(|x| x.to_string()).collect::<Vec<_>>().join(",")
impl std::fmt::Display for {{{classname}}} {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "{}", self.iter().map(|x| x.to_string()).collect::<Vec<_>>().join(","))
}
}

Expand Down Expand Up @@ -726,8 +726,8 @@ impl {{{classname}}} {
/// Converts the {{{classname}}} value to the Query Parameters representation (style=form, explode=false)
/// specified in https://swagger.io/docs/specification/serialization/
/// Should be implemented in a serde serializer
impl std::string::ToString for {{{classname}}} {
fn to_string(&self) -> String {
impl std::fmt::Display for {{{classname}}} {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
let params: Vec<Option<String>> = vec![
{{#vars}}
{{#isByteArray}}
Expand Down Expand Up @@ -789,7 +789,7 @@ impl std::string::ToString for {{{classname}}} {
{{/vars}}
];

params.into_iter().flatten().collect::<Vec<_>>().join(",")
write!(f, "{}", params.into_iter().flatten().collect::<Vec<_>>().join(","))
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
7.3.0-SNAPSHOT
7.4.0-SNAPSHOT
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ impl MultipartRelatedRequest {
/// Converts the MultipartRelatedRequest value to the Query Parameters representation (style=form, explode=false)
/// specified in https://swagger.io/docs/specification/serialization/
/// Should be implemented in a serde serializer
impl std::string::ToString for MultipartRelatedRequest {
fn to_string(&self) -> String {
impl std::fmt::Display for MultipartRelatedRequest {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
let params: Vec<Option<String>> = vec![
// Skipping object_field in query parameter serialization

Expand All @@ -49,7 +49,11 @@ impl std::string::ToString for MultipartRelatedRequest {

];

params.into_iter().flatten().collect::<Vec<_>>().join(",")
write!(
f,
"{}",
params.into_iter().flatten().collect::<Vec<_>>().join(",")
)
}
}

Expand Down Expand Up @@ -184,8 +188,8 @@ impl MultipartRequestObjectField {
/// Converts the MultipartRequestObjectField value to the Query Parameters representation (style=form, explode=false)
/// specified in https://swagger.io/docs/specification/serialization/
/// Should be implemented in a serde serializer
impl std::string::ToString for MultipartRequestObjectField {
fn to_string(&self) -> String {
impl std::fmt::Display for MultipartRequestObjectField {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
let params: Vec<Option<String>> = vec![
Some("field_a".to_string()),
Some(self.field_a.to_string()),
Expand All @@ -202,7 +206,11 @@ impl std::string::ToString for MultipartRequestObjectField {
}),
];

params.into_iter().flatten().collect::<Vec<_>>().join(",")
write!(
f,
"{}",
params.into_iter().flatten().collect::<Vec<_>>().join(",")
)
}
}

Expand Down Expand Up @@ -333,8 +341,8 @@ impl MultipleIdenticalMimeTypesPostRequest {
/// Converts the MultipleIdenticalMimeTypesPostRequest value to the Query Parameters representation (style=form, explode=false)
/// specified in https://swagger.io/docs/specification/serialization/
/// Should be implemented in a serde serializer
impl std::string::ToString for MultipleIdenticalMimeTypesPostRequest {
fn to_string(&self) -> String {
impl std::fmt::Display for MultipleIdenticalMimeTypesPostRequest {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
let params: Vec<Option<String>> = vec![
// Skipping binary1 in query parameter serialization
// Skipping binary1 in query parameter serialization
Expand All @@ -344,7 +352,11 @@ impl std::string::ToString for MultipleIdenticalMimeTypesPostRequest {

];

params.into_iter().flatten().collect::<Vec<_>>().join(",")
write!(
f,
"{}",
params.into_iter().flatten().collect::<Vec<_>>().join(",")
)
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
7.3.0-SNAPSHOT
7.4.0-SNAPSHOT
Loading
Loading