Re:Should Small Rust Structs be Passed by-copy or by-borrow?
by zozbot234 on Saturday December 31, 2022 @01:21PM
(#34199118)
It would be more advisable to add this as a clippy hint, because `&T` and `T` are not always equivalent wrt. FFI.
[ Parent
| on HN ]
Re:Should Small Rust Structs be Passed by-copy or by-borrow?
by kibwen on Saturday December 31, 2022 @02:59PM
(#34200135)
Indeed, but the compiler is still capable of doing it on a case-by-case basis. Quite often the observed semantics are identical and it's easy for the backend to see that a pointer has been created only to be immediately dereferenced.