Skip to content

Commit ed94da1

Browse files
committed
Explicitly pass find arguments down the predicate so coercions can apply
1 parent 0ad09f9 commit ed94da1

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

compiler/rustc_data_structures/src/vec_map.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,11 @@ where
3333
self.0.iter().find(|(key, _)| k == key.borrow()).map(|elem| &elem.1)
3434
}
3535

36-
pub fn get_by<P>(&self, predicate: P) -> Option<&V>
36+
pub fn get_by<P>(&self, mut predicate: P) -> Option<&V>
3737
where
3838
for<'b> P: FnMut(&'b &(K, V)) -> bool,
3939
{
40-
self.0.iter().find(predicate).map(|elem| &elem.1)
40+
self.0.iter().find(|kv| predicate(kv)).map(|elem| &elem.1)
4141
}
4242

4343
pub fn contains_key<Q: ?Sized>(&self, k: &Q) -> bool

0 commit comments

Comments
 (0)