Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

suppress quick fixes for output of derive macros #9791

Open
programmerjake opened this issue Aug 5, 2021 · 1 comment
Open

suppress quick fixes for output of derive macros #9791

programmerjake opened this issue Aug 5, 2021 · 1 comment
Labels
A-diagnostics diagnostics / error reporting

Comments

@programmerjake
Copy link
Member

I have a derive macro that generates new types based off the variant names of an enum, so for the enum:

pub enum Enum1 {
    A,
}

it generates code like so:

    #[allow(non_snake_case)]
    #[allow(non_camel_case_types)]
    #[allow(non_upper_case_globals)]
    mod __Enum1__impl_Value {
        #![no_implicit_prelude]
        use super::*;
        const __Enum1_A_discriminant__: isize = 0;
        // ...
        pub struct __Enum1_A_field_values__<'ctx>(
            pub ::core::marker::PhantomData<(Enum1, &'ctx ())>,
        );
        // ...
        pub struct __StructOfVariantValues<'ctx> {
            pub A: __Enum1_A_field_values__<'ctx>,
            pub __aggregate_phantom: ::core::marker::PhantomData<(Enum1, &'ctx ())>,
        }
        // ...
    }

This causes rust-analyzer to generate a bunch of incorrect quick fixes like:

Structure `__Enum1_A_field_values__` should have CamelCase name, e.g. `Enum1AFieldValues` rust-analyzer(incorrect-ident-case)

and:

Field `A` should have snake_case name, e.g. `a` rust-analyzer(incorrect-ident-case)
@lnicola
Copy link
Member

lnicola commented Sep 10, 2021

Probably a duplicate of #8747.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics diagnostics / error reporting
Projects
None yet
Development

No branches or pull requests

2 participants