Skip to content

New lint: comparing option to Some(true) #4987

Open
@ghost

Description

Suggest replacing the expression x == Some(true) with x.unwrap_or(false). To me the second form better expresses what's going on: use the value in x otherwise default to false.

This is similar to the bool_comparison lint but I guess it could be more controversial. I'm OK if it's pedantic or restriction depending on what other people think.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-lintArea: New lints

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions