Acton
Linting rules

E009: method-can-be-static

Checks for instance methods where `self` is unnecessary.

Metadata

  • Code: E009
  • Rule: method-can-be-static
  • Status: Stable since v0.0.1
  • Quick fix: not available

What it does

Checks for instance methods where self is unnecessary.

Why is this bad?

If self is never used, the method can be static which makes the API clearer.

Example

struct Foo {}

fun Foo.bar(self, a: int): int {
E009: method can be static
return a + 1; }

Use instead:

struct Foo {}

fun Foo.bar(a: int): int {
    return a + 1;
}
Source code

Last updated on

On this page