Skip to content

Enhancements for manual_flatten #6676

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
camsteffen opened this issue Feb 5, 2021 · 4 comments
Open

Enhancements for manual_flatten #6676

camsteffen opened this issue Feb 5, 2021 · 4 comments
Assignees
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 L-style Lint: Belongs in the style lint group

Comments

@camsteffen
Copy link
Contributor

camsteffen commented Feb 5, 2021

Enhancements for manual_flatten

  1. for_each

    Before:

    iter.for_each(|o| {
        if let Some(x) = o { //.. }
    })

    After

    iter.flatten().for_each(|o| //..)
  2. nested loops

    Before:

    for x in vec![vec![1]] {
        for y in x {
            //..  x is not used again
        }
    }

    After:

    for x in vec![vec![1]].into_iter().flatten() {
        // ..
    }
@camsteffen camsteffen added L-style Lint: Belongs in the style lint group 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 Feb 5, 2021
@chrisranderson
Copy link

@rustbot claim

@chrisranderson chrisranderson removed their assignment Aug 8, 2023
@maxclaus
Copy link

maxclaus commented Dec 1, 2024

@rustbot claim

@ayamdobhal
Copy link

@rustbot claim

@rustbot rustbot assigned ayamdobhal and unassigned maxclaus Feb 12, 2025
@ayamdobhal
Copy link

Before I work on this. Has this been resolved by rust-lang/rust#82687 or do we still need to work on this?

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 L-style Lint: Belongs in the style lint group
Projects
None yet
Development

No branches or pull requests

4 participants