rust-lang / rust-lang/rust-clippy
`useless_conversion` eats the closing paren when removing `.into_iter()`
Open
@ada4a is already working on this.
Since Nov 5, 2025.
C-bug
I-suggestion-causes-error
- Dominant language
- Rust
- Stars
- 13.5k
- Forks
- 2.2k
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 32
Description
Summary
When the receiver with the useless .into_iter() is enclosed in parens, the suggestion eats the closing paren
Reproducer
I tried this code:
#![warn(clippy::useless_conversion)]
#![allow(unused)]
fn main() {
fn f(_: impl IntoIterator<Item = i32>){}
f((vec![]).into_iter())
}
I expected to see this happen:
warning: explicit call to `.into_iter()` in function argument accepting `IntoIterator`
--> src/main.rs:8:7
|
6 | f((vec![]).into_iter())
| ^^^^^^^^------------
| |
| help: consider removing the `.into_iter()`
|
Instead, this happened:
warning: explicit call to `.into_iter()` in function argument accepting `IntoIterator`
--> src/main.rs:8:7
|
6 | f((vec![]).into_iter())
| ^^^^^^^-------------
| |
| help: consider removing the `.into_iter()`
|
Version
rustc 1.91.0 (f8297e351 2025-10-28)
binary: rustc
commit-hash: f8297e351a40c1439a467bbbb6879088047f50b3
commit-date: 2025-10-28
host: x86_64-unknown-linux-gnu
release: 1.91.0
LLVM version: 21.1.2
Additional Labels
@rustbot label I-suggestion-causes-error
@rustbot claim
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.
Assessment
This issue has not been assessed yet.