Skip to content

Commit

Permalink
#69 more write instead of :=
Browse files Browse the repository at this point in the history
  • Loading branch information
yegor256 committed Apr 25, 2023
1 parent a47cb20 commit 38e24a6
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/map.rs
Expand Up @@ -21,7 +21,6 @@
use crate::Pair::{Absent, Present};
use crate::{IntoIter, Iter, Map};
use std::borrow::Borrow;
use std::mem::MaybeUninit;

impl<K: PartialEq + Clone, V: Clone, const N: usize> Map<K, V, N> {
/// Make an iterator over all pairs.
Expand Down Expand Up @@ -106,12 +105,12 @@ impl<K: PartialEq + Clone, V: Clone, const N: usize> Map<K, V, N> {
for i in 0..self.next {
let p = unsafe { self.pairs[i].assume_init_ref() };
if !p.is_some() {
self.pairs[i] = MaybeUninit::new(Present((k, v)));
self.pairs[i].write(Present((k, v)));
return;
}
}
if self.next < N {
self.pairs[self.next] = MaybeUninit::new(Present((k, v)));
self.pairs[self.next].write(Present((k, v)));
self.next += 1;
return;
}
Expand Down

0 comments on commit 38e24a6

Please sign in to comment.