Skip to content

Enhancements for manual_flatten #6676

Open
@camsteffen

Description

@camsteffen

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() {
        // ..
    }

Metadata

Metadata

Assignees

Labels

C-enhancementCategory: Enhancement of lints, like adding more cases or adding help messagesL-styleLint: Belongs in the style lint groupgood 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