Esc

redundant_cast

Finds a cast to the type the value already has.

Category complexity, warn by default.

Example
#import "Basic";

main :: () {
    x: s32 = 5;
    y := cast(s32) x;
    print("%\n", y);
}
Diagnostic
warning[redundant_cast]: `x` is already `s32`
  --> example.jai:5:10
   |
 5 |     y := cast(s32) x;
   |          ^^^^^^^^^^^
   |
help: remove the cast
   |
 5 ~     y := x;
   |
   = note: `redundant_cast` is `warn` by default
Fixed
#import "Basic";

main :: () {
    x: s32 = 5;
    y := x;
    print("%\n", y);
}

Aliases like c_long differ per platform, so the value must be declared with the same type spelling.