Skip to content

Add missing Vec functionality #382

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

Merged
merged 1 commit into from
May 30, 2025
Merged
Show file tree
Hide file tree
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
19 changes: 0 additions & 19 deletions benches/bench.rs
Original file line number Diff line number Diff line change
Expand Up @@ -278,25 +278,6 @@ fn gen_from_elem<V: Vector<u64>>(n: usize, b: &mut Bencher) {
});
}

#[bench]
fn bench_insert_many(b: &mut Bencher) {
#[inline(never)]
fn insert_many_noinline<I: IntoIterator<Item = u64>>(
vec: &mut SmallVec<u64, VEC_SIZE>,
index: usize,
iterable: I,
) {
vec.insert_many(index, iterable)
}

b.iter(|| {
let mut vec = SmallVec::<u64, VEC_SIZE>::new();
insert_many_noinline(&mut vec, 0, 0..SPILLED_SIZE as _);
insert_many_noinline(&mut vec, 0, 0..SPILLED_SIZE as _);
vec
});
}

#[bench]
fn bench_insert_from_slice(b: &mut Bencher) {
let v: Vec<u64> = (0..SPILLED_SIZE as _).collect();
Expand Down
4 changes: 2 additions & 2 deletions fuzz/fuzz_targets/smallvec_ops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ fn do_test<const N: usize>(data: &[u8]) -> SmallVec<u8, N> {
let insert_pos = next_usize!(bytes) % (v.len() + 1);
let how_many = next_usize!(bytes);
let result = std::panic::catch_unwind(std::panic::AssertUnwindSafe(|| {
v.insert_many(insert_pos, (0..how_many).map(|_| bytes.next().unwrap()));
v.splice(insert_pos..insert_pos, (0..how_many).map(|_| bytes.next().unwrap()));
}));

if result.is_err() {
Expand All @@ -107,7 +107,7 @@ fn do_test<const N: usize>(data: &[u8]) -> SmallVec<u8, N> {

19 => {
let result = std::panic::catch_unwind(std::panic::AssertUnwindSafe(|| {
v.retain(|e| {
v.retain_mut(|e| {
let alt_e = bytes.next().unwrap();
let retain = *e >= alt_e;
*e = e.wrapping_add(alt_e);
Expand Down
Loading