remove obsolete comment and pub(super) visibility
This commit is contained in:
parent
fe521506a6
commit
44790c4909
1 changed files with 6 additions and 12 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Reference in a new issue