mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-29 00:49:42 +08:00
fix(router_derive): Use #[automatically_derived] for all derivations (#133)
This commit is contained in:
@ -176,6 +176,7 @@ pub fn setter(input: proc_macro::TokenStream) -> proc_macro::TokenStream {
|
||||
}
|
||||
});
|
||||
let output = quote::quote! {
|
||||
#[automatically_derived]
|
||||
impl #ident {
|
||||
#(#build_methods)*
|
||||
}
|
||||
|
||||
@ -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))
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
{
|
||||
|
||||
@ -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)*
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user