rust-lang / rust-lang/rust-clippy
lint None.into_iter()?
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
If we want to have something like an iterator that starts with certain item and then continues with another range of items, we can do something like chaining an iterator to an option:
Some(0).into_iter().chain(vec![1, 2, 3].into_iter())
Although it does not make a lot of sense, this works with None as well but the first item will not be saved in the iterator.
None::<i32>.into_iter().chain(vec![1, 2, 3].into_iter())
I wonder if it makes sense to lint something like None.(into_)iter() and suggest std::iter::empty or removing the code entirely.
Lint Name
none_to_iter? none_into_iter?
Category
style, complexity
Advantage
No response
Drawbacks
No response
Example
None::<i32>.into_iter().chain(vec![1, 2, 3].into_iter())
Could be written as:
vec![1,2,3].into_iter()
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
The issue names no source files, tests, or entry points. Start by reviewing the proposed Rust examples and determine the exact scope and expected behavior for a None iterator lint; completion requires a settled lint proposal with testable expectations.
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
- Needs clarification
- Newbie friendliness
- 30/100