fix(rust): satisfy current clippy lints
The current toolchain promoted two test-only patterns to hard errors under `-D warnings`: integer-to-pointer casts used as non-null dictionary-handle sentinels, and a repeat/take construction that Clippy now replaces with `repeat_n`. The casts never represented addresses and were only placeholders for ownership fields that the cleanup functions must clear. Use the standard dangling-pointer constructor for those sentinels and the equivalent concise iterator for the generated test input. Runtime behavior and the ABI are unchanged, while the repository's Rust lint gate is warning-free again. Test Plan: - `cargo clippy --manifest-path rust/Cargo.toml -- -D warnings` -- passed - `cargo clippy --manifest-path rust/Cargo.toml --benches -- -D warnings` -- passed - `cargo clippy --manifest-path rust/Cargo.toml --tests -- -D warnings` -- passed - `cargo clippy --manifest-path rust/cli/Cargo.toml --all-targets -- -D warnings` -- passed - `cargo +nightly fmt --manifest-path rust/Cargo.toml` -- passed - `cargo +nightly fmt --manifest-path rust/cli/Cargo.toml` -- passed
This commit is contained in:
@@ -1049,7 +1049,7 @@ mod tests {
|
||||
let mapped = unsafe { std::slice::from_raw_parts(buffer.cast::<u8>(), mapped_size) };
|
||||
assert_eq!(mapped, payload);
|
||||
|
||||
let mut dict_handle = 1usize as *mut c_void;
|
||||
let mut dict_handle = ptr::dangling_mut::<c_void>();
|
||||
unsafe {
|
||||
FIO_rust_freeDict(
|
||||
FIO_MMAP_DICT,
|
||||
@@ -1074,7 +1074,7 @@ mod tests {
|
||||
assert!(!allocation.is_null());
|
||||
let mut buffer = allocation;
|
||||
let mut buffer_size = 16;
|
||||
let mut dict_handle = 1usize as *mut c_void;
|
||||
let mut dict_handle = ptr::dangling_mut::<c_void>();
|
||||
|
||||
unsafe {
|
||||
FIO_rust_freeDict(
|
||||
|
||||
@@ -4573,7 +4573,7 @@ mod tests {
|
||||
#[test]
|
||||
fn one_shot_promotes_nonfirst_rle_blocks() {
|
||||
let mut input = vec![b'B'; 256 * 1024 - 2];
|
||||
input.extend(std::iter::repeat(b'A').take(100 * 1024));
|
||||
input.extend(std::iter::repeat_n(b'A', 100 * 1024));
|
||||
|
||||
let compressed = compress_input(&input, 1);
|
||||
assert!(compressed.len() <= 46);
|
||||
|
||||
Reference in New Issue
Block a user