mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 14:55:26 +00:00
Use impl FnMut directly as predicate type
This commit is contained in:
parent
ed94da14ed
commit
cad762b1e2
@ -33,10 +33,7 @@ where
|
||||
self.0.iter().find(|(key, _)| k == key.borrow()).map(|elem| &elem.1)
|
||||
}
|
||||
|
||||
pub fn get_by<P>(&self, mut predicate: P) -> Option<&V>
|
||||
where
|
||||
for<'b> P: FnMut(&'b &(K, V)) -> bool,
|
||||
{
|
||||
pub fn get_by(&self, mut predicate: impl FnMut(&(K, V)) -> bool) -> Option<&V> {
|
||||
self.0.iter().find(|kv| predicate(kv)).map(|elem| &elem.1)
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user