Skip to content

Suggestion for useless_conversion with .into_iter() could be better #14847

Open
@samueltardieu

Description

@samueltardieu

Description

This code :

fn main() {
    let x = &[1];
    let y = &&[2];
    let _ = x.iter().zip(y.into_iter());
}

will suggest to use

    let _ = x.iter().zip(&**y);

while it could suggest

    let _ = x.iter().zip(*y);

Noticed while closing #11572 as completed.

Version

rustc 1.89.0-nightly (4d051fb30 2025-05-18)
binary: rustc
commit-hash: 4d051fb306e661654d088892e02e69b8c0c39d43
commit-date: 2025-05-18
host: x86_64-unknown-linux-gnu
release: 1.89.0-nightly
LLVM version: 20.1.5

Additional Labels

@rustbot label +good first issue +C-enhancement

The adjustments application could be more subtle and stop when it reaches the right type if no Deref/DerefMut adjustment is involved.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-enhancementCategory: Enhancement of lints, like adding more cases or adding help messagesgood first issueThese issues are a good way to get started with Clippy

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions