rust-lang / rust-lang/rust-clippy
Destruction of tuples in a different line that can instead happen right in closure arguments
Open
Nobody has claimed this yet.
A-lint
- Dominant language
- Rust
- Stars
- 13.5k
- Forks
- 2.2k
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 32
Description
What it does
You don't need to write another line of code destructuring the tuple given out by closure arguments, you can do it right in the argument
Lint Name
unnecessary tuple destruction line
Category
style
Advantage
- improves readability a bit
- removes unnecesary line of code
- helps new users who don't know you can destructure tuples right in closure arguments
- simplifies things
Drawbacks
No response
Example
agent.target = target.map(|target| {
let (entity, attack_target) = target;
Could be written as:
agent.target = target.map(|(entity, attack_target)|
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, test, or entry point is named. Start by locating existing Clippy lint implementations and tests for similar style transformations, then compare them with the issue's tuple-destruction example; done means the lint recognizes this pattern and provides the intended closure-argument form.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100