menu

map-identity

Disallow rebuilding an owned array through an identity map

Mapping every element to itself rebuilds an owned array without changing its values. Instead, you SHOULD use the original owned array directly.

Reported

1function identity(values: ^int32[]): ^int32[] {2    return values.map((value) => value);3}

Accepted

1function identity(values: ^int32[]): ^int32[] {2    return values;3}