Skip to content

break; else / return; else #112

@llogiq

Description

@llogiq

We may want to match needless else blocks in conditions whose then-block ends with break or return.

Example:

loop {
    if x {
        break;
    } else {
        y();
    }
}

could be

loop {
    if x { break; }
    y();
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-lintArea: New lintsE-mediumCall for participation: Medium difficulty level problem and requires some initial experience.T-ASTType: Requires working with the AST

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions