Skip to content
/ rust Public
forked from rust-lang/rust

Commit 11b8085

Browse files
authored
Rollup merge of rust-lang#131809 - collinoc:fix-retain-mut-docs, r=jhpratt
Fix predicate signatures in retain_mut docs This is my first PR here so let me know if I'm doing anything wrong. The docs for `retain_mut` in `LinkedList` and `VecDeque` say the predicate takes `&e`, but it should be `&mut e` to match the actual signature. `Vec` [has it documented](https://doc.rust-lang.org/std/vec/struct.Vec.html#method.retain_mut) correctly already.
2 parents da3c66a + 3ed5d55 commit 11b8085

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

library/alloc/src/collections/linked_list.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1082,7 +1082,7 @@ impl<T, A: Allocator> LinkedList<T, A> {
10821082

10831083
/// Retains only the elements specified by the predicate.
10841084
///
1085-
/// In other words, remove all elements `e` for which `f(&e)` returns false.
1085+
/// In other words, remove all elements `e` for which `f(&mut e)` returns false.
10861086
/// This method operates in place, visiting each element exactly once in the
10871087
/// original order, and preserves the order of the retained elements.
10881088
///

library/alloc/src/collections/vec_deque/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2122,7 +2122,7 @@ impl<T, A: Allocator> VecDeque<T, A> {
21222122

21232123
/// Retains only the elements specified by the predicate.
21242124
///
2125-
/// In other words, remove all elements `e` for which `f(&e)` returns false.
2125+
/// In other words, remove all elements `e` for which `f(&mut e)` returns false.
21262126
/// This method operates in place, visiting each element exactly once in the
21272127
/// original order, and preserves the order of the retained elements.
21282128
///

0 commit comments

Comments
 (0)