2 ms·
> Edit (1h later): It's also worth noting that: > - This desire of `Add::add(&str, &str) -> String` only seems to come up with people learning the language and
by Dylan16807 5y ago
> Edit (1h later): It's also worth noting that:
> - This desire of `Add::add(&str, &str) -> String` only seems to come up with people learning the language and bringing expectations from other languages. I've never seen production code that would've benefitted from it.
It's not a big problem that strA.into_string() + strB tends to allocate twice, and you wouldn't notice it in production, but it's still a waste of cycles caused by Rust's abstractions. Not even the abstractions, really, they left that implementation out as a reminder to the coder. It's a bit of an icky tradeoff.