Skip to content

New lint: let statement with no effect #5205

@CAD97

Description

@CAD97

As featured in this Twitter poll.

A statement of the form let _ = <place> has no effect (modulo Deref coersion) as the place is not moved from. This should instead be omited (if all Deref coersion is pure) or otherwise written to be more clear on intent (explicitly calling side-effectful Deref).

50% of people had the wrong intuition of behavior here, so this definitely would help avoid potentially misleading code.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-lintArea: New lintsL-unnecessaryLint: Warn about unnecessary code

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions