Hacker News new | past | comments | ask | show | jobs | submit login

The borrow checker is "smarter" within a single function body though, so factoring code into a separate function is not necessarily as easy as in other languages.



I ran into this issue years ago (possibly even before labeled exit from loops or even NLL, although I'd have to dig through some old code to confirm this). I had some logic that I wanted to short-circuit, but moving everything to a separate method call would have required an extra borrow that would not have been allowed. I don't think that I'll end up needing to use this feature much, but I'm glad to finally have it as an option for the rare cases when it will improve the readability of my code.


You can use it with a closure to get the best of both worlds




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: