Skip to content

self-assignment

Detect assignments that store an expression back into itself.

Updated View as Markdown

Default severity: warning

Assigning a side-effect-free expression to the identical destination does nothing and usually indicates a mistaken variable on one side. Expressions with effectful calls or channel receives are excluded because evaluating them can change state.

Bad

current = current

Good

current = next
Navigation

Type to search…

↑↓ navigate↵ selectEsc close