fix(fileio): avoid indirect test-state assignment warning
The callback unit test switched its fake codec result by mutating the state used for the successful invocation. Clippy cannot see the later read through the extern function pointer and reported the assignment as unused under `-D warnings`. Use a separate fake state for the error invocation. The two scenarios remain independent and still exercise both the success and error result paths without suppressing a lint or changing production code. Test Plan: - `cargo +nightly fmt --manifest-path rust/Cargo.toml --all` -- passed - `CARGO_BUILD_JOBS=1 cargo clippy --manifest-path rust/Cargo.toml --all-targets -- -D warnings` under `ulimit -v 41943040` -- passed - `git diff --check` and `git diff --cached --check` -- passed
This commit is contained in:
@@ -6980,11 +6980,18 @@ mod tests {
|
||||
assert_eq!(to_flush_now, 19);
|
||||
assert_eq!(zstd_result, 0);
|
||||
|
||||
state.codec_result = usize::MAX;
|
||||
let mut error_state = ZstdCodecCallbackTestState {
|
||||
pending_flush: 19,
|
||||
codec_result: usize::MAX,
|
||||
observed_input: None,
|
||||
observed_output: None,
|
||||
observed_directive: -1,
|
||||
};
|
||||
let error_cctx = (&mut error_state as *mut ZstdCodecCallbackTestState).cast::<c_void>();
|
||||
assert_eq!(
|
||||
unsafe {
|
||||
fio_zstd_compress_stream_with(
|
||||
cctx,
|
||||
error_cctx,
|
||||
0,
|
||||
input.as_ptr(),
|
||||
input.len(),
|
||||
|
||||
Reference in New Issue
Block a user