Skip to content

Commit 311fbc9

Browse files
committed
[docs] Minor wording changes to drain_filter docs
The docs currently say, "If the closure returns false, it will try again, and call the closure on the next element." But this happens regardless of whether the closure returns true or false.
1 parent b1f8e6f commit 311fbc9

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/liballoc/linked_list.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -747,8 +747,8 @@ impl<T> LinkedList<T> {
747747
/// Creates an iterator which uses a closure to determine if an element should be removed.
748748
///
749749
/// If the closure returns true, then the element is removed and yielded.
750-
/// If the closure returns false, it will try again, and call the closure on the next element,
751-
/// seeing if it passes the test.
750+
/// If the closure returns false, the element will remain in the list and will not be yielded
751+
/// by the iterator.
752752
///
753753
/// Note that `drain_filter` lets you mutate every element in the filter closure, regardless of
754754
/// whether you choose to keep or remove it.

src/liballoc/vec.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1966,8 +1966,8 @@ impl<T> Vec<T> {
19661966
/// Creates an iterator which uses a closure to determine if an element should be removed.
19671967
///
19681968
/// If the closure returns true, then the element is removed and yielded.
1969-
/// If the closure returns false, it will try again, and call the closure
1970-
/// on the next element, seeing if it passes the test.
1969+
/// If the closure returns false, the element will remain in the vector and will not be yielded
1970+
/// by the iterator.
19711971
///
19721972
/// Using this method is equivalent to the following code:
19731973
///

0 commit comments

Comments
 (0)