-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Open
Labels
A-strArea: str and StringArea: str and StringC-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.
Description
Right now:
pub fn eq_ignore_ascii_case(&self, other: &char) -> bool {
self.to_ascii_lowercase() == other.to_ascii_lowercase()
}
This means that 'a'.eq_ignore_ascii_case('b')
doesn't compile. Instead the user must type 'a'.eq_ignore_ascii_case(&'b')
. I would like to allow for both without breaking backwards compatibility.
One option would be to change the signature to the following:
pub fn eq_ignore_ascii_case<C: AsRef<char>>(&self, other: C) -> bool {
self.to_ascii_lowercase() == other.as_ref().to_ascii_lowercase()
}
This would require us to implement AsRef<char>
for char
and &char
to facilitate this.
Metadata
Metadata
Assignees
Labels
A-strArea: str and StringArea: str and StringC-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.