Skip to content

Commit 599fffa

Browse files
fix(ci): satisfy Rust 1.99 clippy lints (#347)
CI tracks the moving stable toolchain, and 1.99 added/tightened lints that fail the -D warnings clippy gate: - must_use_candidate on six accessor methods in hyperdb-api - assert_is_empty on assert!(x.is_empty()) in tests (use assert_eq!/assert_ne!) - unfulfilled #[expect(clippy::float_cmp)] in hyperdb-api-core tests, which 1.99 no longer triggers No behaviour change.
1 parent ca94a1a commit 599fffa

19 files changed

Lines changed: 49 additions & 51 deletions

‎hyperdb-api-core/src/client/auth.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -390,6 +390,6 @@ mod tests {
390390
let nonce1 = generate_nonce();
391391
let nonce2 = generate_nonce();
392392
assert_ne!(nonce1, nonce2);
393-
assert!(!nonce1.is_empty());
393+
assert_ne!(nonce1, "");
394394
}
395395
}

‎hyperdb-api-core/src/client/prepare.rs‎

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -692,10 +692,6 @@ mod tests {
692692
}
693693

694694
#[test]
695-
#[expect(
696-
clippy::float_cmp,
697-
reason = "1.5 is exactly representable; encode/decode must round-trip bit-for-bit"
698-
)]
699695
fn test_sql_param_f32() {
700696
let encoded = 1.5_f32.encode();
701697
assert_eq!(encoded.len(), 4);
@@ -704,10 +700,6 @@ mod tests {
704700
}
705701

706702
#[test]
707-
#[expect(
708-
clippy::float_cmp,
709-
reason = "1.5 is exactly representable; encode/decode must round-trip bit-for-bit"
710-
)]
711703
fn test_sql_param_f64() {
712704
let encoded = 1.5_f64.encode();
713705
assert_eq!(encoded.len(), 8);
@@ -748,7 +740,7 @@ mod tests {
748740
#[test]
749741
fn test_params_macro_empty() {
750742
let p = params![];
751-
assert!(p.is_empty());
743+
assert_eq!(p.len(), 0);
752744
}
753745

754746
#[test]

‎hyperdb-api-core/src/protocol/copy.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -773,7 +773,7 @@ mod tests {
773773
// A zero-length value is valid: 4 bytes of length prefix, no data.
774774
let buf = [0x00, 0x00, 0x00, 0x00];
775775
let bytes = read_varbinary(&buf).unwrap();
776-
assert!(bytes.is_empty());
776+
assert_eq!(bytes.len(), 0);
777777
}
778778

779779
#[test]

‎hyperdb-api-core/src/protocol/types.rs‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -423,10 +423,6 @@ mod tests {
423423
}
424424

425425
#[test]
426-
#[expect(
427-
clippy::float_cmp,
428-
reason = "bit-for-bit round-trip through fixed-width binary encoding; epsilon compare would mask a decode regression"
429-
)]
430426
fn test_f64_roundtrip() {
431427
let mut buf = BytesMut::new();
432428
f64_to_hyper_binary(std::f64::consts::PI, &mut buf);

‎hyperdb-api-core/src/types/special.rs‎

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2182,7 +2182,7 @@ mod geo_impl {
21822182
let wkb_geo = Geography::from_wkt("POINT(1 2)").expect("wkt to wkb");
21832183
match wkb_geo.format().expect("format detection") {
21842184
GeographyFormat::Wkb(bytes) => {
2185-
assert!(!bytes.is_empty());
2185+
assert_ne!(bytes.len(), 0);
21862186
assert!(bytes[0] == 0 || bytes[0] == 1);
21872187
}
21882188
GeographyFormat::Legacy(_) => panic!("expected WKB format"),
@@ -2460,10 +2460,6 @@ mod tests {
24602460
}
24612461

24622462
#[test]
2463-
#[expect(
2464-
clippy::float_cmp,
2465-
reason = "42.0 is exactly representable; scale=0 conversion must be bit-exact"
2466-
)]
24672463
fn test_numeric_from_binary_with_scale_zero() {
24682464
// Unscaled value 42 with scale 0 = 42
24692465
let mut bytes = [0u8; 16];
@@ -2571,10 +2567,6 @@ mod tests {
25712567
}
25722568

25732569
#[test]
2574-
#[expect(
2575-
clippy::float_cmp,
2576-
reason = "123.0 is exactly representable; scale=0 conversion must be bit-exact"
2577-
)]
25782570
fn test_numeric_from_binary_with_scale_required() {
25792571
// FromHyperBinary is intentionally NOT implemented for Numeric because
25802572
// the scale must be obtained from type metadata - it cannot be inferred

‎hyperdb-api/src/grpc_connection.rs‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,7 @@ impl GrpcConnection {
290290
}
291291

292292
/// Returns the gRPC configuration.
293+
#[must_use]
293294
pub fn config(&self) -> &GrpcConfig {
294295
self.client.config()
295296
}
@@ -425,6 +426,7 @@ impl GrpcConnectionAsync {
425426
}
426427

427428
/// Returns the gRPC configuration.
429+
#[must_use]
428430
pub fn config(&self) -> &GrpcConfig {
429431
self.client.config()
430432
}

‎hyperdb-api/src/inserter.rs‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,7 @@ impl<'conn> Inserter<'conn> {
284284
}
285285

286286
/// Returns the table definition.
287+
#[must_use]
287288
pub fn table_definition(&self) -> &TableDefinition {
288289
&self.table_def
289290
}

‎hyperdb-api/src/names.rs‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,7 @@ impl DatabaseName {
314314
}
315315

316316
/// Returns the name component.
317+
#[must_use]
317318
pub fn name(&self) -> &Name {
318319
&self.name
319320
}
@@ -449,6 +450,7 @@ impl SchemaName {
449450
}
450451

451452
/// Returns the schema name component.
453+
#[must_use]
452454
pub fn schema(&self) -> &Name {
453455
&self.schema
454456
}
@@ -638,6 +640,7 @@ impl TableName {
638640
}
639641

640642
/// Returns the table name component.
643+
#[must_use]
641644
pub fn table(&self) -> &Name {
642645
&self.table
643646
}
@@ -877,7 +880,7 @@ mod tests {
877880
let name = Name::try_new("users").unwrap();
878881
assert_eq!(name.to_string(), "\"users\"");
879882
assert_eq!(name.unescaped(), "users");
880-
assert!(!name.unescaped().is_empty());
883+
assert_ne!(name.unescaped(), "");
881884
}
882885

883886
#[test]

‎hyperdb-api/tests/arrow_reader_tests.rs‎

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,11 @@ fn test_arrow_reader_query() -> Result<()> {
5656

5757
// Test query with filter
5858
let arrow_data = reader.query_to_arrow("SELECT * FROM products WHERE price > 15")?;
59-
assert!(!arrow_data.is_empty());
59+
assert_ne!(arrow_data, [] as [u8; 0]);
6060

6161
// Test query with aggregation
6262
let arrow_data = reader.query_to_arrow("SELECT COUNT(*), SUM(price) FROM products")?;
63-
assert!(!arrow_data.is_empty());
63+
assert_ne!(arrow_data, [] as [u8; 0]);
6464

6565
Ok(())
6666
}
@@ -80,7 +80,7 @@ fn test_arrow_reader_columns() -> Result<()> {
8080

8181
// Read only specific columns
8282
let arrow_data = reader.table_columns_to_arrow("users", &["id", "name"])?;
83-
assert!(!arrow_data.is_empty());
83+
assert_ne!(arrow_data, [] as [u8; 0]);
8484

8585
Ok(())
8686
}
@@ -106,7 +106,7 @@ fn test_arrow_reader_filtered() -> Result<()> {
106106

107107
// Read with filter
108108
let arrow_data = reader.table_filtered_to_arrow("orders", "status = 'pending'")?;
109-
assert!(!arrow_data.is_empty());
109+
assert_ne!(arrow_data, [] as [u8; 0]);
110110

111111
Ok(())
112112
}
@@ -161,7 +161,7 @@ fn test_arrow_reader_empty_table() -> Result<()> {
161161
let arrow_data = reader.table_to_arrow("empty_table")?;
162162

163163
// Even empty result should have some data (schema at minimum)
164-
assert!(!arrow_data.is_empty());
164+
assert_ne!(arrow_data, [] as [u8; 0]);
165165

166166
Ok(())
167167
}
@@ -192,7 +192,7 @@ fn test_arrow_reader_various_types() -> Result<()> {
192192

193193
let reader = ArrowReader::new(&conn);
194194
let arrow_data = reader.table_to_arrow("typed_data")?;
195-
assert!(!arrow_data.is_empty());
195+
assert_ne!(arrow_data, [] as [u8; 0]);
196196

197197
Ok(())
198198
}
@@ -213,7 +213,7 @@ fn test_arrow_reader_no_matching_rows() -> Result<()> {
213213
let arrow_data = reader.query_to_arrow("SELECT * FROM test_filter WHERE id > 100")?;
214214

215215
// Should still have data (schema)
216-
assert!(!arrow_data.is_empty());
216+
assert_ne!(arrow_data, [] as [u8; 0]);
217217

218218
Ok(())
219219
}
@@ -233,7 +233,7 @@ fn test_arrow_reader_schema_qualified() -> Result<()> {
233233

234234
let reader = ArrowReader::new(&conn);
235235
let arrow_data = reader.table_to_arrow("custom_schema.test_table")?;
236-
assert!(!arrow_data.is_empty());
236+
assert_ne!(arrow_data, [] as [u8; 0]);
237237

238238
Ok(())
239239
}
@@ -256,9 +256,9 @@ fn test_arrow_reader_multiple_reads() -> Result<()> {
256256
let data2 = reader.table_to_arrow("multi_test")?;
257257
let data3 = reader.query_to_arrow("SELECT COUNT(*) FROM multi_test")?;
258258

259-
assert!(!data1.is_empty());
260-
assert!(!data2.is_empty());
261-
assert!(!data3.is_empty());
259+
assert_ne!(data1, [] as [u8; 0]);
260+
assert_ne!(data2, [] as [u8; 0]);
261+
assert_ne!(data3, [] as [u8; 0]);
262262

263263
// Same query should return same size
264264
assert_eq!(data1.len(), data2.len());

‎hyperdb-api/tests/async_kv_store_tests.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ async fn async_kv_full_surface() -> Result<()> {
7171
#[tokio::test(flavor = "current_thread")]
7272
async fn async_list_stores_and_validation() -> Result<()> {
7373
let (_hyper, conn) = fresh_async_conn("async_kv_list").await?;
74-
assert!(conn.kv_list_stores().await?.is_empty());
74+
assert_eq!(conn.kv_list_stores().await?, [] as [std::string::String; 0]);
7575
let _ = conn.kv_store("alpha").await?.set("k", "1").await?;
7676
let _ = conn.kv_store("beta").await?.set("k", "2").await?;
7777
let mut stores = conn.kv_list_stores().await?;

0 commit comments

Comments
 (0)