Skip to content

Commit

Permalink
Use impl FnMut directly as predicate type
Browse files Browse the repository at this point in the history
  • Loading branch information
spastorino committed Jun 8, 2021
1 parent ed94da1 commit cad762b
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions compiler/rustc_data_structures/src/vec_map.rs
Expand Up @@ -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)
}

Expand Down

0 comments on commit cad762b

Please sign in to comment.