rust-lang / rust-lang/rust-clippy

A process for bringing high-churn-but-beneficial lints to being warn-by-default

Open
#15,877 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

C-question
Dominant language
Rust
Stars
13.5k
Forks
2.2k
Avg merge
2d 10h
Merged PRs (30d)
32

Description

Description

There are a few lints in Clippy that, while being imo pretty useful, unfortunately remain in restriction, as enabling them by default would mean a lot of churn for older/larger projects -- some examples being be allow_attributes and redundant_test_prefix.

I guess one way to solve this to make cargo new populate Cargo.toml with x = warns for all such lints, but that could quickly become unwieldy, similarly to how a lot of C/C++ projects are (in my, admittedly small, experience with those) built with a bajillion of -Wxxx flags.

And honestly, it sounds simple enough for the older projects to add a blanket allow for any new warn-by-default lints (and then possibly work on removing all the linted cases to eventually remove the allow, but that's left to each project to decide). Does this break backwards-compat, given that these will be just warnings, not build failures?

But if even that is deemed unpalatable, then it would be nice to find some other solution.

Version

Additional Labels

@rustbot label C-question

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

Start by reviewing the Clippy documentation for the allow_attributes and redundant_test_prefix lints, then examine how cargo new and Cargo.toml configuration relate to lint defaults. Clarify whether a documented process for moving selected restriction lints to warn-by-default is acceptable and define the criteria and migration outcome for such a change.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
devtools
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.