Ownership and Borrowing
- Prefer
&stroverStringin function parameters. - Prefer
&[T]overVec<T>in function parameters. - Use
Cow<'_, str>when a function may or may not allocate. - Pass large structs by reference; pass
Copytypes by value. - Avoid unnecessary
.clone()— if you need ownership, take owned types in the signature.