Skip to content

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

Open
@samueltardieu

Description

@samueltardieu
Contributor

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.

Activity

rustbot

rustbot commented on May 19, 2025

@rustbot
Collaborator

Unknown labels: good, first, issue

samueltardieu

samueltardieu commented on May 19, 2025

@samueltardieu
ContributorAuthor

@rustbot label +"good first issue"

rustbot

rustbot commented on May 19, 2025

@rustbot
Collaborator

Error: Parsing relabel command in comment failed: ...' label +' | error: quote in word at >| '"good firs'...

Please file an issue on GitHub at triagebot if there's a problem with this bot, or reach out on #t-infra on Zulip.

added
good first issueThese issues are a good way to get started with Clippy
C-enhancementCategory: Enhancement of lints, like adding more cases or adding help messages
on May 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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

      Participants

      @samueltardieu@rustbot

      Issue actions

        Suggestion for `useless_conversion` with `.into_iter()` could be better · Issue #14847 · rust-lang/rust-clippy