Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow index of split_off to equal length of vector #33

Merged
merged 1 commit into from
Aug 2, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/vector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -776,7 +776,7 @@ impl<A: Clone> Vector<A> {
/// # }
/// ```
pub fn split_off(&mut self, index: usize) -> Self {
assert!(index < self.len());
assert!(index <= self.len());

let mut local_index = index;

Expand Down Expand Up @@ -1832,7 +1832,7 @@ mod test {

#[test]
fn split(ref vec in vec(i32::ANY, 1..2000), split_pos in usize::ANY) {
let split_index = split_pos % vec.len();
let split_index = split_pos % (vec.len() + 1);
let mut left = Vector::from_iter(vec.iter().cloned());
let right = left.split_off(split_index);
assert_eq!(left.len(), split_index);
Expand Down