Skip to content

Commit e655b96

Browse files
authored
Rollup merge of rust-lang#70843 - ssomers:btree_drain_filter_epilogue, r=Amanieu
Remove the Ord bound that was plaguing drain_filter Now that rust-lang#70795 made it superfluous. Also removes superfluous lifetime specifiers (at least I think they are).
2 parents 42abbd8 + 6ee7e8c commit e655b96

File tree

2 files changed

+21
-45
lines changed

2 files changed

+21
-45
lines changed

src/liballoc/collections/btree/map.rs

+12-29
Original file line numberDiff line numberDiff line change
@@ -1699,52 +1699,44 @@ impl<K, V> Clone for Values<'_, K, V> {
16991699
#[unstable(feature = "btree_drain_filter", issue = "70530")]
17001700
pub struct DrainFilter<'a, K, V, F>
17011701
where
1702-
K: 'a + Ord, // This Ord bound should be removed before stabilization.
1702+
K: 'a,
17031703
V: 'a,
17041704
F: 'a + FnMut(&K, &mut V) -> bool,
17051705
{
17061706
pred: F,
17071707
inner: DrainFilterInner<'a, K, V>,
17081708
}
1709-
pub(super) struct DrainFilterInner<'a, K, V>
1710-
where
1711-
K: 'a + Ord,
1712-
V: 'a,
1713-
{
1709+
pub(super) struct DrainFilterInner<'a, K: 'a, V: 'a> {
17141710
length: &'a mut usize,
17151711
cur_leaf_edge: Option<Handle<NodeRef<marker::Mut<'a>, K, V, marker::Leaf>, marker::Edge>>,
17161712
}
17171713

17181714
#[unstable(feature = "btree_drain_filter", issue = "70530")]
1719-
impl<'a, K, V, F> Drop for DrainFilter<'a, K, V, F>
1715+
impl<K, V, F> Drop for DrainFilter<'_, K, V, F>
17201716
where
1721-
K: 'a + Ord,
1722-
V: 'a,
1723-
F: 'a + FnMut(&K, &mut V) -> bool,
1717+
F: FnMut(&K, &mut V) -> bool,
17241718
{
17251719
fn drop(&mut self) {
17261720
self.for_each(drop);
17271721
}
17281722
}
17291723

17301724
#[unstable(feature = "btree_drain_filter", issue = "70530")]
1731-
impl<'a, K, V, F> fmt::Debug for DrainFilter<'a, K, V, F>
1725+
impl<K, V, F> fmt::Debug for DrainFilter<'_, K, V, F>
17321726
where
1733-
K: 'a + fmt::Debug + Ord,
1734-
V: 'a + fmt::Debug,
1735-
F: 'a + FnMut(&K, &mut V) -> bool,
1727+
K: fmt::Debug,
1728+
V: fmt::Debug,
1729+
F: FnMut(&K, &mut V) -> bool,
17361730
{
17371731
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
17381732
f.debug_tuple("DrainFilter").field(&self.inner.peek()).finish()
17391733
}
17401734
}
17411735

17421736
#[unstable(feature = "btree_drain_filter", issue = "70530")]
1743-
impl<'a, K, V, F> Iterator for DrainFilter<'a, K, V, F>
1737+
impl<K, V, F> Iterator for DrainFilter<'_, K, V, F>
17441738
where
1745-
K: 'a + Ord,
1746-
V: 'a,
1747-
F: 'a + FnMut(&K, &mut V) -> bool,
1739+
F: FnMut(&K, &mut V) -> bool,
17481740
{
17491741
type Item = (K, V);
17501742

@@ -1757,11 +1749,7 @@ where
17571749
}
17581750
}
17591751

1760-
impl<'a, K, V> DrainFilterInner<'a, K, V>
1761-
where
1762-
K: 'a + Ord,
1763-
V: 'a,
1764-
{
1752+
impl<'a, K: 'a, V: 'a> DrainFilterInner<'a, K, V> {
17651753
/// Allow Debug implementations to predict the next element.
17661754
pub(super) fn peek(&self) -> Option<(&K, &V)> {
17671755
let edge = self.cur_leaf_edge.as_ref()?;
@@ -1800,12 +1788,7 @@ where
18001788
}
18011789

18021790
#[unstable(feature = "btree_drain_filter", issue = "70530")]
1803-
impl<K, V, F> FusedIterator for DrainFilter<'_, K, V, F>
1804-
where
1805-
K: Ord,
1806-
F: FnMut(&K, &mut V) -> bool,
1807-
{
1808-
}
1791+
impl<K, V, F> FusedIterator for DrainFilter<'_, K, V, F> where F: FnMut(&K, &mut V) -> bool {}
18091792

18101793
#[stable(feature = "btree_range", since = "1.17.0")]
18111794
impl<'a, K, V> Iterator for Range<'a, K, V> {

src/liballoc/collections/btree/set.rs

+9-16
Original file line numberDiff line numberDiff line change
@@ -1094,40 +1094,38 @@ impl<'a, T> IntoIterator for &'a BTreeSet<T> {
10941094
#[unstable(feature = "btree_drain_filter", issue = "70530")]
10951095
pub struct DrainFilter<'a, T, F>
10961096
where
1097-
T: 'a + Ord,
1097+
T: 'a,
10981098
F: 'a + FnMut(&T) -> bool,
10991099
{
11001100
pred: F,
11011101
inner: super::map::DrainFilterInner<'a, T, ()>,
11021102
}
11031103

11041104
#[unstable(feature = "btree_drain_filter", issue = "70530")]
1105-
impl<'a, T, F> Drop for DrainFilter<'a, T, F>
1105+
impl<T, F> Drop for DrainFilter<'_, T, F>
11061106
where
1107-
T: 'a + Ord,
1108-
F: 'a + FnMut(&T) -> bool,
1107+
F: FnMut(&T) -> bool,
11091108
{
11101109
fn drop(&mut self) {
11111110
self.for_each(drop);
11121111
}
11131112
}
11141113

11151114
#[unstable(feature = "btree_drain_filter", issue = "70530")]
1116-
impl<'a, T, F> fmt::Debug for DrainFilter<'a, T, F>
1115+
impl<T, F> fmt::Debug for DrainFilter<'_, T, F>
11171116
where
1118-
T: 'a + Ord + fmt::Debug,
1119-
F: 'a + FnMut(&T) -> bool,
1117+
T: fmt::Debug,
1118+
F: FnMut(&T) -> bool,
11201119
{
11211120
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
11221121
f.debug_tuple("DrainFilter").field(&self.inner.peek().map(|(k, _)| k)).finish()
11231122
}
11241123
}
11251124

11261125
#[unstable(feature = "btree_drain_filter", issue = "70530")]
1127-
impl<'a, 'f, T, F> Iterator for DrainFilter<'a, T, F>
1126+
impl<'a, T, F> Iterator for DrainFilter<'_, T, F>
11281127
where
1129-
T: 'a + Ord,
1130-
F: 'a + 'f + FnMut(&T) -> bool,
1128+
F: 'a + FnMut(&T) -> bool,
11311129
{
11321130
type Item = T;
11331131

@@ -1143,12 +1141,7 @@ where
11431141
}
11441142

11451143
#[unstable(feature = "btree_drain_filter", issue = "70530")]
1146-
impl<'a, T, F> FusedIterator for DrainFilter<'a, T, F>
1147-
where
1148-
T: 'a + Ord,
1149-
F: 'a + FnMut(&T) -> bool,
1150-
{
1151-
}
1144+
impl<T, F> FusedIterator for DrainFilter<'_, T, F> where F: FnMut(&T) -> bool {}
11521145

11531146
#[stable(feature = "rust1", since = "1.0.0")]
11541147
impl<T: Ord> Extend<T> for BTreeSet<T> {

0 commit comments

Comments
 (0)