rust-lang / rust-lang/rust-clippy
used_unused_variable lint
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 13.5k
- Forks
- 2.2k
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 32
Description
The idea is to lint for variables that have had a _ prepended on them to avoid unused variable lints and then subsequently been used.
The motivation for this change is that I want to use cargo fix --clippy as my default command to run to check my working copy for compiler errors, but it puts _ on the front of variables when I'm initially writing them and then doesn't clean up after itself once I start using said variables. This bothers me and I want to fix it to make my workflow smoother.
We would want to restrict this lint by default, a its entirely reasonable to start variables with an underscore normally, so we don't necessarily want to force people to treat a leading _ as a reserved that they can't use except to indicate a variable is unused.
For this to be useful for my workflow the lint should be marked as MachineApplicable.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No file or test is named in the issue. Start by locating Clippy's existing handling for unused-variable lints, then determine how to detect underscore-prefixed variables that are later used and how lint applicability is represented. Done means a restricted lint identifies those variables, provides a MachineApplicable fix, and has tests covering the behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- devtools
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100