rust-lang / rust-lang/rust-clippy

Imply #[allow(clippy::some_categories)] when #[automatically_derived] is encountered

Open
#5,795 1 comment 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

C-an-interesting-project C-enhancement E-medium
Dominant language
Rust
Stars
13.5k
Forks
2.2k
Avg merge
2d 10h
Merged PRs (30d)
32

Description

The #[automatically_derived] attribute is used by builtin rustc derives to indicate that the code inside the impl is autogenerated and suppress some categories of warnings, like dead code and unused variables. Furthermore, some derive macros also annotate the generated code with this attribute, like serde_derive.

I think it would be nice for this attribute to also suppress some groups of clippy warnings, namely restriction, style, pedantic, complexity, and maybe nursery.

I believe this would be better than asking derives to apply #[allow(clippy::all)] because clippy::all implies correctness and perf, but those lints are useful even for generated code.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No implementation files or tests are named. Start by tracing Clippy's handling of the automatically_derived attribute and how lint groups are suppressed; done means restriction, style, pedantic, and complexity warnings are suppressed for generated code while correctness and performance warnings remain enabled, with the nursery decision resolved.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.