Skip to content

Wrong needless_return suggestion with blocks #2472

Closed
@lnicola

Description

@lnicola

Clippy suggests changing return { e } + 10; to { x } + 10 instead of ({ x }) + 10 or ({ x } + 10), and that doesn't compile.

I'm not sure what it should do, always parenthesise the inner span? rustfmt doesn't fix that, and it would be a bit ugly. Should it recurse into the expression to see if there are any blocks?

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: Clippy is not doing the correct thingI-suggestion-causes-errorIssue: The suggestions provided by this Lint cause an ICE/error when applied

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions