Skip to content

FN redundant_pattern_matching: reference to LHS op: &None #5396

Closed
@matthiaskrgr

Description

@matthiaskrgr

for some reason

fn use_enum(e: Option<i32>) -> bool {
    let x = if let None = &e { true } else { false };

    println!("{:?}", x);
    x
}

warns but

fn use_enum(e: Option<i32>) -> bool {
    let x = if let &None = &e { true } else { false };

    println!("{:?}", x);
    x
}

(&None) does not. :/

Metadata

Metadata

Assignees

Labels

C-enhancementCategory: Enhancement of lints, like adding more cases or adding help messagesI-false-negativeIssue: The lint should have been triggered on code, but wasn'tL-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