Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
samueltardieu opened this issue May 19, 2025 · 3 comments · May be fixed by #14864
Open

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

samueltardieu opened this issue May 19, 2025 · 3 comments · May be fixed by #14864
Labels
C-enhancement Category: Enhancement of lints, like adding more cases or adding help messages good first issue These issues are a good way to get started with Clippy

Comments

@samueltardieu
Copy link
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.

@rustbot
Copy link
Collaborator

rustbot commented May 19, 2025

Unknown labels: good, first, issue

@samueltardieu
Copy link
Contributor Author

@rustbot label +"good first issue"

@rustbot
Copy link
Collaborator

rustbot commented May 19, 2025

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.

@samueltardieu samueltardieu added good first issue These issues are a good way to get started with Clippy C-enhancement Category: Enhancement of lints, like adding more cases or adding help messages labels May 19, 2025
@donkomura donkomura linked a pull request May 21, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-enhancement Category: Enhancement of lints, like adding more cases or adding help messages good first issue These issues are a good way to get started with Clippy
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants