@@ -26,17 +26,17 @@ pub struct ExtractIf<
26
26
F ,
27
27
#[ unstable( feature = "allocator_api" , issue = "32838" ) ] A : Allocator = Global ,
28
28
> {
29
- pub ( super ) vec : & ' a mut Vec < T , A > ,
29
+ vec : & ' a mut Vec < T , A > ,
30
30
/// The index of the item that will be inspected by the next call to `next`.
31
- pub ( super ) idx : usize ,
31
+ idx : usize ,
32
32
/// Elements at and beyond this point will be retained. Must be equal or smaller than `old_len`.
33
- pub ( super ) end : usize ,
33
+ end : usize ,
34
34
/// The number of items that have been drained (removed) thus far.
35
- pub ( super ) del : usize ,
35
+ del : usize ,
36
36
/// The original length of `vec` prior to draining.
37
- pub ( super ) old_len : usize ,
37
+ old_len : usize ,
38
38
/// The filter test predicate.
39
- pub ( super ) pred : F ,
39
+ pred : F ,
40
40
}
41
41
42
42
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> {
100
100
fn drop ( & mut self ) {
101
101
unsafe {
102
102
if self . idx < self . old_len && self . del > 0 {
103
- // This is a pretty messed up state, and there isn't really an
104
- // obviously right thing to do. We don't want to keep trying
105
- // to execute `pred`, so we just backshift all the unprocessed
106
- // elements and tell the vec that they still exist. The backshift
107
- // is required to prevent a double-drop of the last successfully
108
- // drained item prior to a panic in the predicate.
109
103
let ptr = self . vec . as_mut_ptr ( ) ;
110
104
let src = ptr. add ( self . idx ) ;
111
105
let dst = src. sub ( self . del ) ;
0 commit comments