fix: unwrap inner type

This commit is contained in:
naskya 2024-07-16 02:25:36 +09:00
parent da3a53c92f
commit 234bb59d06
Signed by: naskya
GPG key ID: 712D413B3A9FED5C

View file

@ -137,7 +137,14 @@ fn derive_impl(input: syn::DeriveInput) -> syn::Result<TokenStream> {
if field.attrs.iter().any(|attr| attr.path().is_ident("relax")) {
// nested
Ok(quote! { #vis #name: ::std::option::Option<<#ty as Relax>::Partial> })
match get_generic_ty("Option", ty) {
Some(ty) => {
Ok(quote! { #vis #name: ::std::option::Option<<#ty as Relax>::Partial> })
}
None => {
Ok(quote! { #vis #name: ::std::option::Option<<#ty as Relax>::Partial> })
}
}
} else {
// not nested
match get_generic_ty("Option", ty) {