[numpy] deprecated type aliases (#2810)

Closes https://github.com/charliermarsh/ruff/issues/2455

Used `NPY` as prefix code as agreed in the issue.
This commit is contained in:
Simon Brugman 2023-02-15 00:45:12 +01:00 committed by GitHub
parent c0eb5c28d1
commit ac028cd9f8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 344 additions and 9 deletions

View file

@ -15,8 +15,9 @@ pub fn derive_impl(input: DeriveInput) -> syn::Result<proc_macro2::TokenStream>
let mut parsed = Vec::new();
let mut common_prefix_match_arms = quote!();
let mut name_match_arms = quote!(Self::Ruff => "Ruff-specific rules",);
let mut url_match_arms = quote!(Self::Ruff => None,);
let mut name_match_arms =
quote!(Self::Ruff => "Ruff-specific rules", Self::Numpy => "NumPy-specific rules", );
let mut url_match_arms = quote!(Self::Ruff => None, Self::Numpy => None, );
let mut all_prefixes = HashSet::new();
@ -58,7 +59,7 @@ pub fn derive_impl(input: DeriveInput) -> syn::Result<proc_macro2::TokenStream>
let variant_ident = variant.ident;
if variant_ident != "Ruff" {
if variant_ident != "Ruff" && variant_ident != "Numpy" {
let (name, url) = parse_doc_attr(doc_attr)?;
name_match_arms.extend(quote! {Self::#variant_ident => #name,});
url_match_arms.extend(quote! {Self::#variant_ident => Some(#url),});