Should I use a Box<str> instead of a String when possible?

482 points SvenyBoy_YT 136 comments

I see a lot of crates that use a String when they could be using a Box<str>, especially in errors. A Box takes up less space than a String, so is there a reason for it, or should I use Box<str>? I don't have any specific use cases in mind.