Skip to content

Raise an error / warning on single path match #12332

Closed
@flaper87

Description

@flaper87

It is possible to write single path matches, which - although they are correct - are useless (unless I'm missing something). We could catch this cases and raise an error or a warning. I'm personally leaning towards an error, I would prefer keeping the code clean from cases like this.

fn main() {
    match Some(1) {
        _ => {println!("Nothing else could happen")}
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions