tidy the generated code a bit
This commit is contained in:
parent
46f52ff7ee
commit
62955548bb
1 changed files with 4 additions and 4 deletions
|
@ -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
|
||||
}
|
||||
}
|
||||
);
|
||||
|
|
Loading…
Reference in a new issue