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.
This commit is contained in:
David Ross 2017-08-27 03:22:53 -07:00 committed by GitHub
parent 93cdf5e3c4
commit f1b91f4037

View File

@ -459,10 +459,12 @@ impl<T> VecDeque<T> {
/// ///
/// `i` and `j` may be equal. /// `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. /// Element at index 0 is the front of the queue.
/// ///
/// # Panics
///
/// Panics if either index is out of bounds.
///
/// # Examples /// # Examples
/// ///
/// ``` /// ```