Skip to content

Commit 6537fd1

Browse files
committed
Auto merge of #46581 - tmccombs:drain_filter_drop, r=sfackler
Add Drop impl for linked_list::DrainFilter This is part of #43244. See #43244 (comment)
2 parents 61cc23e + cdf1d7d commit 6537fd1

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)