zesterer / ariadne

A fancy diagnostics & error reporting crate
https://crates.io/crates/ariadne
MIT License
1.61k stars 72 forks source link

Change `: ToString` to `: Into<String>`. #31

Open fee1-dead opened 2 years ago

fee1-dead commented 2 years ago

The rationale is that if the user already has a String, using ToString will unnecessarily clone the String instead of assigning it directly.

If you want, this can be done without a breaking change (i.e. keeping existing methods and adding new ones to support setting a string directly), but I'd argue that adds too much complexity to the API.

ISSOtm commented 1 month ago

Unfortunately, doing so would lose the ability to use any type that e.g. implements Display. I'm not sure that's great?

fee1-dead commented 1 month ago

Display should be explicit because it might be expensive.