Skip to content

False positive 'option-map-unit-fn' for std::process::exit #5180

@jyn514

Description

@jyn514
warning: called `map(f)` on an Option value where `f` is a unit function
   --> src/bin/rcc.rs:124:9
    |
124 |         unsafe { rccjit.run_main() }.map(std::process::exit);
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
    |         |
    |         help: try this: `if let Some(_) = unsafe { rccjit.run_main() } { std::process::exit(_) }`

This suggestion makes no sense: you can't pass _ to a function. Furthermore, exit() is not a unit function, it takes i32.

cargo clippy -V: clippy 0.0.212 (e8642c7 2020-01-06) (but also happens in stable)

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-enhancementCategory: Enhancement of lints, like adding more cases or adding help messagesL-suggestionLint: Improving, adding or fixing lint suggestionsgood 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