Esc

redundant_alias

Finds a local that only exists to be copied into another local or returned.

Category complexity, warn by default.

Example
#import "Basic";

square :: (n: int) -> int {
    result := n * n;
    return result;
}

main :: () {
    print("%\n", square(4));
}
Diagnostic
warning[redundant_alias]: `result` is returned right after it is declared
  --> example.jai:4:5
   |
 4 |     result := n * n;
   |     ^^^^^^
   |
help: return the value directly
   |
 4 -     result := n * n;
 5 -     return result;
 4 +     return n * n;
   |
   = note: `redundant_alias` is `warn` by default
Fixed
#import "Basic";

square :: (n: int) -> int {
    return n * n;
}

main :: () {
    print("%\n", square(4));
}

Style rule, deliberately narrow so the fix never changes behaviour: the two statements are adjacent with nothing (not even a comment) between, the first name appears exactly twice in the body, the types are identical, and no #insert, using, notes or flags are involved.