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)
|
||||
}
|
||||
|
||||
pub fn get_by<P>(&self, predicate: P) -> Option<&V>
|
||||
pub fn get_by<P>(&self, mut predicate: P) -> Option<&V>
|
||||
where
|
||||
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
|
||||
|
Loading…
x
Reference in New Issue
Block a user