Skip to content

Commit

Permalink
Rollup merge of #84121 - workingjubilee:stabilize-btree-retain, r=dto…
Browse files Browse the repository at this point in the history
…lnay

Stabilize BTree{Map,Set}::retain

Closes #79025.
FCP concluded here: #79025 (comment)

This is an approved feature on BTree{Map,Set} to mirror a functionality in Hash{Map,Set}, which has had some adequate testing since its introduction in #79026 and doesn't seem to have caused any problems since.
  • Loading branch information
Dylan-DPC committed Apr 13, 2021
2 parents 3d6a364 + 7baeaa9 commit cf67c9b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
3 changes: 1 addition & 2 deletions library/alloc/src/collections/btree/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -940,7 +940,6 @@ impl<K, V> BTreeMap<K, V> {
/// # Examples
///
/// ```
/// #![feature(btree_retain)]
/// use std::collections::BTreeMap;
///
/// let mut map: BTreeMap<i32, i32> = (0..8).map(|x| (x, x*10)).collect();
Expand All @@ -949,7 +948,7 @@ impl<K, V> BTreeMap<K, V> {
/// assert!(map.into_iter().eq(vec![(0, 0), (2, 20), (4, 40), (6, 60)]));
/// ```
#[inline]
#[unstable(feature = "btree_retain", issue = "79025")]
#[stable(feature = "btree_retain", since = "1.53.0")]
pub fn retain<F>(&mut self, mut f: F)
where
K: Ord,
Expand Down
3 changes: 1 addition & 2 deletions library/alloc/src/collections/btree/set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -851,7 +851,6 @@ impl<T> BTreeSet<T> {
/// # Examples
///
/// ```
/// #![feature(btree_retain)]
/// use std::collections::BTreeSet;
///
/// let xs = [1, 2, 3, 4, 5, 6];
Expand All @@ -860,7 +859,7 @@ impl<T> BTreeSet<T> {
/// set.retain(|&k| k % 2 == 0);
/// assert!(set.iter().eq([2, 4, 6].iter()));
/// ```
#[unstable(feature = "btree_retain", issue = "79025")]
#[stable(feature = "btree_retain", since = "1.53.0")]
pub fn retain<F>(&mut self, mut f: F)
where
T: Ord,
Expand Down

0 comments on commit cf67c9b

Please sign in to comment.