Skip to content

Commit

Permalink
Address #53
Browse files Browse the repository at this point in the history
  • Loading branch information
myrrlyn committed Apr 18, 2021
1 parent 0eef94d commit d57c5b0
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions lexical-core/src/util/sequence.rs
Expand Up @@ -87,11 +87,14 @@ pub fn insert_many<V, T, I>(vec: &mut V, index: usize, iterable: I)
ptr::copy(ptr.add(lower_size_bound), ptr.add(num_added), old_len - index);
}

vec.set_len(old_len + num_added);

// If the iterator had more than its lower bound indicated, collect in
// a slow path.
vec.extend(iter);
for elem in iter {
vec.insert(index + num_added, elem);
num_added += 1;
}

vec.set_len(old_len + num_added);
}
}

Expand Down

0 comments on commit d57c5b0

Please sign in to comment.