Fix default with optional props (#4995)

* fix default with optional props

* fix core macro tests
This commit is contained in:
Evan Almloff authored and GitHub committed 2025-11-19 12:33:49 -08:00
1 parent 6e952f27a7
commit 6df20ef3f7
2 files changed
+6 -5

No files matched your search

+4 -3
View File
@@ -238,9 +238,10 @@ mod field_info {
|| !builder_attr.ignore_option && type_from_inside_option(&field.ty).is_some();
if !builder_attr.strip_option && strip_option_auto {
builder_attr.strip_option = true;
builder_attr.default = Some(
syn::parse(quote!(::core::default::Default::default()).into()).unwrap(),
);
// only change the default if it isn't manually set above
builder_attr.default.get_or_insert_with(|| {
syn::parse(quote!(::core::default::Default::default()).into()).unwrap()
});
}
Ok(FieldInfo {