Skip to content

Lint for Unnecessary Map #1005

Closed
Closed
@mmstick

Description

@mmstick

It woud be nice if clippy could detect situations where map() is being used unnecessarily to pass a contained value wrapped as either a Result or an Option.

Unnecessarry

let mut file = File::open(path)
         .map(|file| file)
         .unwrap_or_else(|why| panic!("couldn't open {}: {}", infilename, why));

Recommended

let mut file = File::open(infilename)
         .unwrap_or_else(|why| panic!("couldn't open {}: {}", infilename, why));

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-lintArea: New lintsL-unnecessaryLint: Warn about unnecessary codeT-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