Skip to content

Commit 5caca6f

Browse files
committed
Auto merge of #44114 - daboross:patch-1, r=dtolnay
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. If there's anything else I can do to improve this PR, I'd be happy to do so! Just saw this when reading through the docs in passing - it was slightly unclear what "fail" meant.
2 parents a0c3bd2 + f1b91f4 commit 5caca6f

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)