tidy the generated code a bit

This commit is contained in:
Joe Ardent 2023-06-13 16:15:47 -07:00
parent 46f52ff7ee
commit 62955548bb

View file

@ -19,19 +19,19 @@ pub fn derive_optional_optional_user(input: TokenStream) -> TokenStream {
})
.is_some();
let has_option = if has_user {
let user_is_option_user = if has_user {
quote!(
::std::any::TypeId::of::<::std::option::Option<crate::User>>() == self.user.type_id()
&&::std::any::TypeId::of::<::std::option::Option<crate::User>>() == self.user.type_id()
)
} else {
quote!(false)
quote!()
};
let output = quote!(
impl crate::templates::OptionalOptionalUser for #name {
fn has_optional_user(&self) -> bool {
use ::std::any::Any;
#has_user && #has_option
#has_user #user_is_option_user
}
}
);