Skip to content

Commit a68e213

Browse files
committed
chore(clippy): close len_zero + await_holding_lock blockers
Two clippy errors surfacing on the lance-cache feature gate: 1. lance_cache.rs:110 (mine, from the versioning PR step) — `arr.len() > 0` → `!arr.is_empty()`. 2. registry.rs:185 (pre-existing) — `MutexGuard` held across an await point. PR #369's body claimed this was fixed but it landed unfixed. Clone `last_root_checksum` out of the read guard before the `set_last_root_checksum().await` call so the guard drops first. `cargo clippy -p lance-graph-ontology --features lance-cache --tests --no-deps -- -D warnings` exits 0 after these two.
1 parent b92c932 commit a68e213

2 files changed

Lines changed: 6 additions & 3 deletions

File tree

crates/lance-graph-ontology/src/lance_cache.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ impl LanceWriter {
107107
let Some(arr) = col.as_any().downcast_ref::<UInt32Array>() else {
108108
return Ok(None);
109109
};
110-
if arr.len() > 0 {
110+
if !arr.is_empty() {
111111
return Ok(Some(arr.value(0)));
112112
}
113113
}

crates/lance-graph-ontology/src/registry.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,8 +182,11 @@ impl OntologyRegistry {
182182
let writer = LanceWriter::open_or_create(lance_path).await?;
183183
let rows: Vec<MappingRow> = self.inner.read().unwrap().rows.clone();
184184
writer.flush(&rows).await?;
185-
if let Some(cs) = &self.inner.read().unwrap().last_root_checksum {
186-
writer.set_last_root_checksum(cs).await?;
185+
// Clone the checksum out of the read guard before the await so
186+
// clippy::await_holding_lock stays green.
187+
let last_checksum = self.inner.read().unwrap().last_root_checksum.clone();
188+
if let Some(cs) = last_checksum {
189+
writer.set_last_root_checksum(&cs).await?;
187190
}
188191
}
189192
Ok(report)

0 commit comments

Comments
 (0)