Skip to content

Commit 8d006bc

Browse files
authored
Fix: Refactor to avoid clippy::needless_for_each warning in derive(OpenApi) (#1423)
By refactoring the macro to generate a for loop instead of using for_each, we now produce code that is cleaner and no longer triggers this clippy warning.
1 parent cdff007 commit 8d006bc

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

utoipa-gen/src/openapi.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -550,7 +550,9 @@ impl ToTokensDiagnostics for OpenApi<'_> {
550550

551551
quote! {
552552
let _mods: [&dyn utoipa::Modify; #modifiers_len] = [#modifiers];
553-
_mods.iter().for_each(|modifier| modifier.modify(&mut openapi));
553+
for modifier in &_mods {
554+
modifier.modify(&mut openapi);
555+
}
554556
}
555557
});
556558

0 commit comments

Comments
 (0)