Skip to content

Commit 9205ee2

Browse files
committed
Docs(lib/extract_if): Unify paragraph about closure actions
Also fixes `HashSet`'s that incorrectly designated itself as a `list`. Signed-off-by: Paul Mabileau <paul.mabileau@harfanglab.fr>
1 parent 35f8473 commit 9205ee2

File tree

4 files changed

+12
-12
lines changed

4 files changed

+12
-12
lines changed

library/alloc/src/collections/linked_list.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1124,9 +1124,9 @@ impl<T, A: Allocator> LinkedList<T, A> {
11241124

11251125
/// Creates an iterator which uses a closure to determine if an element should be removed.
11261126
///
1127-
/// If the closure returns true, then the element is removed and yielded.
1128-
/// If the closure returns false, the element will remain in the list and will not be yielded
1129-
/// by the iterator.
1127+
/// If the closure returns `true`, the element is removed from the list and
1128+
/// yielded. If the closure returns `false`, or panics, the element remains
1129+
/// in the list and will not be yielded.
11301130
///
11311131
/// If the returned `ExtractIf` is not exhausted, e.g. because it is dropped without iterating
11321132
/// or the iteration short-circuits, then the remaining elements will be retained.

library/alloc/src/vec/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3650,9 +3650,9 @@ impl<T, A: Allocator> Vec<T, A> {
36503650

36513651
/// Creates an iterator which uses a closure to determine if an element in the range should be removed.
36523652
///
3653-
/// If the closure returns true, then the element is removed and yielded.
3654-
/// If the closure returns false, the element will remain in the vector and will not be yielded
3655-
/// by the iterator.
3653+
/// If the closure returns `true`, the element is removed from the vector
3654+
/// and yielded. If the closure returns `false`, or panics, the element
3655+
/// remains in the vector and will not be yielded.
36563656
///
36573657
/// Only elements that fall in the provided range are considered for extraction, but any elements
36583658
/// after the range will still have to be moved if any element has been extracted.

library/std/src/collections/hash/map.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -650,9 +650,9 @@ impl<K, V, S> HashMap<K, V, S> {
650650

651651
/// Creates an iterator which uses a closure to determine if an element should be removed.
652652
///
653-
/// If the closure returns true, the element is removed from the map and yielded.
654-
/// If the closure returns false, or panics, the element remains in the map and will not be
655-
/// yielded.
653+
/// If the closure returns `true`, the element is removed from the map and
654+
/// yielded. If the closure returns `false`, or panics, the element remains
655+
/// in the map and will not be yielded.
656656
///
657657
/// Note that `extract_if` lets you mutate every value in the filter closure, regardless of
658658
/// whether you choose to keep or remove it.

library/std/src/collections/hash/set.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -278,9 +278,9 @@ impl<T, S> HashSet<T, S> {
278278

279279
/// Creates an iterator which uses a closure to determine if an element should be removed.
280280
///
281-
/// If the closure returns true, then the element is removed and yielded.
282-
/// If the closure returns false, the element will remain in the list and will not be yielded
283-
/// by the iterator.
281+
/// If the closure returns `true`, the element is removed from the set and
282+
/// yielded. If the closure returns `false`, or panics, the element remains
283+
/// in the set and will not be yielded.
284284
///
285285
/// If the returned `ExtractIf` is not exhausted, e.g. because it is dropped without iterating
286286
/// or the iteration short-circuits, then the remaining elements will be retained.

0 commit comments

Comments
 (0)