menu
prefer-weakest-access
Prefer the weakest access form required by a value's uses
A borrowed parameter with stronger access than any checked use grants callers unnecessary authority. Instead, you SHOULD declare the weakest access sufficient for every use of the parameter.
Reported
1struct Counter {2 value: int32;3}4 5function read(counter: &exclusive Counter): int32 {6 return counter.value;7}Accepted
1struct Counter {2 value: int32;3}4 5function read(counter: &readonly Counter): int32 {6 return counter.value;7}