refactor(header): fix more ?Sized for 1.10

This commit is contained in:
Sean McArthur
2017-04-26 14:52:23 -07:00
parent 9ab67b7900
commit c3466bedf8

View File

@@ -39,14 +39,12 @@ impl<K: PartialEq, V> VecMap<K, V> {
} }
#[inline] #[inline]
pub fn get_mut<K2>(&mut self, key: &K2) -> Option<&mut V> pub fn get_mut<K2: PartialEq<K> + ?Sized>(&mut self, key: &K2) -> Option<&mut V> {
where K2: PartialEq<K> {
self.find(key).map(move |pos| &mut self.vec[pos].1) self.find(key).map(move |pos| &mut self.vec[pos].1)
} }
#[inline] #[inline]
pub fn contains_key<K2>(&self, key: &K2) -> bool pub fn contains_key<K2: PartialEq<K> + ?Sized>(&self, key: &K2) -> bool {
where K2: PartialEq<K> {
self.find(key).is_some() self.find(key).is_some()
} }
@@ -67,8 +65,7 @@ impl<K: PartialEq, V> VecMap<K, V> {
} }
#[inline] #[inline]
fn find<K2>(&self, key: &K2) -> Option<usize> fn find<K2: PartialEq<K> + ?Sized>(&self, key: &K2) -> Option<usize> {
where K2: PartialEq<K> + ?Sized {
self.vec.iter().position(|entry| key == &entry.0) self.vec.iter().position(|entry| key == &entry.0)
} }
} }