From 465c6ef509c83239d2d7d4de0c4f02e266dd8767 Mon Sep 17 00:00:00 2001 From: jedarden Date: Tue, 26 May 2026 16:41:55 -0400 Subject: [PATCH] style(benches): fix clippy warnings in benchmark files - Use let _ = to ignore Result values in benchmark iterations - Use inline format args (format!("s{shard_count}_h{hits_per_shard}")) - Ensures cargo clippy --all-targets -- -D warnings passes --- crates/miroir-core/benches/merger.rs | 11 ++++------- crates/miroir-core/benches/rendezvous.rs | 12 ++++++------ 2 files changed, 10 insertions(+), 13 deletions(-) diff --git a/crates/miroir-core/benches/merger.rs b/crates/miroir-core/benches/merger.rs index 35f8f11..81efcb2 100644 --- a/crates/miroir-core/benches/merger.rs +++ b/crates/miroir-core/benches/merger.rs @@ -40,10 +40,7 @@ fn bench_merge_hits(c: &mut Criterion) { group.throughput(Throughput::Elements(total_hits as u64)); group.bench_with_input( - BenchmarkId::new( - "merge_hits", - format!("s{}_h{}", shard_count, hits_per_shard), - ), + BenchmarkId::new("merge_hits", format!("s{shard_count}_h{hits_per_shard}")), &(shard_count, hits_per_shard), |b, &(shard_count, hits_per_shard)| { let shard_hits: Vec = (0..shard_count) @@ -64,7 +61,7 @@ fn bench_merge_hits(c: &mut Criterion) { }; b.iter(|| { - black_box(merger::merge(black_box(input.clone()))); + let _ = black_box(merger::merge(black_box(input.clone()))); }); }, ); @@ -94,7 +91,7 @@ fn bench_full_merge(c: &mut Criterion) { }; b.iter(|| { - black_box(merger::merge(black_box(input.clone()))); + let _ = black_box(merger::merge(black_box(input.clone()))); }); }); @@ -117,7 +114,7 @@ fn bench_full_merge(c: &mut Criterion) { }; b.iter(|| { - black_box(merger::merge(black_box(input.clone()))); + let _ = black_box(merger::merge(black_box(input.clone()))); }); }); diff --git a/crates/miroir-core/benches/rendezvous.rs b/crates/miroir-core/benches/rendezvous.rs index c8da792..ec171e9 100644 --- a/crates/miroir-core/benches/rendezvous.rs +++ b/crates/miroir-core/benches/rendezvous.rs @@ -10,8 +10,8 @@ fn create_topology_with_nodes(node_count: u32, shards: u32, rf: usize) -> Topolo let mut topo = Topology::new(shards, 1, rf); for i in 0..node_count { topo.add_node(Node::new( - NodeId::new(format!("node-{}", i)), - format!("http://node-{}:7700", i), + NodeId::new(format!("node-{i}")), + format!("http://node-{i}:7700"), 0, )); } @@ -56,13 +56,13 @@ fn bench_assign_shard_in_group(c: &mut Criterion) { for (shards, nodes, rf) in [(64, 3, 2), (64, 10, 2), (128, 20, 3)] { let _topo = create_topology_with_nodes(nodes, shards, rf); let node_ids: Vec = (0..nodes) - .map(|i| NodeId::new(format!("node-{}", i))) + .map(|i| NodeId::new(format!("node-{i}"))) .collect(); group.bench_with_input( BenchmarkId::new( "assign_shard_in_group", - format!("s{}_n{}_rf{}", shards, nodes, rf), + format!("s{shards}_n{nodes}_rf{rf}"), ), &(shards, rf, &node_ids), |b, (_shards, rf, node_ids)| { @@ -87,8 +87,8 @@ fn bench_rendezvous_assignment_batch(c: &mut Criterion) { for doc_count in [1_000, 5_000, 10_000] { let _topo = create_topology_with_nodes(3, 64, 2); - let node_ids: Vec = (0..3).map(|i| NodeId::new(format!("node-{}", i))).collect(); - let keys: Vec = (0..doc_count).map(|i| format!("doc-{}", i)).collect(); + let node_ids: Vec = (0..3).map(|i| NodeId::new(format!("node-{i}"))).collect(); + let keys: Vec = (0..doc_count).map(|i| format!("doc-{i}")).collect(); group.throughput(Throughput::Elements(doc_count as u64)); group.bench_with_input(