]> git.lizzy.rs Git - rust.git/commitdiff
Clarify that VecDeque::swap can panic
authorDavid Ross <daboross@daboross.net>
Sun, 27 Aug 2017 10:22:53 +0000 (03:22 -0700)
committerGitHub <noreply@github.com>
Sun, 27 Aug 2017 10:22:53 +0000 (03:22 -0700)
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.

src/liballoc/vec_deque.rs

index bf9069200297d8e3a52132a3b83e1e9f94097bdb..00def2a1eac49d27c908146deb1439f27b77e643 100644 (file)
@@ -459,10 +459,12 @@ pub fn get_mut(&mut self, index: usize) -> Option<&mut 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
     ///
     /// ```