Skip to content

Commit f1b91f4

Browse files
authored
Clarify that VecDeque::swap can panic
The previous documentation mentioned this, but ambiguously used the term "fail". This clarifies that the function will panic if the index is out of bounds, instead of silently failing and not doing anything.
1 parent 93cdf5e commit f1b91f4

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/liballoc/vec_deque.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -459,10 +459,12 @@ impl<T> VecDeque<T> {
459459
///
460460
/// `i` and `j` may be equal.
461461
///
462-
/// Fails if there is no element with either index.
463-
///
464462
/// Element at index 0 is the front of the queue.
465463
///
464+
/// # Panics
465+
///
466+
/// Panics if either index is out of bounds.
467+
///
466468
/// # Examples
467469
///
468470
/// ```

0 commit comments

Comments
 (0)