Skip to content

Lint idea: unwrap_or_else_panic #1902

@smoelius

Description

@smoelius

I tend to write code like this a lot:

            .unwrap_or_else(|error| panic!("Could not write to stderr: {error}"));

However, as I recently learned, the above is no better than expect:

            .expect("Could not write to stderr")

Playground

Metadata

Metadata

Assignees

No one assigned

    Labels

    new-lintNew lint or lint enhancement

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions