Skip to content

match_like_matches_macro: strip refs in suggestion #6503

Closed
@matthiaskrgr

Description

@matthiaskrgr
fn main() {
    let x = Some(3);

    // original:
    let z = match &x {
        Some(3) => true,
        _ => false,
    };

    // current suggestion
    let y = matches!(&x, Some(3));
    // could be simplified to:
    let y = matches!(x, Some(3));
}

Suggested by @LingMan :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-enhancementCategory: Enhancement of lints, like adding more cases or adding help messages

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions