From 14e3f7c14084f90ca80df7e62f567a53423e36e4 Mon Sep 17 00:00:00 2001 From: ddidderr Date: Tue, 21 Jul 2026 06:54:32 +0200 Subject: [PATCH] fix(compress): make MT loop layout assertion lint-clean The new MT-loop policy projection asserted its total size as eight times `size_of::()`. Although that describes the padded C layout, clippy interprets the multiplication as a manual bit-count expression and rejects it under the repository's `-D warnings` policy. Express the same ABI invariant from the final field offset plus its field size. This keeps the assertion tied to the actual projected layout without changing any runtime policy or C/Rust representation. Test Plan: - `git diff --cached --check` -- passed - `rustfmt --edition 2021 --check rust/src/zstd_compress.rs` -- passed - `ulimit -v 41943040; CARGO_BUILD_JOBS=1 cargo clippy --manifest-path rust/Cargo.toml --all-targets -- -D warnings` -- passed --- rust/src/zstd_compress.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/rust/src/zstd_compress.rs b/rust/src/zstd_compress.rs index 39026cd4b..85cd8327c 100644 --- a/rust/src/zstd_compress.rs +++ b/rust/src/zstd_compress.rs @@ -415,7 +415,13 @@ const _: () = { output_pos_before ) == 7 * size_of::() ); - assert!(size_of::() == 8 * size_of::()); + assert!( + size_of::() + == offset_of!( + ZSTD_rust_compressStream2MTLoopPolicyState, + output_pos_before + ) + size_of::() + ); }; #[inline]