From bec2dba4e8128b6d84c05c7ee03f5209b1fdbef6 Mon Sep 17 00:00:00 2001 From: jedarden Date: Tue, 26 May 2026 10:56:10 -0400 Subject: [PATCH] fix(clippy): resolve uninlined format args and unused imports in benchmarks --- crates/miroir-core/benches/end_to_end_bench.rs | 12 ++++++++---- crates/miroir-core/benches/ingest_bench.rs | 18 ++++++++++-------- 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/crates/miroir-core/benches/end_to_end_bench.rs b/crates/miroir-core/benches/end_to_end_bench.rs index 7323e86..733e309 100644 --- a/crates/miroir-core/benches/end_to_end_bench.rs +++ b/crates/miroir-core/benches/end_to_end_bench.rs @@ -9,7 +9,6 @@ //! For real measurements, integration tests with live Meilisearch are required. use criterion::{black_box, criterion_group, criterion_main, BenchmarkId, Criterion}; -use miroir_core::router::{shard_for_key, write_targets}; use miroir_core::topology::{Node, NodeId, Topology}; use std::time::Duration; @@ -26,7 +25,7 @@ fn simulate_single_node_search(query: &str) -> Duration { /// Simulated Miroir scatter-gather search latency. #[inline(never)] -fn simulate_miroir_search(query: &str, topo: &Topology) -> Duration { +fn simulate_miroir_search(query: &str, _topo: &Topology) -> Duration { // Miroir latency components: // - Scatter overhead: ~1ms // - Network to nodes: ~1ms each way (parallelized) @@ -48,7 +47,7 @@ fn create_test_topology(node_count: u32, shards: u32, rf: usize, rg: u32) -> Top for g in 0..rg { for i in 0..node_count { topo.add_node(Node::new( - NodeId::new(format!("node-g{}-{}", g, i)), + NodeId::new(format!("node-g{g}-{i}")), format!("http://localhost:{}", 7701 + (g * node_count + i) as u16), g, )); @@ -116,5 +115,10 @@ fn bench_latency_ratio(c: &mut Criterion) { group.finish(); } -criterion_group!(benches, bench_single_node_baseline, bench_miroir_scatter_gather, bench_latency_ratio); +criterion_group!( + benches, + bench_single_node_baseline, + bench_miroir_scatter_gather, + bench_latency_ratio +); criterion_main!(benches); diff --git a/crates/miroir-core/benches/ingest_bench.rs b/crates/miroir-core/benches/ingest_bench.rs index 7729f8d..b3fb33b 100644 --- a/crates/miroir-core/benches/ingest_bench.rs +++ b/crates/miroir-core/benches/ingest_bench.rs @@ -14,9 +14,7 @@ use miroir_core::topology::{Node, NodeId, Topology}; use std::time::Duration; fn create_test_documents(count: usize) -> Vec { - (0..count) - .map(|i| format!("product_{}", i)) - .collect() + (0..count).map(|i| format!("product_{i}")).collect() } fn create_test_topology(node_count: u32, shards: u32, rf: usize, rg: u32) -> Topology { @@ -24,7 +22,7 @@ fn create_test_topology(node_count: u32, shards: u32, rf: usize, rg: u32) -> Top for g in 0..rg { for i in 0..node_count { topo.add_node(Node::new( - NodeId::new(format!("node-g{}-{}", g, i)), + NodeId::new(format!("node-g{g}-{i}")), format!("http://localhost:{}", 7701 + (g * node_count + i) as u16), g, )); @@ -76,10 +74,14 @@ fn bench_single_node_ingest(c: &mut Criterion) { for doc_count in [100, 500, 1000, 5000].iter() { group.throughput(Throughput::Elements(*doc_count as u64)); - group.bench_with_input(BenchmarkId::from_parameter(doc_count), doc_count, |b, count| { - let docs = create_test_documents(*count); - b.iter(|| black_box(simulate_single_node_ingest(black_box(&docs)))); - }); + group.bench_with_input( + BenchmarkId::from_parameter(doc_count), + doc_count, + |b, count| { + let docs = create_test_documents(*count); + b.iter(|| black_box(simulate_single_node_ingest(black_box(&docs)))); + }, + ); } group.finish();