Skip to content

Commit 9151225

Browse files
committed
lints
1 parent 1da25ff commit 9151225

File tree

6 files changed

+18
-21
lines changed

6 files changed

+18
-21
lines changed

src/args.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ pub struct Args {
4646
/// Optimizer indexing threshold
4747
#[arg(long)]
4848
pub indexing_threshold: Option<u32>,
49-
/// Maximum size (in KiloBytes) of vectors to store in-memory per segment.
49+
/// Maximum size (in `KiloBytes`) of vectors to store in-memory per segment.
5050
#[arg(long)]
5151
pub memmap_threshold: Option<u32>,
5252
/// Timeout of gRPC client

src/checker.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ pub async fn check_points_consistency(
135135
Ok(())
136136
} else {
137137
let errors_rendered = errors_found.join("/n");
138-
Err(Invariant(errors_rendered.to_string()))
138+
Err(Invariant(errors_rendered))
139139
}
140140
}
141141

@@ -244,11 +244,11 @@ pub fn check_search_result(results: &QueryBatchResponse) -> Result<(), CrasherEr
244244
.and_then(|v| v.vectors_options.as_ref())
245245
{
246246
let zeroed_vector = match vectors {
247-
VectorsOptions::Vector(v) => check_zeroed_vector(v).then_some(("".to_string(), v)),
247+
VectorsOptions::Vector(v) => check_zeroed_vector(v).then_some((String::new(), v)),
248248
VectorsOptions::Vectors(vectors) => vectors
249249
.vectors
250250
.iter()
251-
.find_map(|(name, v)| check_zeroed_vector(v).then_some((name.to_string(), v))),
251+
.find_map(|(name, v)| check_zeroed_vector(v).then_some((name.clone(), v))),
252252
};
253253
if let Some((name, vector)) = zeroed_vector {
254254
return Err(Invariant(format!(

src/client.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,8 @@ pub async fn wait_server_ready(
4949
return Err(CrasherError::Invariant(
5050
"Server did not start in time, /readyz not ready".to_string(),
5151
));
52-
} else {
53-
log::debug!("Healthcheck failed: {err:?}")
5452
}
53+
log::debug!("Healthcheck failed: {err:?}");
5554
}
5655
}
5756
}
@@ -250,7 +249,9 @@ pub async fn create_collection(
250249
map: sparse_vector_params,
251250
};
252251

253-
let dense_vectors_config = if !args.only_sparse {
252+
let dense_vectors_config = if args.only_sparse {
253+
None
254+
} else {
254255
let mut all_dense_params = HashMap::new();
255256

256257
// dense vectors
@@ -266,8 +267,6 @@ pub async fn create_collection(
266267
map: all_dense_params,
267268
})),
268269
})
269-
} else {
270-
None
271270
};
272271

273272
let mut request = CreateCollectionBuilder::new(collection_name)

src/generators.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -552,7 +552,7 @@ const WORDS: [&str; 8] = ["the", "quick", "fox", "jumps", "over", "the", "lazy",
552552

553553
pub fn random_sentence(rng: &mut impl Rng, num_variants: u32) -> String {
554554
let variant = rng.random_range(0..num_variants);
555-
let words: Vec<_> = WORDS.iter().take(variant as usize).cloned().collect();
555+
let words: Vec<_> = WORDS.iter().take(variant as usize).copied().collect();
556556
words.join(" ")
557557
}
558558

src/main.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ async fn main() {
4949
let grpc_client_config =
5050
get_grpc_config(args.uris.first().unwrap(), args.grpc_timeout_ms as usize);
5151
let grpc_client = Qdrant::new(grpc_client_config).unwrap();
52-
let grpc_client = Arc::new(grpc_client);
5352

5453
// HTTP client
5554
let http_client = Client::builder()
@@ -78,7 +77,6 @@ async fn main() {
7877
let (rng_seed, mut workload_rng, mut chaos_rng) = create_rngs(args.rng_seed);
7978

8079
// workload task
81-
let client_worker = grpc_client.clone();
8280
let workload = Workload::new(
8381
collection_name,
8482
stopped.clone(),
@@ -89,6 +87,7 @@ async fn main() {
8987
rng_seed,
9088
);
9189
let args = Arc::new(args);
90+
let client_worker = grpc_client.clone();
9291
let workload_task = tokio::spawn(async move {
9392
workload
9493
.work(&client_worker, &http_client, args, &mut workload_rng)

src/workload.rs

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ impl Workload {
5959
let query_count = 2; //hardcoded
6060
let test_named_vectors = TestNamedVectors::new(duplication_factor, vec_dim);
6161
let write_ordering = None; // default
62-
Workload {
62+
Self {
6363
collection_name: collection_name.to_string(),
6464
test_named_vectors,
6565
query_count,
@@ -133,13 +133,12 @@ impl Workload {
133133
// send stop signal to the main thread
134134
self.stopped.store(true, Ordering::Relaxed);
135135
break;
136-
} else {
137-
log::warn!(
138-
"Workload run failed due to client error - resuming soon\n{error:?}"
139-
);
140-
// no need to hammer the server while it restarts
141-
sleep(Duration::from_secs(3)).await;
142136
}
137+
log::warn!(
138+
"Workload run failed due to client error - resuming soon\n{error:?}"
139+
);
140+
// no need to hammer the server while it restarts
141+
sleep(Duration::from_secs(3)).await;
143142
}
144143
}
145144
}
@@ -301,7 +300,7 @@ impl Workload {
301300

302301
log::info!("Run: delete existing points (all points by filter)");
303302
delete_points(client, &self.collection_name).await?;
304-
self.reset_max_confirmed_point_id()
303+
self.reset_max_confirmed_point_id();
305304
}
306305

307306
// Validate existing collection snapshots
@@ -338,7 +337,7 @@ impl Workload {
338337
self.data_consistency_check(client, restored_count).await?;
339338

340339
delete_points(client, &self.collection_name).await?;
341-
self.reset_max_confirmed_point_id()
340+
self.reset_max_confirmed_point_id();
342341
}
343342
log::info!("All snapshots validated and deleted!");
344343
}

0 commit comments

Comments
 (0)