rust-lang / rust-lang/rust-clippy
needless option take improvement
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 13.5k
- Forks
- 2.2k
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 32
Description
What it does
The lint already exists but it needs an improvement in the way it detects temporaries :
Currently, it matches a DefId against &["core", "option", "Option", "as_ref"], while this works, this can give false negatives on temporary bindings.
The way we want that to work instead is described here : https://github.com/rust-lang/rust-clippy/pull/8665#issuecomment-1103939951
Upstream PR introducing the initial lint : https://github.com/rust-lang/rust-clippy/pull/8665
Lint Name
needless_option_take
Category
complexity
Advantage
No response
Drawbacks
No response
Example
<code>
Could be written as:
<code>
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
Start with the existing needless_option_take lint and read the linked rust-clippy#8665 discussion, especially the referenced comment describing temporary bindings. Update the detection behavior to avoid the stated false negatives, and verify that the lint handles the cases defined there without changing its intended purpose.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100