Acton
Linting rules

E032: unused-expression

Warns when an expression statement computes a value that is immediately discarded.

Metadata

  • Code: E032
  • Rule: unused-expression
  • Status: Stable since v0.0.1
  • Quick fix: not available

What it does

Warns when an expression statement computes a value that is immediately discarded.

Why is this bad?

Such expressions usually have no effect and often indicate a typo, such as using != instead of = or +=.

Example

fun main(a: int, b: int) {
    a != b;
E032: unused expression has no effect
}

Use instead:

fun main(mutate a: int, b: int) {
    a -= b;
}
Source code

Last updated on

On this page