menu

needless-borrow-of-copy

Prefer passing small Copy scalars by value

A readonly borrow of a machine scalar adds indirection to a value that Copy can pass directly. Instead, you SHOULD pass the scalar by value and rely on its intrinsic Copy behavior.

Reported

1function increment(value: &readonly int32): int32 {2    return value + 1;3}

Accepted

1function increment(value: int32): int32 {2    return value + 1;3}