Y
Hacker News
new
|
ask
|
show
|
jobs
by
xena
1889 days ago
Doesn't the compiler optimize out clones when it can?
3 comments
toby
1889 days ago
There's a Cargo tool called "clippy" which will tell you if it finds unnecessary clones.
link
tylerhou
1889 days ago
Probably not; detecting unnecessary clones is expensive for non-trivial cases. If a human can't prove that the clone isn't necessary (by writing the code in such a manner that the borrow checker accepts), I doubt the compiler could.
link
sanxiyn
1889 days ago
No, not really.
link