Skip to content

Commit

Permalink
derive: Use #[automatically_derived] on generated impls (#136)
Browse files Browse the repository at this point in the history
  • Loading branch information
taiki-e authored Dec 21, 2024
1 parent 0bdc416 commit aa89db6
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions valuable-derive/src/expand.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ fn derive_struct(
);
let access = respan(quote! { &self.#access }, &field.ty);
let valuable_impl = quote! {
#[automatically_derived]
impl #impl_generics ::valuable::Valuable for #name #ty_generics #where_clause {
fn as_value(&self) -> ::valuable::Value<'_> {
::valuable::Valuable::as_value(#access)
Expand Down Expand Up @@ -151,6 +152,7 @@ fn derive_struct(
}

let structable_impl = quote! {
#[automatically_derived]
impl #impl_generics ::valuable::Structable for #name #ty_generics #where_clause {
fn definition(&self) -> ::valuable::StructDef<'_> {
#struct_def
Expand All @@ -159,6 +161,7 @@ fn derive_struct(
};

let valuable_impl = quote! {
#[automatically_derived]
impl #impl_generics ::valuable::Valuable for #name #ty_generics #where_clause {
fn as_value(&self) -> ::valuable::Value<'_> {
::valuable::Value::Structable(self)
Expand Down Expand Up @@ -349,6 +352,7 @@ fn derive_enum(cx: Context, input: &syn::DeriveInput, data: &syn::DataEnum) -> R

let (impl_generics, ty_generics, where_clause) = input.generics.split_for_impl();
let enumerable_impl = quote! {
#[automatically_derived]
impl #impl_generics ::valuable::Enumerable for #name #ty_generics #where_clause {
fn definition(&self) -> ::valuable::EnumDef<'_> {
::valuable::EnumDef::new_static(
Expand All @@ -366,6 +370,7 @@ fn derive_enum(cx: Context, input: &syn::DeriveInput, data: &syn::DataEnum) -> R
};

let valuable_impl = quote! {
#[automatically_derived]
impl #impl_generics ::valuable::Valuable for #name #ty_generics #where_clause {
fn as_value(&self) -> ::valuable::Value<'_> {
::valuable::Value::Enumerable(self)
Expand Down

0 comments on commit aa89db6

Please sign in to comment.