diff options
| author | Takayuki Maeda <takoyaki0316@gmail.com> | 2023-06-26 23:16:16 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-06-26 23:16:16 +0900 |
| commit | c6a4d449775bc12ae9fabd0b45849fd9103977ab (patch) | |
| tree | 4d313daf0596a5329c028a30ad2620561de3f28a | |
| parent | 27e10c5292eee22abef69aed7144f80bdea00603 (diff) | |
| parent | 64ee0f74eb4d724e87601fea4bd6b18377289fa2 (diff) | |
| download | rust-c6a4d449775bc12ae9fabd0b45849fd9103977ab.tar.gz rust-c6a4d449775bc12ae9fabd0b45849fd9103977ab.zip | |
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.
| -rw-r--r-- | library/alloc/src/vec/extract_if.rs | 8 | ||||
| -rw-r--r-- | library/alloc/src/vec/mod.rs | 2 |
2 files changed, 1 insertions, 9 deletions
diff --git a/library/alloc/src/vec/extract_if.rs b/library/alloc/src/vec/extract_if.rs index e8e6bd56d21..118cfdb36b9 100644 --- a/library/alloc/src/vec/extract_if.rs +++ b/library/alloc/src/vec/extract_if.rs @@ -37,12 +37,6 @@ pub struct ExtractIf< pub(super) old_len: usize, /// The filter test predicate. pub(super) pred: F, - /// A flag that indicates a panic has occurred in the filter test predicate. - /// This is used as a hint in the drop implementation to prevent consumption - /// of the remainder of the `ExtractIf`. Any unprocessed items will be - /// backshifted in the `vec`, but no further items will be dropped or - /// tested by the filter predicate. - pub(super) panic_flag: bool, } impl<T, F, A: Allocator> ExtractIf<'_, T, F, A> @@ -69,9 +63,7 @@ where while self.idx < self.old_len { let i = self.idx; let v = slice::from_raw_parts_mut(self.vec.as_mut_ptr(), self.old_len); - self.panic_flag = true; let drained = (self.pred)(&mut v[i]); - self.panic_flag = false; // Update the index *after* the predicate is called. If the index // is updated prior and the predicate panics, the element at this // index would be leaked. diff --git a/library/alloc/src/vec/mod.rs b/library/alloc/src/vec/mod.rs index a30c6a44e07..ef4f8be6f19 100644 --- a/library/alloc/src/vec/mod.rs +++ b/library/alloc/src/vec/mod.rs @@ -2948,7 +2948,7 @@ impl<T, A: Allocator> Vec<T, A> { self.set_len(0); } - ExtractIf { vec: self, idx: 0, del: 0, old_len, pred: filter, panic_flag: false } + ExtractIf { vec: self, idx: 0, del: 0, old_len, pred: filter } } } |
