rust-lang / rust-lang/rust-clippy
iter() -> 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
Propose to change iter() to into_iter()
Categories (optional)
- Kind: See https://github.com/rust-lang/rust-clippy/blob/master/README.md#clippy for list of lint kinds
What is the advantage of the recommended code over the original code
For example:
My old code:
foo.unwrap_or_default().iter()....
By hand I changed it to:
foo.unwrap_or_default().into_iter()....
Then clippy proposed to remove some clone()s
When I removed the clone()s, clippy proposed to change filter + map to filter_map
clippy is awesome. The code looks beautiful now.
The suggestion to change iter() to into_iter() was missing and blocking the other lints
Drawbacks
None.
Example
foo.unwrap_or_default().iter()....
Could be written as:
foo.unwrap_or_default().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 implementation files, tests, or entry points. Start by reviewing existing Clippy iterator-related lints and their tests, then determine the cases where replacing iter() with into_iter() is valid. Done means the intended cases are linted without changing semantics and the follow-up lints can apply.
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
- 25/100