Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit f1e2d70

Browse files
committedNov 20, 2024
remove bounds from vec and linkedlist ExtractIf
since drain-on-drop behavior was removed those bounds no longer serve a purpose
1 parent 19aae9f commit f1e2d70

File tree

2 files changed

+7
-19
lines changed

2 files changed

+7
-19
lines changed
 

‎library/alloc/src/collections/linked_list.rs

+2-7
Original file line numberDiff line numberDiff line change
@@ -1939,9 +1939,7 @@ pub struct ExtractIf<
19391939
T: 'a,
19401940
F: 'a,
19411941
#[unstable(feature = "allocator_api", issue = "32838")] A: Allocator = Global,
1942-
> where
1943-
F: FnMut(&mut T) -> bool,
1944-
{
1942+
> {
19451943
list: &'a mut LinkedList<T, A>,
19461944
it: Option<NonNull<Node<T>>>,
19471945
pred: F,
@@ -1979,10 +1977,7 @@ where
19791977
}
19801978

19811979
#[unstable(feature = "extract_if", reason = "recently added", issue = "43244")]
1982-
impl<T: fmt::Debug, F> fmt::Debug for ExtractIf<'_, T, F>
1983-
where
1984-
F: FnMut(&mut T) -> bool,
1985-
{
1980+
impl<T: fmt::Debug, F> fmt::Debug for ExtractIf<'_, T, F> {
19861981
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
19871982
f.debug_tuple("ExtractIf").field(&self.list).finish()
19881983
}

‎library/alloc/src/vec/extract_if.rs

+5-12
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
use core::{ops::{Range, RangeBounds}, ptr, slice};
1+
use core::ops::{Range, RangeBounds};
2+
use core::{ptr, slice};
23

34
use super::Vec;
45
use crate::alloc::{Allocator, Global};
@@ -24,9 +25,7 @@ pub struct ExtractIf<
2425
T,
2526
F,
2627
#[unstable(feature = "allocator_api", issue = "32838")] A: Allocator = Global,
27-
> where
28-
F: FnMut(&mut T) -> bool,
29-
{
28+
> {
3029
pub(super) vec: &'a mut Vec<T, A>,
3130
/// The index of the item that will be inspected by the next call to `next`.
3231
pub(super) idx: usize,
@@ -40,10 +39,7 @@ pub struct ExtractIf<
4039
pub(super) pred: F,
4140
}
4241

43-
impl<'a, T, F, A: Allocator> ExtractIf<'a, T, F, A>
44-
where
45-
F: FnMut(&mut T) -> bool,
46-
{
42+
impl<'a, T, F, A: Allocator> ExtractIf<'a, T, F, A> {
4743
pub(super) fn new<R: RangeBounds<usize>>(vec: &'a mut Vec<T, A>, pred: F, range: R) -> Self {
4844
let old_len = vec.len();
4945
let Range { start, end } = slice::range(range, ..old_len);
@@ -100,10 +96,7 @@ where
10096
}
10197

10298
#[unstable(feature = "extract_if", reason = "recently added", issue = "43244")]
103-
impl<T, F, A: Allocator> Drop for ExtractIf<'_, T, F, A>
104-
where
105-
F: FnMut(&mut T) -> bool,
106-
{
99+
impl<T, F, A: Allocator> Drop for ExtractIf<'_, T, F, A> {
107100
fn drop(&mut self) {
108101
unsafe {
109102
if self.idx < self.old_len && self.del > 0 {

0 commit comments

Comments
 (0)
Please sign in to comment.