Suppress deprecation warning on generated From impls

This commit is contained in:
David Tolnay 2024-12-08 10:37:43 -08:00
parent caf585c978
commit 6e8c7244c9
No known key found for this signature in database
GPG key ID: F9BA143B95FF6D82

View file

@ -170,10 +170,9 @@ fn impl_struct(input: Struct) -> TokenStream {
let source_var = Ident::new("source", span);
let body = from_initializer(from_field, backtrace_field, &source_var);
quote_spanned! {span=>
#[allow(unused_qualifications, clippy::needless_lifetimes)]
#[allow(deprecated, unused_qualifications, clippy::needless_lifetimes)]
#[automatically_derived]
impl #impl_generics ::core::convert::From<#from> for #ty #ty_generics #where_clause {
#[allow(deprecated)]
fn from(#source_var: #from) -> Self {
#ty #body
}
@ -435,10 +434,9 @@ fn impl_enum(input: Enum) -> TokenStream {
let source_var = Ident::new("source", span);
let body = from_initializer(from_field, backtrace_field, &source_var);
Some(quote_spanned! {span=>
#[allow(unused_qualifications, clippy::needless_lifetimes)]
#[allow(deprecated, unused_qualifications, clippy::needless_lifetimes)]
#[automatically_derived]
impl #impl_generics ::core::convert::From<#from> for #ty #ty_generics #where_clause {
#[allow(deprecated)]
fn from(#source_var: #from) -> Self {
#ty::#variant #body
}