From feb6c4b2fec86f8ac2afd973a3b3a2d6f51135f2 Mon Sep 17 00:00:00 2001 From: Graham Esau Date: Sun, 15 May 2022 22:19:52 +0100 Subject: [PATCH] Use `as` instead of immediately-invoked typed function --- schemars_derive/src/schema_exprs.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/schemars_derive/src/schema_exprs.rs b/schemars_derive/src/schema_exprs.rs index 6efa9b8..f41e37a 100644 --- a/schemars_derive/src/schema_exprs.rs +++ b/schemars_derive/src/schema_exprs.rs @@ -581,7 +581,7 @@ fn field_default_expr(field: &Field, container_has_default: bool) -> Option quote!(<#ty>::default()), - SerdeDefault::Path(path) => quote!(|| -> #ty { #path() }()), + SerdeDefault::Path(path) => quote!({ #path() as #ty }), }; let default_expr = match field.serde_attrs.skip_serializing_if() {