From 2b703ae2a18c61398417ac0ca82abe7b273b652d Mon Sep 17 00:00:00 2001 From: ddidderr Date: Mon, 20 Jul 2026 16:13:55 +0200 Subject: [PATCH] fix(rust): satisfy layout assertions under clippy Use usize::BITS for the byte offset that Clippy recognizes as a bit-width expression on both the static-CCtx and MT finish projections. Update the focused resource-failure test to provide the compression-job last-job argument required by the callback signature. This keeps the ABI checks architecture-independent while making all-target clippy compile the new tests. Test Plan: - ulimit -v 41943040; CARGO_BUILD_JOBS=1 cargo clippy --manifest-path rust/Cargo.toml --all-targets -- -D warnings - git diff --cached --check --- rust/src/zstd_compress.rs | 2 +- rust/src/zstdmt_compress.rs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/rust/src/zstd_compress.rs b/rust/src/zstd_compress.rs index 42599eced..73dafab93 100644 --- a/rust/src/zstd_compress.rs +++ b/rust/src/zstd_compress.rs @@ -2401,7 +2401,7 @@ const _: () = { assert!(offset_of!(ZSTD_rust_initStaticCCtxState, reserve_object) == 5 * size_of::()); assert!(offset_of!(ZSTD_rust_initStaticCCtxState, zero) == 6 * size_of::()); assert!(offset_of!(ZSTD_rust_initStaticCCtxState, move_workspace) == 7 * size_of::()); - assert!(offset_of!(ZSTD_rust_initStaticCCtxState, check_available) == 8 * size_of::()); + assert!(offset_of!(ZSTD_rust_initStaticCCtxState, check_available) == usize::BITS as usize); assert!( offset_of!(ZSTD_rust_initStaticCCtxState, reserve_block_state) == 9 * size_of::() ); diff --git a/rust/src/zstdmt_compress.rs b/rust/src/zstdmt_compress.rs index 89c1d85e2..6999a0ea2 100644 --- a/rust/src/zstdmt_compress.rs +++ b/rust/src/zstdmt_compress.rs @@ -310,7 +310,7 @@ const _: () = { offset_of!(ZSTDMT_compressionJobFinishProjection, publishConsumed) == 7 * size_of::() ); - assert!(offset_of!(ZSTDMT_compressionJobFinishProjection, signal) == 8 * size_of::()); + assert!(offset_of!(ZSTDMT_compressionJobFinishProjection, signal) == usize::BITS as usize); assert!(size_of::() == 9 * size_of::()); }; @@ -5487,7 +5487,7 @@ mod tests { || panic!("resource failure must skip context initialization"), || panic!("resource failure must skip sequence application"), || panic!("resource failure must skip frame-header writing"), - || panic!("resource failure must skip compression"), + |_| panic!("resource failure must skip compression"), || panic!("resource failure must skip tracing"), );