Skip to content

Commit

Permalink
argon2: simplify ParallelIterator impl for SegmentViewIter
Browse files Browse the repository at this point in the history
  • Loading branch information
jonasmalacofilho committed Jan 21, 2025
1 parent ea63ecd commit 5eefce1
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions argon2/src/memory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use core::marker::PhantomData;
use core::ptr::NonNull;

#[cfg(feature = "parallel")]
use rayon::iter::{plumbing::bridge, IntoParallelIterator, ParallelIterator};
use rayon::iter::{IntoParallelIterator, ParallelIterator};

use crate::{Block, SYNC_POINTS};

Expand Down Expand Up @@ -92,14 +92,14 @@ impl<'a> ParallelIterator for SegmentViewIter<'a> {
where
C: rayon::iter::plumbing::UnindexedConsumer<Self::Item>,
{
bridge(
(0..self.inner.lanes).into_par_iter().map(|lane| {
(0..self.inner.lanes)
.into_par_iter()
.map(|lane| {
// SAFETY: `self` mutably borrows the underlying memory region for a single Argon2
// slice, and we create exactly one memory view per lane.
unsafe { SegmentView::new(self.inner.unsafe_copy(), lane) }
}),
consumer,
)
})
.drive_unindexed(consumer)
}
}

Expand Down

0 comments on commit 5eefce1

Please sign in to comment.