Skip to content

Commit f0b8166

Browse files
committed
BTreeMap: fix documentation of unstable public members
1 parent 5605b5d commit f0b8166

File tree

2 files changed

+18
-16
lines changed

2 files changed

+18
-16
lines changed

library/alloc/src/collections/btree/map.rs

+17-15
Original file line numberDiff line numberDiff line change
@@ -1117,21 +1117,23 @@ impl<K: Ord, V> BTreeMap<K, V> {
11171117
right
11181118
}
11191119

1120-
/// Creates an iterator which uses a closure to determine if an element should be removed.
1121-
///
1122-
/// If the closure returns true, the element is removed from the map and yielded.
1123-
/// If the closure returns false, or panics, the element remains in the map and will not be
1124-
/// yielded.
1125-
///
1126-
/// Note that `drain_filter` lets you mutate every value in the filter closure, regardless of
1127-
/// whether you choose to keep or remove it.
1128-
///
1129-
/// If the iterator is only partially consumed or not consumed at all, each of the remaining
1130-
/// elements will still be subjected to the closure and removed and dropped if it returns true.
1131-
///
1132-
/// It is unspecified how many more elements will be subjected to the closure
1133-
/// if a panic occurs in the closure, or a panic occurs while dropping an element,
1134-
/// or if the `DrainFilter` value is leaked.
1120+
/// Creates an iterator that visits all elements (key-value pairs) in
1121+
/// ascending key order and uses a closure to determine if an element should
1122+
/// be removed. If the closure returns `true`, the element is removed from
1123+
/// the map and yielded. If the closure returns `false`, or panics, the
1124+
/// element remains in the map and will not be yielded.
1125+
///
1126+
/// The iterator also lets you mutate the value of each element in the
1127+
/// closure, regardless of whether you choose to keep or remove it.
1128+
///
1129+
/// If the iterator is only partially consumed or not consumed at all, each
1130+
/// of the remaining elements is still subjected to the closure, which may
1131+
/// change its value and, by returning `true`, have the element removed and
1132+
/// dropped.
1133+
///
1134+
/// It is unspecified how many more elements will be subjected to the
1135+
/// closure if a panic occurs in the closure, or a panic occurs while
1136+
/// dropping an element, or if the `DrainFilter` value is leaked.
11351137
///
11361138
/// # Examples
11371139
///

library/alloc/src/collections/btree/set.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -652,7 +652,7 @@ impl<T: Ord> BTreeSet<T> {
652652
/// use std::collections::BTreeSet;
653653
///
654654
/// let mut map = BTreeSet::new();
655-
/// assert_eq!(map.first(), None);
655+
/// assert_eq!(map.last(), None);
656656
/// map.insert(1);
657657
/// assert_eq!(map.last(), Some(&1));
658658
/// map.insert(2);

0 commit comments

Comments
 (0)