Making clippy happy in index and maybe fixed a bug

This commit is contained in:
Dennis Schwerdel 2017-04-19 22:52:27 +02:00
parent db7c6ef4fb
commit 43e86f31de
1 changed files with 4 additions and 4 deletions

View File

@ -149,7 +149,7 @@ impl<K: Key, V: Clone + Copy> Index<K, V> {
header.entries = 0;
header.capacity = INITIAL_SIZE as u64;
}
if &header.magic != magic {
if header.magic != *magic {
return Err(IndexError::WrongMagic);
}
if header.version != version {
@ -313,7 +313,7 @@ impl<K: Key, V: Clone + Copy> Index<K, V> {
if entry.key == *key {
return LocateResult::Found(pos);
}
let odist = (pos + self.capacity - entry.key.hash() as usize & self.mask) & self.mask;
let odist = (pos + self.capacity - (entry.key.hash() as usize & self.mask)) & self.mask;
if dist > odist {
return LocateResult::Steal(pos);
}
@ -466,8 +466,8 @@ impl<K: Key, V: Clone + Copy> Index<K, V> {
}
#[inline]
pub fn iter<'a>(&'a self) -> Iter<'a, K, V> {
Iter{items: &self.data}
pub fn iter(&self) -> Iter<K, V> {
Iter{items: self.data}
}
#[inline]