We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 33418b8 commit b314454Copy full SHA for b314454
src/vector.rs
@@ -776,7 +776,7 @@ impl<A: Clone> Vector<A> {
776
/// # }
777
/// ```
778
pub fn split_off(&mut self, index: usize) -> Self {
779
- assert!(index < self.len());
+ assert!(index <= self.len());
780
781
let mut local_index = index;
782
@@ -1832,7 +1832,7 @@ mod test {
1832
1833
#[test]
1834
fn split(ref vec in vec(i32::ANY, 1..2000), split_pos in usize::ANY) {
1835
- let split_index = split_pos % vec.len();
+ let split_index = split_pos % (vec.len() + 1);
1836
let mut left = Vector::from_iter(vec.iter().cloned());
1837
let right = left.split_off(split_index);
1838
assert_eq!(left.len(), split_index);
0 commit comments