identity_op
Finds an operation that changes nothing (x + 0, x * 1).
Category complexity, warn by default.
#import "Basic";
size_in_bytes :: (count: int) -> int {
return count * 1;
}
main :: () {
print("%\n", size_in_bytes(8));
}warning[identity_op]: `count * 1` is just `count`: `*` with this operand changes nothing
--> example.jai:4:12
|
4 | return count * 1;
| ^^^^^^^^^
|
help: write `count`
|
4 ~ return count;
|
= note: `identity_op` is `warn` by default#import "Basic";
size_in_bytes :: (count: int) -> int {
return count;
}
main :: () {
print("%\n", size_in_bytes(8));
}0 + x, operations inside indexes/array literals and shifts by 0 are left alone (they line up with neighbours).