Skip to content

Commit

Permalink
Auto merge of #22059 - Gankro:vec-split, r=alexcrichton
Browse files Browse the repository at this point in the history
  • Loading branch information
bors committed Feb 9, 2015
2 parents 00df325 + 09164f3 commit 0ba9e1f
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/libcollections/vec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -690,7 +690,8 @@ impl<T> Vec<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);
Expand Down Expand Up @@ -1002,8 +1003,13 @@ impl<T> Vec<T> {
///
/// 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]);
Expand All @@ -1013,7 +1019,7 @@ impl<T> Vec<T> {
#[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);
Expand Down

0 comments on commit 0ba9e1f

Please sign in to comment.