summary refs log tree commit diff
path: root/library/alloc/src
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume1.gomez@gmail.com>2021-07-08 18:30:34 +0200
committerGitHub <noreply@github.com>2021-07-08 18:30:34 +0200
commitff4bf73a4274623e302fcde1f7914d6cf8da40e7 (patch)
tree3fa34cd04079fb3807c15935fd3d11e99b11b635 /library/alloc/src
parentd12b16887baa36e6c372d088d3661b4287dc70e1 (diff)
parent3b2ad49a7ad7f7e3edcd50477e7fd30df8a21876 (diff)
downloadrust-ff4bf73a4274623e302fcde1f7914d6cf8da40e7.tar.gz
rust-ff4bf73a4274623e302fcde1f7914d6cf8da40e7.zip
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
f0b8166870bd73a872642f090ae6b88e2bef922a.

In particular, this explicitly documents the iteration order.
Diffstat (limited to 'library/alloc/src')
-rw-r--r--library/alloc/src/collections/btree/set.rs20
1 files changed, 11 insertions, 9 deletions
diff --git a/library/alloc/src/collections/btree/set.rs b/library/alloc/src/collections/btree/set.rs
index 34ec27e461c..45ea30b5386 100644
--- a/library/alloc/src/collections/btree/set.rs
+++ b/library/alloc/src/collections/btree/set.rs
@@ -940,18 +940,20 @@ impl<T> BTreeSet<T> {
         BTreeSet { map: self.map.split_off(key) }
     }
 
-    /// Creates an iterator which uses a closure to determine if a value should be removed.
+    /// Creates an iterator that visits all values in ascending order and uses a closure
+    /// to determine if a value should be removed.
     ///
-    /// If the closure returns true, then the value is removed and yielded.
-    /// If the closure returns false, the value will remain in the list and will not be yielded
-    /// by the iterator.
+    /// If the closure returns `true`, the value is removed from the set and yielded. If
+    /// the closure returns `false`, or panics, the value remains in the set and will
+    /// not be yielded.
     ///
-    /// If the iterator is only partially consumed or not consumed at all, each of the remaining
-    /// values will still be subjected to the closure and removed and dropped if it returns true.
+    /// If the iterator is only partially consumed or not consumed at all, each of the
+    /// remaining values is still subjected to the closure and removed and dropped if it
+    /// returns `true`.
     ///
-    /// It is unspecified how many more values will be subjected to the closure
-    /// if a panic occurs in the closure, or if a panic occurs while dropping a value, or if the
-    /// `DrainFilter` itself is leaked.
+    /// It is unspecified how many more values will be subjected to the closure if a
+    /// panic occurs in the closure, or if a panic occurs while dropping a value, or if
+    /// the `DrainFilter` itself is leaked.
     ///
     /// # Examples
     ///