Skip to content

lint useless operands in binary operations #2086

Open
@oli-obk

Description

@oli-obk

Things like x & 0 can be just 0. Basically any identity or erasing operation should be linted.

  • x + 0
  • x * 1
  • x | 0
  • x & 0
  • x & uint_max
  • x % uint_max
  • x / uint_max
  • x / x
  • x - x
  • ...

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