From f1b91f4037dc4b3e70912e5a5082be969ddd8e75 Mon Sep 17 00:00:00 2001 From: David Ross Date: Sun, 27 Aug 2017 03:22:53 -0700 Subject: [PATCH] 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. --- src/liballoc/vec_deque.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/liballoc/vec_deque.rs b/src/liballoc/vec_deque.rs index bf906920029..00def2a1eac 100644 --- a/src/liballoc/vec_deque.rs +++ b/src/liballoc/vec_deque.rs @@ -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 /// /// ``` -- 2.44.0