From ae1f47e3e5d6705b6b12997bd036fd97303d71d7 Mon Sep 17 00:00:00 2001 From: oxalica Date: Sun, 22 Sep 2024 11:24:53 -0400 Subject: [PATCH] Mark #[automatically_derived] for generated impls --- impl/src/expand.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/impl/src/expand.rs b/impl/src/expand.rs index 296b567..403cd07 100644 --- a/impl/src/expand.rs +++ b/impl/src/expand.rs @@ -36,6 +36,7 @@ fn fallback(input: &DeriveInput, error: syn::Error) -> TokenStream { #error #[allow(unused_qualifications)] + #[automatically_derived] impl #impl_generics std::error::Error for #ty #ty_generics #where_clause where // Work around trivial bounds being unstable. @@ -44,6 +45,7 @@ fn fallback(input: &DeriveInput, error: syn::Error) -> TokenStream { {} #[allow(unused_qualifications)] + #[automatically_derived] impl #impl_generics ::core::fmt::Display for #ty #ty_generics #where_clause { fn fmt(&self, __formatter: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { ::core::unreachable!() @@ -178,6 +180,7 @@ fn impl_struct(input: Struct) -> TokenStream { let display_where_clause = display_inferred_bounds.augment_where_clause(input.generics); quote! { #[allow(unused_qualifications)] + #[automatically_derived] impl #impl_generics ::core::fmt::Display for #ty #ty_generics #display_where_clause { #[allow(clippy::used_underscore_binding)] fn fmt(&self, __formatter: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { @@ -193,6 +196,7 @@ fn impl_struct(input: Struct) -> TokenStream { let body = from_initializer(from_field, backtrace_field); quote! { #[allow(unused_qualifications)] + #[automatically_derived] impl #impl_generics ::core::convert::From<#from> for #ty #ty_generics #where_clause { #[allow(deprecated)] fn from(source: #from) -> Self { @@ -211,6 +215,7 @@ fn impl_struct(input: Struct) -> TokenStream { quote! { #[allow(unused_qualifications)] + #[automatically_derived] impl #impl_generics std::error::Error for #ty #ty_generics #error_where_clause { #source_method #provide_method @@ -427,6 +432,7 @@ fn impl_enum(input: Enum) -> TokenStream { let display_where_clause = display_inferred_bounds.augment_where_clause(input.generics); Some(quote! { #[allow(unused_qualifications)] + #[automatically_derived] impl #impl_generics ::core::fmt::Display for #ty #ty_generics #display_where_clause { fn fmt(&self, __formatter: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { #use_as_display @@ -449,6 +455,7 @@ fn impl_enum(input: Enum) -> TokenStream { let body = from_initializer(from_field, backtrace_field); Some(quote! { #[allow(unused_qualifications)] + #[automatically_derived] impl #impl_generics ::core::convert::From<#from> for #ty #ty_generics #where_clause { #[allow(deprecated)] fn from(source: #from) -> Self { @@ -467,6 +474,7 @@ fn impl_enum(input: Enum) -> TokenStream { quote! { #[allow(unused_qualifications)] + #[automatically_derived] impl #impl_generics std::error::Error for #ty #ty_generics #error_where_clause { #source_method #provide_method