Skip to content

Commit

Permalink
fix: bench: Eliminate unneeded .clone()s
Browse files Browse the repository at this point in the history
Clippy insists and my pre-commit hook keeps trying to add this to random
commits.

Signed-off-by: Patrick Roy <[email protected]>
  • Loading branch information
roypat committed Sep 16, 2024
1 parent 6c70ece commit 0396026
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/vmm/benches/queue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ pub fn queue_benchmark(c: &mut Criterion) {
let desc = queue.pop().unwrap();
c.bench_function("next_descriptor_1", |b| {
b.iter(|| {
let mut head = Some(desc.clone());
let mut head = Some(desc);
while let Some(d) = head {
head = std::hint::black_box(d.next_descriptor());
}
Expand All @@ -76,7 +76,7 @@ pub fn queue_benchmark(c: &mut Criterion) {
let desc = queue.pop().unwrap();
c.bench_function("next_descriptor_2", |b| {
b.iter(|| {
let mut head = Some(desc.clone());
let mut head = Some(desc);
while let Some(d) = head {
head = std::hint::black_box(d.next_descriptor());
}
Expand All @@ -88,7 +88,7 @@ pub fn queue_benchmark(c: &mut Criterion) {
let desc = queue.pop().unwrap();
c.bench_function("next_descriptor_4", |b| {
b.iter(|| {
let mut head = Some(desc.clone());
let mut head = Some(desc);
while let Some(d) = head {
head = std::hint::black_box(d.next_descriptor());
}
Expand All @@ -100,7 +100,7 @@ pub fn queue_benchmark(c: &mut Criterion) {
let desc = queue.pop().unwrap();
c.bench_function("next_descriptor_16", |b| {
b.iter(|| {
let mut head = Some(desc.clone());
let mut head = Some(desc);
while let Some(d) = head {
head = std::hint::black_box(d.next_descriptor());
}
Expand Down

0 comments on commit 0396026

Please sign in to comment.