Skip to content

Suggest ok_or over map_or when possible #10045

@chubei

Description

@chubei

What it does

Check for usage of _.map_or(Err(_), Ok).

Lint Name

option_map_or_err_ok

Category

pedantic

Advantage

  • Readability: this can be written more concisely as _.ok_or(_).

Drawbacks

No response

Example

opt.map_or(Err(e), Ok);

Could be written as:

opt.ok_or(e);

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