Skip to content

Commit 014434e

Browse files
committed
Docs(lib/extract_if): Unify paragraph about elements mutation
Take the one from `BTreeMap` that seems the best-worded and most precise among the available variations. Signed-off-by: Paul Mabileau <paul.mabileau@harfanglab.fr>
1 parent 9205ee2 commit 014434e

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

library/alloc/src/collections/linked_list.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1132,8 +1132,8 @@ impl<T, A: Allocator> LinkedList<T, A> {
11321132
/// or the iteration short-circuits, then the remaining elements will be retained.
11331133
/// Use `extract_if().for_each(drop)` if you do not need the returned iterator.
11341134
///
1135-
/// Note that `extract_if` lets you mutate every element in the filter closure, regardless of
1136-
/// whether you choose to keep or remove it.
1135+
/// The iterator also lets you mutate the value of each element in the
1136+
/// closure, regardless of whether you choose to keep or remove it.
11371137
///
11381138
/// # Examples
11391139
///

library/alloc/src/vec/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3692,8 +3692,8 @@ impl<T, A: Allocator> Vec<T, A> {
36923692
/// But `extract_if` is easier to use. `extract_if` is also more efficient,
36933693
/// because it can backshift the elements of the array in bulk.
36943694
///
3695-
/// Note that `extract_if` also lets you mutate the elements passed to the filter closure,
3696-
/// regardless of whether you choose to keep or remove them.
3695+
/// The iterator also lets you mutate the value of each element in the
3696+
/// closure, regardless of whether you choose to keep or remove it.
36973697
///
36983698
/// # Panics
36993699
///

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -654,8 +654,8 @@ impl<K, V, S> HashMap<K, V, S> {
654654
/// yielded. If the closure returns `false`, or panics, the element remains
655655
/// in the map and will not be yielded.
656656
///
657-
/// Note that `extract_if` lets you mutate every value in the filter closure, regardless of
658-
/// whether you choose to keep or remove it.
657+
/// The iterator also lets you mutate the value of each element in the
658+
/// closure, regardless of whether you choose to keep or remove it.
659659
///
660660
/// If the returned `ExtractIf` is not exhausted, e.g. because it is dropped without iterating
661661
/// or the iteration short-circuits, then the remaining elements will be retained.

0 commit comments

Comments
 (0)