add necessary closure for partition_point

This commit is contained in:
Jane Lusby 2022-04-06 18:14:21 -07:00
parent c957b809e9
commit 0eb0d891ad
2 changed files with 4 additions and 4 deletions

View File

@ -2600,7 +2600,7 @@ impl<T, A: Allocator> VecDeque<T, A> {
///
/// let mut deque: VecDeque<_> = [0, 1, 1, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55].into();
/// let num = 42;
/// let idx = deque.partition_point(&num);
/// let idx = deque.partition_point(|&x| x < num);
/// // The above is equivalent to `let idx = deque.binary_search(&num).unwrap_or_else(|x| x);`
/// deque.insert(idx, num);
/// assert_eq!(deque, &[0, 1, 1, 1, 1, 2, 3, 5, 8, 13, 21, 34, 42, 55]);
@ -2754,7 +2754,7 @@ impl<T, A: Allocator> VecDeque<T, A> {
///
/// let mut deque: VecDeque<_> = [0, 1, 1, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55].into();
/// let num = 42;
/// let idx = deque.partition_point(&num);
/// let idx = deque.partition_point(|&x| x < num);
/// deque.insert(idx, num);
/// assert_eq!(deque, &[0, 1, 1, 1, 1, 2, 3, 5, 8, 13, 21, 34, 42, 55]);
/// ```

View File

@ -2337,7 +2337,7 @@ impl<T> [T] {
/// ```
/// let mut s = vec![0, 1, 1, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55];
/// let num = 42;
/// let idx = s.partition_point(&num);
/// let idx = s.partition_point(|&x| x < num);
/// // The above is equivalent to `let idx = s.binary_search(&num).unwrap_or_else(|x| x);`
/// s.insert(idx, num);
/// assert_eq!(s, [0, 1, 1, 1, 1, 2, 3, 5, 8, 13, 21, 34, 42, 55]);
@ -3752,7 +3752,7 @@ impl<T> [T] {
/// ```
/// let mut s = vec![0, 1, 1, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55];
/// let num = 42;
/// let idx = s.partition_point(&num);
/// let idx = s.partition_point(|&x| x < num);
/// s.insert(idx, num);
/// assert_eq!(s, [0, 1, 1, 1, 1, 2, 3, 5, 8, 13, 21, 34, 42, 55]);
/// ```