- Notifications
You must be signed in to change notification settings - Fork515
Avoid extra clone in config if possible#1137
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
Using `impl Into<String>` instead of `&str` in a fn arg allows both `&str` and `String` as parameters - thus if the caller already has a String object that it doesn't need, it can pass it in without extra cloning.The same might be done with the password, but may require closer look.
I'm not super opposed to this, but at the same time I'm not sure it'll make a huge difference. What portion of runtime is spent constructing config? |
@sfackler config specifically is not that big of a deal of course. My concern is that any frequently used code teaches users on how to do things - and in this case, IMO, the API should have only allowed Reasoning:
P.S. community recommended using explicit generic rather than |
Using
impl Into<String>
instead of&str
in a fn arg allows both&str
andString
as parameters - thus if the caller already has a String object that it doesn't need, it can pass it in without extra cloning.The same might be done with the password, but may require closer look.