The `StrBuf` type is more useful to the caller than `~str`. The only reason `std::str::replace` returns `~str` is that it's a legacy function. There's no need to be consistent with legacy design decisions.

This will be inefficient and unidiomatic when the DST changes happen too. You have a `StrBuf` internally, so you should be returning it to the caller to do as they wish with it. There's no advantage to discarding the capacity and forcing shrinking of the allocation. It's exactly like returning `~T` when you have `T` internally.

I'm strongly against landing code using this anti-pattern.