Closed RickyDaMa closed 2 months ago
That's fair, I'd never actually delved into the Arc
conversion implementation
Maybe it just helps the compiler optimise it, since it can see the allocation for the String
will be dropped as the method takes ownership. Not sure, it's been a while since I've read about such things, so I don't have a citation to jump to
Allows for re-using the allocated memory if you already have the owned type, and also avoids allocating in the error case 😎
This addresses that invasive brain thought I get when I have to rely on the compiler to realise it can re-use an allocation, instead of explicitly having a code path for it
This PR also contains an unrelated commit to fix a clippy lint