diff --git a/library/alloc/src/collections/btree/map.rs b/library/alloc/src/collections/btree/map.rs index 52b98291ff93f..17c16e4aafff7 100644 --- a/library/alloc/src/collections/btree/map.rs +++ b/library/alloc/src/collections/btree/map.rs @@ -1416,18 +1416,18 @@ impl BTreeMap { /// /// # Examples /// - /// Splitting a map into even and odd keys, reusing the original map: - /// /// ``` /// #![feature(btree_extract_if)] /// use std::collections::BTreeMap; /// + /// // Splitting a map into even and odd keys, reusing the original map: /// let mut map: BTreeMap = (0..8).map(|x| (x, x)).collect(); /// let evens: BTreeMap<_, _> = map.extract_if(.., |k, _v| k % 2 == 0).collect(); /// let odds = map; /// assert_eq!(evens.keys().copied().collect::>(), [0, 2, 4, 6]); /// assert_eq!(odds.keys().copied().collect::>(), [1, 3, 5, 7]); /// + /// // Splitting a map into low and high halves, reusing the original map: /// let mut map: BTreeMap = (0..8).map(|x| (x, x)).collect(); /// let low: BTreeMap<_, _> = map.extract_if(0..4, |_k, _v| true).collect(); /// let high = map; diff --git a/library/alloc/src/collections/btree/set.rs b/library/alloc/src/collections/btree/set.rs index 780bd8b0dd143..51418036f428e 100644 --- a/library/alloc/src/collections/btree/set.rs +++ b/library/alloc/src/collections/btree/set.rs @@ -1201,21 +1201,21 @@ impl BTreeSet { /// [`retain`]: BTreeSet::retain /// # Examples /// - /// Splitting a set into even and odd values, reusing the original set: - /// /// ``` /// #![feature(btree_extract_if)] /// use std::collections::BTreeSet; /// + /// // Splitting a set into even and odd values, reusing the original set: /// let mut set: BTreeSet = (0..8).collect(); /// let evens: BTreeSet<_> = set.extract_if(.., |v| v % 2 == 0).collect(); /// let odds = set; /// assert_eq!(evens.into_iter().collect::>(), vec![0, 2, 4, 6]); /// assert_eq!(odds.into_iter().collect::>(), vec![1, 3, 5, 7]); /// - /// let mut map: BTreeSet = (0..8).collect(); - /// let low: BTreeSet<_> = map.extract_if(0..4, |_v| true).collect(); - /// let high = map; + /// // Splitting a set into low and high halves, reusing the original set: + /// let mut set: BTreeSet = (0..8).collect(); + /// let low: BTreeSet<_> = set.extract_if(0..4, |_v| true).collect(); + /// let high = set; /// assert_eq!(low.into_iter().collect::>(), [0, 1, 2, 3]); /// assert_eq!(high.into_iter().collect::>(), [4, 5, 6, 7]); /// ```