Skip to content

Commit 37335d3

Browse files
committed
Add Drop impl for linked_list::DrainFilter
1 parent c8ddf28 commit 37335d3

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/liballoc/linked_list.rs

+9
Original file line numberDiff line numberDiff line change
@@ -1071,6 +1071,15 @@ impl<'a, T, F> Iterator for DrainFilter<'a, T, F>
10711071
}
10721072
}
10731073

1074+
#[unstable(feature = "drain_filter", reason = "recently added", issue = "43244")]
1075+
impl<'a, T, F> Drop for DrainFilter<'a, T, F>
1076+
where F: FnMut(&mut T) -> bool,
1077+
{
1078+
fn drop(&mut self) {
1079+
for _ in self { }
1080+
}
1081+
}
1082+
10741083
#[unstable(feature = "drain_filter", reason = "recently added", issue = "43244")]
10751084
impl<'a, T: 'a + fmt::Debug, F> fmt::Debug for DrainFilter<'a, T, F>
10761085
where F: FnMut(&mut T) -> bool

0 commit comments

Comments
 (0)