News for hackers. Stuff that matters.
Re:Rust is for Professionals by xena on Tuesday April 13, 2021 @12:08PM (#26794417)
Doesn't the compiler optimize out clones when it can?
Re:Rust is for Professionals by toby on Tuesday April 13, 2021 @12:12PM (#26794488)
There's a Cargo tool called "clippy" which will tell you if it finds unnecessary clones.
Re:Rust is for Professionals by tylerhou on Tuesday April 13, 2021 @12:12PM (#26794478)
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.
Re:Rust is for Professionals by sanxiyn on Tuesday April 13, 2021 @12:11PM (#26794464)
No, not really.