fix: use underlying_ty for default nested type name
This commit is contained in:
parent
76358fc961
commit
af6e8d5e6e
1 changed files with 3 additions and 3 deletions
|
@ -28,7 +28,7 @@ pub(crate) fn struct_fields_info<'a>(
|
|||
.map(|field| {
|
||||
let inner_ty = get_generic_ty("Option", &field.ty);
|
||||
let attr = helper_attr(&field.attrs, helper);
|
||||
let ty = &field.ty;
|
||||
let underlying_ty = inner_ty.unwrap_or(&field.ty);
|
||||
|
||||
FieldInfo {
|
||||
ident: field.ident.as_ref(),
|
||||
|
@ -41,10 +41,10 @@ pub(crate) fn struct_fields_info<'a>(
|
|||
panic!("usage of `opt` attribute is incorrect (unknown key is present)");
|
||||
}
|
||||
path
|
||||
}).unwrap_or(syn::Ident::new(&format!("{}Opt", quote::quote!(#ty)), field.span()).into())
|
||||
}).unwrap_or(syn::Ident::new(&format!("{}Opt", quote::quote!(#underlying_ty)), field.span()).into())
|
||||
}),
|
||||
is_option: inner_ty.is_some(),
|
||||
underlying_ty: inner_ty.unwrap_or(&field.ty),
|
||||
underlying_ty,
|
||||
}
|
||||
})
|
||||
.collect()
|
||||
|
|
Loading…
Reference in a new issue