Skip to content

Commit

Permalink
Fix lint about using format!() in an iterator chain that `collect()…
Browse files Browse the repository at this point in the history
…`s into a `String`
  • Loading branch information
Arnavion committed Aug 24, 2023
1 parent 0cc4dce commit 6ab1cb9
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions k8s-openapi-codegen-common/src/templates/type_header.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,14 @@ pub(crate) fn generate(
derives: Option<Derives>,
vis: &str,
) -> Result<(), crate::Error> {
let type_comment: String =
let type_comment =
type_comment
.map(|type_comment| crate::get_comment_text(type_comment, "").map(|line| format!("///{line}\n")).collect())
.map(|type_comment| crate::get_comment_text(type_comment, "").fold(String::new(), |mut result, line| {
result.push_str("///");
result.push_str(&line);
result.push('\n');
result
}))
.unwrap_or_default();

let type_feature_attribute =
Expand Down

0 comments on commit 6ab1cb9

Please sign in to comment.