]> git.lizzy.rs Git - rust.git/commitdiff
minor fixes to Vec docs and bounds check
authorAlexis <a.beingessner@gmail.com>
Sat, 7 Feb 2015 19:58:58 +0000 (14:58 -0500)
committerAlexis <a.beingessner@gmail.com>
Sat, 7 Feb 2015 19:58:58 +0000 (14:58 -0500)
src/libcollections/vec.rs

index 4a082c3616cb91bbfe2d5d1e2332f201f5f4ecbb..70097c956cd0ef942f5515465691be8a6669f534 100644 (file)
@@ -690,7 +690,8 @@ pub fn pop(&mut self) -> Option<T> {
     /// Panics if the number of elements in the vector overflows a `usize`.
     ///
     /// # Examples
-    /// ```rust
+    ///
+    /// ```
     /// let mut vec = vec![1, 2, 3];
     /// let mut vec2 = vec![4, 5, 6];
     /// vec.append(&mut vec2);
@@ -1002,8 +1003,13 @@ pub fn map_in_place<U, F>(self, mut f: F) -> Vec<U> where F: FnMut(T) -> U {
     ///
     /// Note that the capacity of `self` does not change.
     ///
+    /// # Panics
+    ///
+    /// Panics if `at > len`.
+    ///
     /// # Examples
-    /// ```rust
+    ///
+    /// ```
     /// let mut vec = vec![1,2,3];
     /// let vec2 = vec.split_off(1);
     /// assert_eq!(vec, vec![1]);
@@ -1013,7 +1019,7 @@ pub fn map_in_place<U, F>(self, mut f: F) -> Vec<U> where F: FnMut(T) -> U {
     #[unstable(feature = "collections",
                reason = "new API, waiting for dust to settle")]
     pub fn split_off(&mut self, at: usize) -> Self {
-        assert!(at < self.len(), "`at` out of bounds");
+        assert!(at <= self.len(), "`at` out of bounds");
 
         let other_len = self.len - at;
         let mut other = Vec::with_capacity(other_len);