|
|
|
|
|
by Georgelemental
927 days ago
|
|
Using `clone` etc when it's easier is actually common advice, it's perfectly OK to not have borrowing everywhere if you don't need it. My usual starting point / default / rule of thumb is to take references as parameters and return owned values (for example, take `&str` as an argument, return an owned `String`). |
|
If you're creating a new string, then sure return String. But if you have a path where you could just return the original input, consider returning a Cow<str>.