diff options
| author | The 8472 <git@infinite-source.de> | 2024-11-20 23:53:35 +0100 |
|---|---|---|
| committer | The 8472 <git@infinite-source.de> | 2024-12-16 22:06:52 +0100 |
| commit | 44790c490902d3eb5871a13b80ac4d6c19909278 (patch) | |
| tree | d4e42cfcea924b1cfd9d015ed22b843f8b69d1aa /library/alloc | |
| parent | fe521506a61c9ec437213882dc7b80203b81c341 (diff) | |
remove obsolete comment and pub(super) visibility
Diffstat (limited to 'library/alloc')
| -rw-r--r-- | library/alloc/src/vec/extract_if.rs | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/library/alloc/src/vec/extract_if.rs b/library/alloc/src/vec/extract_if.rs index 1ea7cbdc7e8..4db13981596 100644 --- a/library/alloc/src/vec/extract_if.rs +++ b/library/alloc/src/vec/extract_if.rs @@ -26,17 +26,17 @@ pub struct ExtractIf< F, #[unstable(feature = "allocator_api", issue = "32838")] A: Allocator = Global, > { - pub(super) vec: &'a mut Vec<T, A>, + vec: &'a mut Vec<T, A>, /// The index of the item that will be inspected by the next call to `next`. - pub(super) idx: usize, + idx: usize, /// Elements at and beyond this point will be retained. Must be equal or smaller than `old_len`. - pub(super) end: usize, + end: usize, /// The number of items that have been drained (removed) thus far. - pub(super) del: usize, + del: usize, /// The original length of `vec` prior to draining. - pub(super) old_len: usize, + old_len: usize, /// The filter test predicate. - pub(super) pred: F, + pred: F, } impl<'a, T, F, A: Allocator> ExtractIf<'a, T, F, A> { @@ -100,12 +100,6 @@ impl<T, F, A: Allocator> Drop for ExtractIf<'_, T, F, A> { fn drop(&mut self) { unsafe { if self.idx < self.old_len && self.del > 0 { - // This is a pretty messed up state, and there isn't really an - // obviously right thing to do. We don't want to keep trying - // to execute `pred`, so we just backshift all the unprocessed - // elements and tell the vec that they still exist. The backshift - // is required to prevent a double-drop of the last successfully - // drained item prior to a panic in the predicate. let ptr = self.vec.as_mut_ptr(); let src = ptr.add(self.idx); let dst = src.sub(self.del); |
