Skip to content

Commit 34f9993

Browse files
authored
fix clippy lints surfaced by Rust 1.98 (#276)
CI runs clippy from the latest stable, which advanced to 1.98 and added new lints: - tlog_tiles_wasm: use slice::as_chunks instead of chunks_exact with a const size (chunks_exact_to_as_chunks), dropping the try_into unwrap. - tlog_tiles: use u64::isolate_lowest_one in a test (manual_isolate_lowest_one). - generic_log_worker: allow unused_async_trait_impl on the test storage backends, whose async trait signatures require the impls stay async even without an await.
1 parent c68ec4b commit 34f9993

3 files changed

Lines changed: 10 additions & 7 deletions

File tree

crates/generic_log_worker/src/log_ops.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1407,6 +1407,10 @@ pub async fn upload_issuers(
14071407

14081408
#[cfg(test)]
14091409
mod tests {
1410+
// Test backends implement the async storage traits without awaiting; the
1411+
// trait signatures are `async fn`, so the impls must stay `async` to match.
1412+
#![allow(clippy::unused_async_trait_impl)]
1413+
14101414
use super::*;
14111415
use crate::{empty_checkpoint_callback, util};
14121416
use tlog_core::LeafIndex;

crates/tlog_tiles/src/tile.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1031,9 +1031,9 @@ mod tests {
10311031
let max_hi = if lo == 0 {
10321032
u64::MAX
10331033
} else {
1034-
// If `lo` is non-zero, find the maximum power of 2 that divides `lo`.
1035-
// This is a bitwise trick that isolates the lowest set bit.
1036-
let max_size = lo & lo.wrapping_neg();
1034+
// If `lo` is non-zero, find the maximum power of 2 that divides `lo`:
1035+
// the lowest set bit.
1036+
let max_size = lo.isolate_lowest_one();
10371037
lo + max_size
10381038
};
10391039
for hi in lo + 1..=i.min(max_hi) {

crates/tlog_tiles_wasm/src/lib.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -118,10 +118,9 @@ pub fn verify_consistency_proof(
118118
)));
119119
}
120120

121-
let proof: Vec<tlog_core::Hash> = proof_hashes
122-
.chunks_exact(32)
123-
.map(|chunk| tlog_core::Hash(chunk.try_into().unwrap()))
124-
.collect();
121+
// Length is validated as a multiple of 32 above, so the remainder is empty.
122+
let (chunks, _) = proof_hashes.as_chunks::<32>();
123+
let proof: Vec<tlog_core::Hash> = chunks.iter().copied().map(tlog_core::Hash).collect();
125124

126125
// Underlying API: (proof, n=new_size, root_hash=new_root, m=old_size, m_hash=old_root)
127126
tlog_core::verify_consistency_proof(

0 commit comments

Comments
 (0)