rust-lang / rust-lang/rust-clippy
Do not warn useless_conversion for (x..y).into_iter() which become necessary in the future edition?
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 13.5k
- Forks
- 2.2k
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 32
Description
This is relates to false positive but it's discussing if clippy should not report warning or not so I wrote this without bug template, but with all information in bug template.
New range types are stable and It's planned to make(x..y) be new range type in the next edition.
Therefore, accessing iterator methods directly on (x..y) looks not good to me so I wrote (x..y).into_iter().
However, clippy generates useless_conversion warning for (x..y).into_iter().
I don't know if clippy prefers future compatible syntax vs current edition only but less code so I'm creating issue as normal issue.
Reproducer
let peekable = (0..num_params).into_iter().peekable();
I saw this happen:
useless conversion to the same type: `std::ops::Range<usize>`
Help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.96.0/index.html#useless_conversion
Note: `#[warn(clippy::useless_conversion)]` on by default
Help: consider removing `.into_iter()`
Rust version
$ rustc -Vv
rustc 1.96.0 (ac68faa20 2026-05-25)
binary: rustc
commit-hash: ac68faa20c58cbccd01ee7208bf3b6e93a7d7f96
commit-date: 2026-05-25
host: aarch64-apple-darwin
release: 1.96.0
LLVM version: 22.1.2
$
$ clippy-driver -Vv
rustc 1.96.0 (ac68faa20 2026-05-25)
binary: rustc
commit-hash: ac68faa20c58cbccd01ee7208bf3b6e93a7d7f96
commit-date: 2026-05-25
host: aarch64-apple-darwin
release: 1.96.0
LLVM version: 22.1.2
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 useless_conversion lint and the reproducer (0..num_params).into_iter().peekable() from the issue. Read the lint's handling of range types and edition behavior, then determine the intended warning policy; the work is done when the policy is reflected in the lint behavior and its relevant coverage.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100