Esc

needless_bool

Finds ifx c then true else false and if c return true; else return false;.

Category complexity, warn by default.

Example
#import "Basic";

is_positive :: (n: int) -> bool {
    if n > 0 return true;
    else return false;
}

main :: () {
    print("%\n", is_positive(3));
}
Diagnostic
warning[needless_bool]: this `if` returns its own condition as a `bool`
  --> example.jai:4:5
   |
 4 |     if n > 0 return true;
   |     ^^^^^^^^^^^^^^^^^^^^^
   |
help: write `return n > 0;`
   |
 4 -     if n > 0 return true;
 5 -     else return false;
 4 +     return n > 0;
   |
   = note: `needless_bool` is `warn` by default
Fixed
#import "Basic";

is_positive :: (n: int) -> bool {
    return n > 0;
}

main :: () {
    print("%\n", is_positive(3));
}

A trailing if c return true; return false; is left alone when an earlier guard in the block also returns a literal.