Skip to content

Commit 775e1ed

Browse files
committed
linter
1 parent 41c4e9f commit 775e1ed

2 files changed

Lines changed: 8 additions & 8 deletions

File tree

crates/hash-sorted-map/src/hash_sorted_map.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,8 @@ impl<K: Hash + Eq + Ord, V, S: BuildHasher> HashSortedMap<K, V, S> {
143143
hashes.push(hash);
144144
}
145145
}
146-
let g = &self.groups[*chain.last().expect("chain should have at least one group") as usize];
146+
let g =
147+
&self.groups[*chain.last().expect("chain should have at least one group") as usize];
147148
for slot in 0..GROUP_SIZE {
148149
if g.ctrl[slot] == CTRL_EMPTY {
149150
break;
@@ -153,7 +154,7 @@ impl<K: Hash + Eq + Ord, V, S: BuildHasher> HashSortedMap<K, V, S> {
153154
.hash_one(unsafe { g.keys[slot].assume_init_ref() });
154155
hashes.push(hash);
155156
}
156-
157+
157158
let n = hashes.len();
158159
// Insertion sort by (hash, key).
159160
for i in 1..n {

crates/hash-sorted-map/src/iter.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ use std::mem::ManuallyDrop;
44
use crate::group_ops::{CTRL_EMPTY, GROUP_SIZE};
55

66
use super::group::Group;
7-
use super::group_ops;
87
use super::hash_sorted_map::{HashSortedMap, NO_OVERFLOW};
98

109
/// State shared by `Iter`, `IterMut`, and `IntoIter`: tracks which primary
@@ -21,7 +20,7 @@ struct IterCursor {
2120
}
2221

2322
impl IterCursor {
24-
fn new(n_bits: u32, groups_len: usize) -> Self {
23+
fn new(n_bits: u32) -> Self {
2524
let num_primary = 1u32 << n_bits;
2625
Self {
2726
primary: 0,
@@ -41,7 +40,7 @@ impl IterCursor {
4140
let slot = self.current_slot;
4241
if groups[gi].ctrl[slot as usize] != CTRL_EMPTY {
4342
self.current_slot += 1;
44-
return Some((gi as usize, slot as usize));
43+
return Some((gi, slot as usize));
4544
}
4645
}
4746
// Current group exhausted — try overflow chain.
@@ -155,13 +154,13 @@ impl<K, V, S> HashSortedMap<K, V, S> {
155154
pub fn iter(&self) -> Iter<'_, K, V> {
156155
Iter {
157156
groups: &self.groups,
158-
cursor: IterCursor::new(self.n_bits, self.groups.len()),
157+
cursor: IterCursor::new(self.n_bits),
159158
}
160159
}
161160

162161
/// Returns a mutable iterator over `(&K, &mut V)` pairs.
163162
pub fn iter_mut(&mut self) -> IterMut<'_, K, V> {
164-
let cursor = IterCursor::new(self.n_bits, self.groups.len());
163+
let cursor = IterCursor::new(self.n_bits);
165164
IterMut {
166165
groups: &mut *self.groups as *mut [Group<K, V>],
167166
cursor,
@@ -172,7 +171,7 @@ impl<K, V, S> HashSortedMap<K, V, S> {
172171
/// Consumes the map and returns an iterator over `(K, V)` pairs.
173172
#[allow(clippy::should_implement_trait)]
174173
pub fn into_iter(self) -> IntoIter<K, V> {
175-
let cursor = IterCursor::new(self.n_bits, self.groups.len());
174+
let cursor = IterCursor::new(self.n_bits);
176175
// Prevent Drop from running on self — we're moving groups out.
177176
let mut this = ManuallyDrop::new(self);
178177
let groups = unsafe { std::ptr::read(&this.groups) };

0 commit comments

Comments
 (0)