fix(router_derive): Use #[automatically_derived] for all derivations (#133)

This commit is contained in:
kos-for-juspay
2022-12-13 14:53:19 +01:00
committed by GitHub
parent b90009868c
commit 3655c8de82
5 changed files with 9 additions and 0 deletions

View File

@ -176,6 +176,7 @@ pub fn setter(input: proc_macro::TokenStream) -> proc_macro::TokenStream {
}
});
let output = quote::quote! {
#[automatically_derived]
impl #ident {
#(#build_methods)*
}

View File

@ -18,6 +18,7 @@ pub(crate) fn debug_as_display_inner(ast: &DeriveInput) -> syn::Result<TokenStre
let (impl_generics, ty_generics, where_clause) = ast.generics.split_for_impl();
Ok(quote! {
#[automatically_derived]
impl #impl_generics ::core::fmt::Display for #name #ty_generics #where_clause {
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::result::Result<(), ::core::fmt::Error> {
f.write_str(&format!("{:?}", self))

View File

@ -47,8 +47,10 @@ pub(crate) fn api_error_derive_inner(ast: &DeriveInput) -> syn::Result<TokenStre
);
Ok(quote! {
#[automatically_derived]
impl #impl_generics std::error::Error for #name #ty_generics #where_clause {}
#[automatically_derived]
impl #impl_generics #name #ty_generics #where_clause {
#error_type_fn
#error_code_fn
@ -226,6 +228,7 @@ fn implement_serialize(
});
}
quote! {
#[automatically_derived]
impl #impl_generics serde::Serialize for #enum_name #ty_generics #where_clause {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where

View File

@ -20,6 +20,7 @@ pub(crate) fn diesel_enum_derive_inner(ast: &DeriveInput) -> syn::Result<TokenSt
#[diesel(postgres_type(name = #type_name))]
pub struct #struct_name;
#[automatically_derived]
impl #impl_generics ::diesel::serialize::ToSql<#struct_name, ::diesel::pg::Pg> for #name #ty_generics
#where_clause
{
@ -31,6 +32,7 @@ pub(crate) fn diesel_enum_derive_inner(ast: &DeriveInput) -> syn::Result<TokenSt
}
}
#[automatically_derived]
impl #impl_generics ::diesel::deserialize::FromSql<#struct_name, ::diesel::pg::Pg> for #name #ty_generics
#where_clause
{

View File

@ -50,6 +50,7 @@ impl Derives {
) -> TokenStream {
let req_type = Conversion::get_req_type(self);
quote! {
#[automatically_derived]
impl<F:Send+Clone> Operation<F,#req_type> for #struct_name {
#(#fns)*
}
@ -63,6 +64,7 @@ impl Derives {
) -> TokenStream {
let req_type = Conversion::get_req_type(self);
quote! {
#[automatically_derived]
impl<F:Send+Clone> Operation<F,#req_type> for &#struct_name {
#(#ref_fns)*
}