mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-29 21:34:57 +00:00
Add #[automatically_derived]
to derived impls (#8080)
This commit is contained in:
parent
256b98ab9a
commit
a525f09008
5 changed files with 6 additions and 0 deletions
|
@ -101,6 +101,7 @@ pub(crate) fn derive_cache_key(item: &DeriveInput) -> syn::Result<TokenStream> {
|
||||||
let (impl_generics, ty_generics, where_clause) = &item.generics.split_for_impl();
|
let (impl_generics, ty_generics, where_clause) = &item.generics.split_for_impl();
|
||||||
|
|
||||||
Ok(quote!(
|
Ok(quote!(
|
||||||
|
#[automatically_derived]
|
||||||
impl #impl_generics ruff_cache::CacheKey for #name #ty_generics #where_clause {
|
impl #impl_generics ruff_cache::CacheKey for #name #ty_generics #where_clause {
|
||||||
fn cache_key(&self, key: &mut ruff_cache::CacheKeyHasher) {
|
fn cache_key(&self, key: &mut ruff_cache::CacheKeyHasher) {
|
||||||
use std::hash::Hasher;
|
use std::hash::Hasher;
|
||||||
|
|
|
@ -16,6 +16,7 @@ pub(crate) fn derive_impl(input: DeriveInput) -> syn::Result<proc_macro2::TokenS
|
||||||
.collect::<Result<Vec<_>, _>>()?;
|
.collect::<Result<Vec<_>, _>>()?;
|
||||||
|
|
||||||
Ok(quote! {
|
Ok(quote! {
|
||||||
|
#[automatically_derived]
|
||||||
impl crate::configuration::CombinePluginOptions for #ident {
|
impl crate::configuration::CombinePluginOptions for #ident {
|
||||||
fn combine(self, other: Self) -> Self {
|
fn combine(self, other: Self) -> Self {
|
||||||
#[allow(deprecated)]
|
#[allow(deprecated)]
|
||||||
|
|
|
@ -87,6 +87,7 @@ pub(crate) fn derive_impl(input: DeriveInput) -> syn::Result<TokenStream> {
|
||||||
};
|
};
|
||||||
|
|
||||||
Ok(quote! {
|
Ok(quote! {
|
||||||
|
#[automatically_derived]
|
||||||
impl crate::options_base::OptionsMetadata for #ident {
|
impl crate::options_base::OptionsMetadata for #ident {
|
||||||
fn record(visit: &mut dyn crate::options_base::Visit) {
|
fn record(visit: &mut dyn crate::options_base::Visit) {
|
||||||
#(#output);*
|
#(#output);*
|
||||||
|
|
|
@ -111,6 +111,7 @@ pub(crate) fn derive_impl(input: DeriveInput) -> syn::Result<proc_macro2::TokenS
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(quote! {
|
Ok(quote! {
|
||||||
|
#[automatically_derived]
|
||||||
impl crate::registry::RuleNamespace for #ident {
|
impl crate::registry::RuleNamespace for #ident {
|
||||||
fn parse_code(code: &str) -> Option<(Self, &str)> {
|
fn parse_code(code: &str) -> Option<(Self, &str)> {
|
||||||
#if_statements
|
#if_statements
|
||||||
|
|
|
@ -53,6 +53,7 @@ pub(crate) fn violation(violation: &ItemStruct) -> Result<TokenStream> {
|
||||||
#[derive(Debug, PartialEq, Eq)]
|
#[derive(Debug, PartialEq, Eq)]
|
||||||
#violation
|
#violation
|
||||||
|
|
||||||
|
#[automatically_derived]
|
||||||
impl From<#ident> for ruff_diagnostics::DiagnosticKind {
|
impl From<#ident> for ruff_diagnostics::DiagnosticKind {
|
||||||
fn from(value: #ident) -> Self {
|
fn from(value: #ident) -> Self {
|
||||||
use ruff_diagnostics::Violation;
|
use ruff_diagnostics::Violation;
|
||||||
|
@ -76,6 +77,7 @@ pub(crate) fn violation(violation: &ItemStruct) -> Result<TokenStream> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[automatically_derived]
|
||||||
impl From<#ident> for ruff_diagnostics::DiagnosticKind {
|
impl From<#ident> for ruff_diagnostics::DiagnosticKind {
|
||||||
fn from(value: #ident) -> Self {
|
fn from(value: #ident) -> Self {
|
||||||
use ruff_diagnostics::Violation;
|
use ruff_diagnostics::Violation;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue