Skip to content

Add x.map_or(true, |n| n > 5) to manual_is_variant_and #15998

@teofr

Description

@teofr

Description

Part of the scope of unnecessary_map_or is suggesting x.is_none_or(|n| n > 5) from x.map_or(true, |n| n > 5). This overlaps with the logic behind manual_is_variant_and.

I think that logic should be moved from unnecessary_map_or into manual_is_variant_and. Both for map_or(true, ...) into is_none_or(...) and for map_or(false, ...) into is_some_and(...).

The discussion for this sprung from #15801

Version

rustc 1.92.0-nightly (57ef8d642 2025-10-15)
binary: rustc
commit-hash: 57ef8d642d21965304bde849bab4f389b4353e27
commit-date: 2025-10-15
host: aarch64-apple-darwin
release: 1.92.0-nightly
LLVM version: 21.1.3

Additional Labels

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions