Skip to content

Commit

Permalink
remove bounds from vec and linkedlist ExtractIf
Browse files Browse the repository at this point in the history
since drain-on-drop behavior was removed those bounds
no longer serve a purpose
  • Loading branch information
the8472 committed Nov 20, 2024
1 parent 19aae9f commit 0076504
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 10 deletions.
5 changes: 1 addition & 4 deletions library/alloc/src/collections/linked_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1939,8 +1939,7 @@ pub struct ExtractIf<
T: 'a,
F: 'a,
#[unstable(feature = "allocator_api", issue = "32838")] A: Allocator = Global,
> where
F: FnMut(&mut T) -> bool,
>
{
list: &'a mut LinkedList<T, A>,
it: Option<NonNull<Node<T>>>,
Expand Down Expand Up @@ -1980,8 +1979,6 @@ where

#[unstable(feature = "extract_if", reason = "recently added", issue = "43244")]
impl<T: fmt::Debug, F> fmt::Debug for ExtractIf<'_, T, F>
where
F: FnMut(&mut T) -> bool,
{
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_tuple("ExtractIf").field(&self.list).finish()
Expand Down
7 changes: 1 addition & 6 deletions library/alloc/src/vec/extract_if.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ pub struct ExtractIf<
T,
F,
#[unstable(feature = "allocator_api", issue = "32838")] A: Allocator = Global,
> where
F: FnMut(&mut T) -> bool,
>
{
pub(super) vec: &'a mut Vec<T, A>,
/// The index of the item that will be inspected by the next call to `next`.
Expand All @@ -41,8 +40,6 @@ pub struct ExtractIf<
}

impl<'a, T, F, A: Allocator> ExtractIf<'a, T, F, A>
where
F: FnMut(&mut T) -> bool,
{
pub(super) fn new<R: RangeBounds<usize>>(vec: &'a mut Vec<T, A>, pred: F, range: R) -> Self {
let old_len = vec.len();
Expand Down Expand Up @@ -101,8 +98,6 @@ where

#[unstable(feature = "extract_if", reason = "recently added", issue = "43244")]
impl<T, F, A: Allocator> Drop for ExtractIf<'_, T, F, A>
where
F: FnMut(&mut T) -> bool,
{
fn drop(&mut self) {
unsafe {
Expand Down

0 comments on commit 0076504

Please sign in to comment.