Skip to content
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

Enhancements for manual_flatten #6676

Open
camsteffen opened this issue Feb 5, 2021 · 1 comment
Open

Enhancements for manual_flatten #6676

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

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
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

2 participants