Esc

unused_variable

Finds a local variable that is never used.

Category style, warn by default.

Example
#import "Basic";

main :: () {
    leftover := 5;
    print("hello\n");
}
Diagnostic
warning[unused_variable]: unused variable `leftover`
  --> example.jai:4:5
   |
 4 |     leftover := 5;
   |     ^^^^^^^^
   |
help: remove it
   |
 4 -     leftover := 5;
   |
   = note: `unused_variable` is `warn` by default
Fixed
#import "Basic";

main :: () {
    print("hello\n");
}

A name that appears anywhere else in its block is never reported (covers #if-excluded code and #asm).