|
|
|
|
|
by Koiwai
1532 days ago
|
|
It's called destructuring assignment, it's not just for "in-place swap", and more over, it's about syntax, not performance. That article is talking about performance, and as many have pointed out, it's better just use a 3rd variable(when there's no destructuring assignment) to swap and let compiler do its work. I'm not saying syntax sugar is a bad thing. |
|
e.g. https://doc.rust-lang.org/core/mem/fn.swap.html