Skip to content
This repository was archived by the owner on Jul 30, 2025. It is now read-only.

Commit 5fd35ec

Browse files
authored
[linter] Added equal_operands_in_bin_op docs (#999)
1 parent d548acf commit 5fd35ec

File tree

1 file changed

+6
-0
lines changed
  • apps/nextra/pages/en/build/smart-contracts

1 file changed

+6
-0
lines changed

apps/nextra/pages/en/build/smart-contracts/linter.mdx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,12 @@ It is a common Move pattern to provide inline specifications in conditions, espe
5959

6060
Note that an `assert!` is translated to a conditional abort, so blocks in `assert!` condition also are reported by this lint.
6161

62+
# `equal_operands_in_bin_op`
63+
64+
Checks for binary operations where both operands are the same, which is likely a mistake. For example `x % x`, `x ^ x`, `x > x`, `x >= x`, `x == x`, `x | x`, `x & x`, `x / x`, and `x != x` are all caught by this lint. The lint suggests replacing these with a more appropriate value or expression, such as `0`, `true`, or `false`.
65+
66+
This lint does not catch cases where the operands are vector access.
67+
6268
### `known_to_abort`
6369

6470
Checks for expressions that will always abort at runtime due to known constant values that violate runtime constraints. This lint helps identify code that will deterministically fail before it reaches production.

0 commit comments

Comments
 (0)