Skip to content

let_unit_value giving suggestion that fails to compile if implemented #2331

Closed
@mhlakhani

Description

@mhlakhani

In 1.23, FromIterator<()> for () was stabilized. I tried to write some new code to use this feature. As a simplified example I have the code in this playground:

https://play.rust-lang.org/?gist=3d3f6bde3183c079b072006ecf26b389&version=stable

Clippy will report the error on line 5. However if I remove the annotation and change it to this:

https://play.rust-lang.org/?gist=286a63d7f9e930265093ad211b5ddfc1&version=stable

I now get a compile error because the compiler doesn't know the return type.

Should clippy not warn in this case?

PS: This seemed different enough from #1502 that I filed a separate issue, feel free to merge.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions