Skip to content

Extend option-map-unwrap-or-else to Result #1590

Closed
@oli-obk

Description

@oli-obk

opt.map(f).unwrap_or_else(g) is linted to suggest opt.map_or_else(g, f), but res.map(f).unwrap_or_else(g) is not linted even though it could be res.ok().map_or_else(|_| g(), f)

Somewhat ugly suggestion, so should be allow-by-default, maybe we should poke rustc to add Result::map_or_else

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-enhancementCategory: Enhancement of lints, like adding more cases or adding help messagesT-middleType: Probably requires verifiying typesgood 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