-
Notifications
You must be signed in to change notification settings - Fork 14k
Open
Labels
C-feature-requestCategory: A feature request, i.e: not implemented / a PR.Category: A feature request, i.e: not implemented / a PR.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
HashSet::contains has the following type to allow e.g. searching in a HashSet<String> with an &str:
pub fn contains<Q: ?Sized>(&self, value: &Q) -> bool where
T: Borrow<Q>,
Q: Hash + Eq, However, slice::contains does not use Borrow, so to search in an &[String] one has to actually allocate a String:
pub fn contains(&self, x: &T) -> bool where
T: PartialEq<T>, Is there a fundamental reason for this, or is this just an omission?
coord-e, tgross35 and Natoandro
Metadata
Metadata
Assignees
Labels
C-feature-requestCategory: A feature request, i.e: not implemented / a PR.Category: A feature request, i.e: not implemented / a PR.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.