Rollup merge of #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.
This commit is contained in:
许杰友 Jieyou Xu (Joe) 2024-10-18 12:00:52 +01:00 committed by GitHub
commit 759820e631
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 2 additions and 2 deletions

View File

@ -1082,7 +1082,7 @@ pub fn retain<F>(&mut self, mut f: F)
/// 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.
///

View File

@ -2122,7 +2122,7 @@ pub fn retain<F>(&mut self, mut f: F)
/// 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.
///