Skip to content

Commit

Permalink
remove obsolete comment and pub(super) visibility
Browse files Browse the repository at this point in the history
  • Loading branch information
the8472 committed Nov 20, 2024
1 parent d4560ba commit aabed33
Showing 1 changed file with 6 additions and 12 deletions.
18 changes: 6 additions & 12 deletions library/alloc/src/vec/extract_if.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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> {
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit aabed33

Please sign in to comment.