Skip to content

Commit

Permalink
Unify item handling
Browse files Browse the repository at this point in the history
This is how all other functions handle it.
  • Loading branch information
alexkazik committed Dec 31, 2023
1 parent 11e138c commit 82e0a2f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ impl<K: PartialEq, V, const N: usize> Map<K, V, N> {
K: Borrow<Q>,
{
for i in 0..self.next {
if let Some((bk, _bv)) = self.item(i) {
if bk.borrow() == k {
if let Some(p) = self.item(i) {
if p.0.borrow() == k {
return true;
}
}
Expand Down Expand Up @@ -177,8 +177,8 @@ impl<K: PartialEq, V, const N: usize> Map<K, V, N> {
#[inline]
pub fn retain<F: Fn(&K, &V) -> bool>(&mut self, f: F) {
for i in 0..self.next {
if let Some((k, v)) = self.item(i) {
if !f(k, v) {
if let Some(p) = self.item(i) {
if !f(&p.0, &p.1) {
self.pairs[i].write(None);
}
}
Expand Down

0 comments on commit 82e0a2f

Please sign in to comment.