Skip to content

New pattern for manual_is_variant_and #16419

@ada4a

Description

@ada4a

What it does

replace

option.is_none() || option.is_some_and(foo)

with

option.is_none_or(foo)

Inspired by pop-os/cosmic-comp#1946 (comment)

Advantage

  • Simplifies the code

Drawbacks

No response

Example

option.is_none() || option.is_some_and(foo)

Could be written as:

option.is_none_or(foo)

Comparison with existing lints

There are no similar lints AFAICT

Additional Context

No response

Metadata

Metadata

Assignees

Labels

C-enhancementCategory: Enhancement of lints, like adding more cases or adding help messagesgood 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