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 clippy::exhaustive_enums on generated enums #112

Closed
xFrednet opened this issue Sep 17, 2023 · 0 comments
Closed

Suppress clippy::exhaustive_enums on generated enums #112

xFrednet opened this issue Sep 17, 2023 · 0 comments

Comments

@xFrednet
Copy link

Clippy struggles a bit with code generated by derive macros. It currently detects some enum generated by #[derive(TypedBuilder)], if clippy::exhaustive_enums is enabled.

Reproducer:

#![warn(clippy::exhaustive_enums)]

use typed_builder::TypedBuilder;

#[derive(TypedBuilder)]
pub struct Bar {
    pub a: i32,
    pub b: String,
}

Now run cargo clippy

Fix

The easiest fix would probably be to generate a #[allow(clippy::exhaustive_enums)] above the enum. That would simply suppress the lint for this specific enum. For my use case, it's totally fine, that the enum is non_exhaustive.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant