Skip to content

Commit

Permalink
refactor(header): fix more ?Sized for 1.10
Browse files Browse the repository at this point in the history
  • Loading branch information
seanmonstar committed Apr 26, 2017
1 parent 9ab67b7 commit c3466be
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions src/header/internals/vec_map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,12 @@ impl<K: PartialEq, V> VecMap<K, V> {
}

#[inline]
pub fn get_mut<K2>(&mut self, key: &K2) -> Option<&mut V>
where K2: PartialEq<K> {
pub fn get_mut<K2: PartialEq<K> + ?Sized>(&mut self, key: &K2) -> Option<&mut V> {
self.find(key).map(move |pos| &mut self.vec[pos].1)
}

#[inline]
pub fn contains_key<K2>(&self, key: &K2) -> bool
where K2: PartialEq<K> {
pub fn contains_key<K2: PartialEq<K> + ?Sized>(&self, key: &K2) -> bool {
self.find(key).is_some()
}

Expand All @@ -67,8 +65,7 @@ impl<K: PartialEq, V> VecMap<K, V> {
}

#[inline]
fn find<K2>(&self, key: &K2) -> Option<usize>
where K2: PartialEq<K> + ?Sized {
fn find<K2: PartialEq<K> + ?Sized>(&self, key: &K2) -> Option<usize> {
self.vec.iter().position(|entry| key == &entry.0)
}
}
Expand Down

0 comments on commit c3466be

Please sign in to comment.