mirror of
https://github.com/rust-lang/rust.git
synced 2025-05-08 16:07:43 +00:00
Explicitly pass find arguments down the predicate so coercions can apply
This commit is contained in:
parent
0ad09f9386
commit
ed94da14ed
@ -33,11 +33,11 @@ where
|
|||||||
self.0.iter().find(|(key, _)| k == key.borrow()).map(|elem| &elem.1)
|
self.0.iter().find(|(key, _)| k == key.borrow()).map(|elem| &elem.1)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_by<P>(&self, predicate: P) -> Option<&V>
|
pub fn get_by<P>(&self, mut predicate: P) -> Option<&V>
|
||||||
where
|
where
|
||||||
for<'b> P: FnMut(&'b &(K, V)) -> bool,
|
for<'b> P: FnMut(&'b &(K, V)) -> bool,
|
||||||
{
|
{
|
||||||
self.0.iter().find(predicate).map(|elem| &elem.1)
|
self.0.iter().find(|kv| predicate(kv)).map(|elem| &elem.1)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn contains_key<Q: ?Sized>(&self, k: &Q) -> bool
|
pub fn contains_key<Q: ?Sized>(&self, k: &Q) -> bool
|
||||||
|
Loading…
Reference in New Issue
Block a user