Skip to content

manual_is_variant_and documentation doesn't mention all linted cases #15217

Closed
@y21

Description

@y21

The documentation for manual_is_variant_and currently only specifically talks about how it lints .map(f).unwrap_or_default() and mentions the following examples:

option.map(|a| a > 10).unwrap_or_default();
result.map(|a| a > 10).unwrap_or_default();
// should be
option.is_some_and(|a| a > 10);
result.is_ok_and(|a| a > 10);

At some point the lint was extended to also catch equals comparisons:

option.map(|a| a > 10) == Some(true);
result.map(|a| a > 10) == Ok(true);
// should be
option.is_some_and(|a| a > 10);
result.is_ok_and(|a| a > 10);

This isn't mentioned anywhere in the documentation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-documentationArea: Adding or improving documentation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions