Skip to content

Commit ff4bf73

Browse files
Rollup merge of #86789 - janikrabe:btreeset-drainfilter-doc, r=kennytm
Update BTreeSet::drain_filter documentation This commit makes the documentation of `BTreeSet::drain_filter` more consistent with that of `BTreeMap::drain_filter` after the changes in f0b8166. In particular, this explicitly documents the iteration order.
2 parents d12b168 + 3b2ad49 commit ff4bf73

File tree

1 file changed

+11
-9
lines changed
  • library/alloc/src/collections/btree

1 file changed

+11
-9
lines changed

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

+11-9
Original file line numberDiff line numberDiff line change
@@ -940,18 +940,20 @@ impl<T> BTreeSet<T> {
940940
BTreeSet { map: self.map.split_off(key) }
941941
}
942942

943-
/// Creates an iterator which uses a closure to determine if a value should be removed.
943+
/// Creates an iterator that visits all values in ascending order and uses a closure
944+
/// to determine if a value should be removed.
944945
///
945-
/// If the closure returns true, then the value is removed and yielded.
946-
/// If the closure returns false, the value will remain in the list and will not be yielded
947-
/// by the iterator.
946+
/// If the closure returns `true`, the value is removed from the set and yielded. If
947+
/// the closure returns `false`, or panics, the value remains in the set and will
948+
/// not be yielded.
948949
///
949-
/// If the iterator is only partially consumed or not consumed at all, each of the remaining
950-
/// values will still be subjected to the closure and removed and dropped if it returns true.
950+
/// If the iterator is only partially consumed or not consumed at all, each of the
951+
/// remaining values is still subjected to the closure and removed and dropped if it
952+
/// returns `true`.
951953
///
952-
/// It is unspecified how many more values will be subjected to the closure
953-
/// if a panic occurs in the closure, or if a panic occurs while dropping a value, or if the
954-
/// `DrainFilter` itself is leaked.
954+
/// It is unspecified how many more values will be subjected to the closure if a
955+
/// panic occurs in the closure, or if a panic occurs while dropping a value, or if
956+
/// the `DrainFilter` itself is leaked.
955957
///
956958
/// # Examples
957959
///

0 commit comments

Comments
 (0)