Skip to content

Commit

Permalink
Auto merge of #44114 - daboross:patch-1, r=dtolnay
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
bors committed Aug 28, 2017
2 parents a0c3bd2 + f1b91f4 commit 5caca6f
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/liballoc/vec_deque.rs
Original file line number Diff line number Diff line change
Expand Up @@ -459,10 +459,12 @@ impl<T> VecDeque<T> {
///
/// `i` and `j` may be equal.
///
/// Fails if there is no element with either index.
///
/// Element at index 0 is the front of the queue.
///
/// # Panics
///
/// Panics if either index is out of bounds.
///
/// # Examples
///
/// ```
Expand Down

0 comments on commit 5caca6f

Please sign in to comment.