Skip to content

flow_control/if_let.md misses an important benefit #1184

Closed
rust-lang/rust
#60791
@peter-lyons-kehl

Description

@peter-lyons-kehl

if let docs and example doesn't mention a benefit: It allows to match enum non-parameterized variants, even if the enum doesn't #[derive(PartialEq)], neither we implement PartialEq for it. In such case, classic if Foo::Bar==a fails, but if let works.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions