redundant_deref
Finds p.*.field where p.field means the same.
Category complexity, warn by default.
#import "Basic";
Point :: struct {
x: int;
y: int;
}
main :: () {
p := Point.{ 1, 2 };
q := *p;
print("%\n", q.*.x + q.y);
}warning[redundant_deref]: `q.*` is not needed to reach `x`
--> example.jai:12:19
|
12 | print("%\n", q.*.x + q.y);
| ^^
|
help: write `q.x`: member access already looks through the pointer
|
12 ~ print("%\n", q.x + q.y);
|
= note: `redundant_deref` is `warn` by default#import "Basic";
Point :: struct {
x: int;
y: int;
}
main :: () {
p := Point.{ 1, 2 };
q := *p;
print("%\n", q.x + q.y);
}Fires when a member is taken from the dereference of an expression whose type is a pointer to a struct or union.