Skip to content

Commit 3a97a8a

Browse files
committed
Improve field naming in RawIntoIter
Rename `alloc` to `allocation` and `allocator` to `alloc` in `RawIntoIter`
1 parent e6b7179 commit 3a97a8a

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

src/external_trait_impls/rayon/raw.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ impl<T: Send, A: AllocRef + Clone> ParallelIterator for RawIntoParIter<T, A> {
7373
C: UnindexedConsumer<Self::Item>,
7474
{
7575
let iter = unsafe { self.table.iter().iter };
76-
let _guard = guard(self.table.into_alloc(), |alloc| {
76+
let _guard = guard(self.table.into_allocation(), |alloc| {
7777
if let Some((ptr, layout)) = *alloc {
7878
unsafe {
7979
dealloc(ptr.as_ptr(), layout);

src/raw/mod.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1182,20 +1182,20 @@ impl<T, A: AllocRef + Clone> RawTable<T, A> {
11821182
pub unsafe fn into_iter_from(self, iter: RawIter<T>) -> RawIntoIter<T, A> {
11831183
debug_assert_eq!(iter.len(), self.len());
11841184

1185-
let allocator = self.alloc.clone();
1186-
let alloc = self.into_alloc();
1185+
let alloc = self.alloc.clone();
1186+
let allocation = self.into_allocation();
11871187
RawIntoIter {
11881188
iter,
1189-
alloc,
1189+
allocation,
11901190
marker: PhantomData,
1191-
allocator,
1191+
alloc,
11921192
}
11931193
}
11941194

11951195
/// Converts the table into a raw allocation. The contents of the table
11961196
/// should be dropped using a `RawIter` before freeing the allocation.
11971197
#[cfg_attr(feature = "inline-more", inline)]
1198-
pub(crate) fn into_alloc(self) -> Option<(NonNull<u8>, Layout)> {
1198+
pub(crate) fn into_allocation(self) -> Option<(NonNull<u8>, Layout)> {
11991199
let alloc = if self.is_empty_singleton() {
12001200
None
12011201
} else {
@@ -1765,9 +1765,9 @@ impl<T> FusedIterator for RawIter<T> {}
17651765
/// Iterator which consumes a table and returns elements.
17661766
pub struct RawIntoIter<T, A: AllocRef + Clone> {
17671767
iter: RawIter<T>,
1768-
alloc: Option<(NonNull<u8>, Layout)>,
1768+
allocation: Option<(NonNull<u8>, Layout)>,
17691769
marker: PhantomData<T>,
1770-
allocator: A,
1770+
alloc: A,
17711771
}
17721772

17731773
impl<T, A: AllocRef + Clone> RawIntoIter<T, A> {
@@ -1793,8 +1793,8 @@ unsafe impl<#[may_dangle] T, A: AllocRef + Clone> Drop for RawIntoIter<T, A> {
17931793
}
17941794

17951795
// Free the table
1796-
if let Some((ptr, layout)) = self.alloc {
1797-
self.allocator.dealloc(ptr, layout);
1796+
if let Some((ptr, layout)) = self.allocation {
1797+
self.alloc.dealloc(ptr, layout);
17981798
}
17991799
}
18001800
}
@@ -1812,8 +1812,8 @@ impl<T, A: AllocRef + Clone> Drop for RawIntoIter<T, A> {
18121812
}
18131813

18141814
// Free the table
1815-
if let Some((ptr, layout)) = self.alloc {
1816-
self.allocator
1815+
if let Some((ptr, layout)) = self.allocation {
1816+
self.alloc
18171817
.dealloc(NonNull::new_unchecked(ptr.as_ptr()), layout);
18181818
}
18191819
}

0 commit comments

Comments
 (0)