-
Notifications
You must be signed in to change notification settings - Fork 45
fix: Take Into<Cow> instead of &str #232
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
@@ -2448,7 +2448,7 @@ fn secondary_title_no_level_text() { | |||
) | |||
.element( | |||
Level::NOTE | |||
.text(None) | |||
.text(None::<&str>) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this still needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sadly yes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How come and then why does OptionCow
exist? I thought it was to bypass this problem
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
::<&str>
is needed because the type of None
can't be inferred, as the From
impl for Option
is generic over T: Into<Cow<'a, str>>
. This problem would still exist if we were to write out the different From
.
OptionCow
exists to solve the more common case of passing in a literal without also needing to write Some()
.
Fixes #200