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

Commit

Permalink
Rollup merge of rust-lang#131809 - collinoc:fix-retain-mut-docs, r=jh…
Browse files Browse the repository at this point in the history
…pratt

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.
  • Loading branch information
jhpratt authored Oct 18, 2024
2 parents 421ce58 + 3ed5d55 commit c3fcc0d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion library/alloc/src/collections/linked_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1082,7 +1082,7 @@ impl<T, A: Allocator> LinkedList<T, A> {

/// Retains only the elements specified by the predicate.
///
/// In other words, remove all elements `e` for which `f(&e)` returns false.
/// In other words, remove all elements `e` for which `f(&mut e)` returns false.
/// This method operates in place, visiting each element exactly once in the
/// original order, and preserves the order of the retained elements.
///
Expand Down
2 changes: 1 addition & 1 deletion library/alloc/src/collections/vec_deque/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2122,7 +2122,7 @@ impl<T, A: Allocator> VecDeque<T, A> {

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

0 comments on commit c3fcc0d

Please sign in to comment.