Skip to content

Commit c6a4d44

Browse files
authored
Rollup merge of #112677 - the8472:remove-unusued-field, r=JohnTitor
remove unused field Followup to #104455. The field is no longer needed since ExtractIf (previously DrainFilter) doesn't keep draining in its drop impl.
2 parents 27e10c5 + 64ee0f7 commit c6a4d44

File tree

2 files changed

+1
-9
lines changed

2 files changed

+1
-9
lines changed

library/alloc/src/vec/extract_if.rs

-8
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,6 @@ pub struct ExtractIf<
3737
pub(super) old_len: usize,
3838
/// The filter test predicate.
3939
pub(super) pred: F,
40-
/// A flag that indicates a panic has occurred in the filter test predicate.
41-
/// This is used as a hint in the drop implementation to prevent consumption
42-
/// of the remainder of the `ExtractIf`. Any unprocessed items will be
43-
/// backshifted in the `vec`, but no further items will be dropped or
44-
/// tested by the filter predicate.
45-
pub(super) panic_flag: bool,
4640
}
4741

4842
impl<T, F, A: Allocator> ExtractIf<'_, T, F, A>
@@ -69,9 +63,7 @@ where
6963
while self.idx < self.old_len {
7064
let i = self.idx;
7165
let v = slice::from_raw_parts_mut(self.vec.as_mut_ptr(), self.old_len);
72-
self.panic_flag = true;
7366
let drained = (self.pred)(&mut v[i]);
74-
self.panic_flag = false;
7567
// Update the index *after* the predicate is called. If the index
7668
// is updated prior and the predicate panics, the element at this
7769
// index would be leaked.

library/alloc/src/vec/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2948,7 +2948,7 @@ impl<T, A: Allocator> Vec<T, A> {
29482948
self.set_len(0);
29492949
}
29502950

2951-
ExtractIf { vec: self, idx: 0, del: 0, old_len, pred: filter, panic_flag: false }
2951+
ExtractIf { vec: self, idx: 0, del: 0, old_len, pred: filter }
29522952
}
29532953
}
29542954

0 commit comments

Comments
 (0)