Remove useless code.
This commit is contained in:
parent
c914622ff0
commit
f4c4955fc4
|
@ -1,5 +1,5 @@
|
||||||
use crate::args;
|
use crate::args;
|
||||||
use crate::utils::{get_cfg_attrs, get_crate_name, get_rustdoc};
|
use crate::utils::{get_crate_name, get_rustdoc};
|
||||||
use inflector::Inflector;
|
use inflector::Inflector;
|
||||||
use proc_macro::TokenStream;
|
use proc_macro::TokenStream;
|
||||||
use quote::quote;
|
use quote::quote;
|
||||||
|
@ -54,7 +54,7 @@ pub fn generate(enum_args: &args::Enum, input: &DeriveInput) -> Result<TokenStre
|
||||||
.as_ref()
|
.as_ref()
|
||||||
.map(|s| quote! { Some(#s) })
|
.map(|s| quote! { Some(#s) })
|
||||||
.unwrap_or_else(|| quote! {None});
|
.unwrap_or_else(|| quote! {None});
|
||||||
enum_items.push((get_cfg_attrs(&variant.attrs), item_ident));
|
enum_items.push(item_ident);
|
||||||
items.push(quote! {
|
items.push(quote! {
|
||||||
#crate_name::resolver_utils::EnumItem {
|
#crate_name::resolver_utils::EnumItem {
|
||||||
name: #gql_item_name,
|
name: #gql_item_name,
|
||||||
|
@ -80,15 +80,13 @@ pub fn generate(enum_args: &args::Enum, input: &DeriveInput) -> Result<TokenStre
|
||||||
));
|
));
|
||||||
};
|
};
|
||||||
|
|
||||||
let local_to_remote_items = enum_items.iter().map(|(cfg_attrs, item)| {
|
let local_to_remote_items = enum_items.iter().map(|item| {
|
||||||
quote! {
|
quote! {
|
||||||
#(#cfg_attrs)*
|
|
||||||
#ident::#item => #remote_ty::#item,
|
#ident::#item => #remote_ty::#item,
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
let remote_to_local_items = enum_items.iter().map(|(cfg_attrs, item)| {
|
let remote_to_local_items = enum_items.iter().map(|item| {
|
||||||
quote! {
|
quote! {
|
||||||
#(#cfg_attrs)*
|
|
||||||
#remote_ty::#item => #ident::#item,
|
#remote_ty::#item => #ident::#item,
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -60,6 +60,7 @@ pub fn generate(object_args: &args::InputObject, input: &DeriveInput) -> Result<
|
||||||
flatten_fields.push((ident, ty));
|
flatten_fields.push((ident, ty));
|
||||||
|
|
||||||
schema_fields.push(quote! {
|
schema_fields.push(quote! {
|
||||||
|
#crate_name::static_assertions::assert_impl_one!(#ty: #crate_name::type_mark::TypeMarkInputObject);
|
||||||
#ty::create_type_info(registry);
|
#ty::create_type_info(registry);
|
||||||
if let Some(#crate_name::registry::MetaType::InputObject{ input_fields, .. }) =
|
if let Some(#crate_name::registry::MetaType::InputObject{ input_fields, .. }) =
|
||||||
registry.types.remove(&*<#ty as #crate_name::Type>::type_name()) {
|
registry.types.remove(&*<#ty as #crate_name::Type>::type_name()) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user