Skip to content

useless_conversion eats the closing paren when removing .into_iter() #16038

@ada4a

Description

@ada4a

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

Metadata

Metadata

Assignees

Labels

C-bugCategory: Clippy is not doing the correct thingI-suggestion-causes-errorIssue: The suggestions provided by this Lint cause an ICE/error when applied

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions