Skip to content

Tracking Issue: lints that lint against match and if-lets should be more consistent #12618

Open
@J-ZhengLi

Description

@J-ZhengLi

Description

there are lints that check (or at least should be checking) for match or if-let on Option or Result, such as [question_mark], which checks all combinations now.

But there are some lints that either checks only match exprs on Option and Result, or checks match and if-let on Options, which does not seems consistent, consider the same rules could be applied for both.

Here is a short list of lints that I found which has this problem (I didn't went into it enough so it's highly possible there are missing some lint, ping me to add them in):

Lint Name What's Missing PR # Finished
manual_unwrap_or linting for if-let expressions
manual_unwrap_or_default linting for Result type
manual_let_else (somewhat belongs to this list... I think) linting for Result type
(The pat_and_expr_can_be_question_mark could use some improvement, since not only Options can use question mark, any types that impls Try trait can use it, like Result ofc)

Not in the list but could someone plz confirm that the problem which [if_let_mutex] trying to prevent can or cannot happen with match?

Version

No response

Additional Labels

@rustbot label +I-false-nagative +C-enhancement +good-first-issue

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-enhancementCategory: Enhancement of lints, like adding more cases or adding help messagesC-tracking-issueCategory: Tracking Issuegood 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