@@ -2394,7 +2394,8 @@ impl<T, A: Allocator> VecDeque<T, A> {
2394
2394
}
2395
2395
2396
2396
/// Binary searches this `VecDeque` for a given element.
2397
- /// This behaves similarly to [`contains`] if this `VecDeque` is sorted.
2397
+ /// If the `VecDeque` is not sorted, the returned result is unspecified and
2398
+ /// meaningless.
2398
2399
///
2399
2400
/// If the value is found then [`Result::Ok`] is returned, containing the
2400
2401
/// index of the matching element. If there are multiple matches, then any
@@ -2404,7 +2405,6 @@ impl<T, A: Allocator> VecDeque<T, A> {
2404
2405
///
2405
2406
/// See also [`binary_search_by`], [`binary_search_by_key`], and [`partition_point`].
2406
2407
///
2407
- /// [`contains`]: VecDeque::contains
2408
2408
/// [`binary_search_by`]: VecDeque::binary_search_by
2409
2409
/// [`binary_search_by_key`]: VecDeque::binary_search_by_key
2410
2410
/// [`partition_point`]: VecDeque::partition_point
@@ -2450,12 +2450,13 @@ impl<T, A: Allocator> VecDeque<T, A> {
2450
2450
}
2451
2451
2452
2452
/// Binary searches this `VecDeque` with a comparator function.
2453
- /// This behaves similarly to [`contains`] if this `VecDeque` is sorted.
2454
2453
///
2455
- /// The comparator function should implement an order consistent
2456
- /// with the sort order of the deque, returning an order code that
2457
- /// indicates whether its argument is `Less`, `Equal` or `Greater`
2458
- /// than the desired target.
2454
+ /// The comparator function should return an order code that indicates
2455
+ /// whether its argument is `Less`, `Equal` or `Greater` the desired
2456
+ /// target.
2457
+ /// If the `VecDeque` is not sorted or if the comparator function does not
2458
+ /// implement an order consistent with the sort order of the underlying
2459
+ /// `VecDeque`, the returned result is unspecified and meaningless.
2459
2460
///
2460
2461
/// If the value is found then [`Result::Ok`] is returned, containing the
2461
2462
/// index of the matching element. If there are multiple matches, then any
@@ -2465,7 +2466,6 @@ impl<T, A: Allocator> VecDeque<T, A> {
2465
2466
///
2466
2467
/// See also [`binary_search`], [`binary_search_by_key`], and [`partition_point`].
2467
2468
///
2468
- /// [`contains`]: VecDeque::contains
2469
2469
/// [`binary_search`]: VecDeque::binary_search
2470
2470
/// [`binary_search_by_key`]: VecDeque::binary_search_by_key
2471
2471
/// [`partition_point`]: VecDeque::partition_point
@@ -2505,10 +2505,11 @@ impl<T, A: Allocator> VecDeque<T, A> {
2505
2505
}
2506
2506
2507
2507
/// Binary searches this `VecDeque` with a key extraction function.
2508
- /// This behaves similarly to [`contains`] if this `VecDeque` is sorted.
2509
2508
///
2510
2509
/// Assumes that the deque is sorted by the key, for instance with
2511
2510
/// [`make_contiguous().sort_by_key()`] using the same key extraction function.
2511
+ /// If the deque is not sorted by the key, the returned result is
2512
+ /// unspecified and meaningless.
2512
2513
///
2513
2514
/// If the value is found then [`Result::Ok`] is returned, containing the
2514
2515
/// index of the matching element. If there are multiple matches, then any
@@ -2518,7 +2519,6 @@ impl<T, A: Allocator> VecDeque<T, A> {
2518
2519
///
2519
2520
/// See also [`binary_search`], [`binary_search_by`], and [`partition_point`].
2520
2521
///
2521
- /// [`contains`]: VecDeque::contains
2522
2522
/// [`make_contiguous().sort_by_key()`]: VecDeque::make_contiguous
2523
2523
/// [`binary_search`]: VecDeque::binary_search
2524
2524
/// [`binary_search_by`]: VecDeque::binary_search_by
0 commit comments