style(rust): format newly migrated policy bridges
Apply rustfmt to the stream-result and MT input-range policy projections and their focused tests. This is mechanical only; it keeps the new Rust seams compliant with the repository formatter without changing behavior. Test Plan: ulimit -v 41943040; CARGO_BUILD_JOBS=1 cargo +nightly fmt --manifest-path rust/Cargo.toml --all -- --check; git diff --cached --check.
This commit is contained in:
@@ -278,9 +278,7 @@ pub struct ZSTD_rust_compressStream2ResultPolicyState {
|
|||||||
|
|
||||||
const _: () = {
|
const _: () = {
|
||||||
assert!(size_of::<Option<CompressStream2SetBufferExpectationsFn>>() == size_of::<usize>());
|
assert!(size_of::<Option<CompressStream2SetBufferExpectationsFn>>() == size_of::<usize>());
|
||||||
assert!(
|
assert!(offset_of!(ZSTD_rust_compressStream2ResultPolicyState, callback_context) == 0);
|
||||||
offset_of!(ZSTD_rust_compressStream2ResultPolicyState, callback_context) == 0
|
|
||||||
);
|
|
||||||
assert!(
|
assert!(
|
||||||
offset_of!(
|
offset_of!(
|
||||||
ZSTD_rust_compressStream2ResultPolicyState,
|
ZSTD_rust_compressStream2ResultPolicyState,
|
||||||
@@ -288,12 +286,10 @@ const _: () = {
|
|||||||
) == size_of::<usize>()
|
) == size_of::<usize>()
|
||||||
);
|
);
|
||||||
assert!(
|
assert!(
|
||||||
offset_of!(ZSTD_rust_compressStream2ResultPolicyState, output)
|
offset_of!(ZSTD_rust_compressStream2ResultPolicyState, output) == 2 * size_of::<usize>()
|
||||||
== 2 * size_of::<usize>()
|
|
||||||
);
|
);
|
||||||
assert!(
|
assert!(
|
||||||
offset_of!(ZSTD_rust_compressStream2ResultPolicyState, input)
|
offset_of!(ZSTD_rust_compressStream2ResultPolicyState, input) == 3 * size_of::<usize>()
|
||||||
== 3 * size_of::<usize>()
|
|
||||||
);
|
);
|
||||||
assert!(
|
assert!(
|
||||||
offset_of!(ZSTD_rust_compressStream2ResultPolicyState, compress_result)
|
offset_of!(ZSTD_rust_compressStream2ResultPolicyState, compress_result)
|
||||||
@@ -311,9 +307,7 @@ const _: () = {
|
|||||||
out_buff_flushed_size
|
out_buff_flushed_size
|
||||||
) == 6 * size_of::<usize>()
|
) == 6 * size_of::<usize>()
|
||||||
);
|
);
|
||||||
assert!(
|
assert!(size_of::<ZSTD_rust_compressStream2ResultPolicyState>() == 7 * size_of::<usize>());
|
||||||
size_of::<ZSTD_rust_compressStream2ResultPolicyState>() == 7 * size_of::<usize>()
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
@@ -14548,10 +14542,7 @@ mod tests {
|
|||||||
out_buff_flushed_size: 5,
|
out_buff_flushed_size: 5,
|
||||||
};
|
};
|
||||||
|
|
||||||
assert_eq!(
|
assert_eq!(unsafe { ZSTD_rust_compressStream2ResultPolicy(&state) }, 12);
|
||||||
unsafe { ZSTD_rust_compressStream2ResultPolicy(&state) },
|
|
||||||
12
|
|
||||||
);
|
|
||||||
assert_eq!(context.set_buffer_expectations_calls, 1);
|
assert_eq!(context.set_buffer_expectations_calls, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1705,10 +1705,7 @@ pub struct ZSTDMT_tryGetInputRangeResult {
|
|||||||
const _: () = {
|
const _: () = {
|
||||||
assert!(offset_of!(ZSTDMT_tryGetInputRangeResult, ready) == 0);
|
assert!(offset_of!(ZSTDMT_tryGetInputRangeResult, ready) == 0);
|
||||||
assert!(offset_of!(ZSTDMT_tryGetInputRangeResult, movePrefix) == size_of::<c_uint>());
|
assert!(offset_of!(ZSTDMT_tryGetInputRangeResult, movePrefix) == size_of::<c_uint>());
|
||||||
assert!(
|
assert!(offset_of!(ZSTDMT_tryGetInputRangeResult, bufferStart) == 2 * size_of::<c_uint>());
|
||||||
offset_of!(ZSTDMT_tryGetInputRangeResult, bufferStart)
|
|
||||||
== 2 * size_of::<c_uint>()
|
|
||||||
);
|
|
||||||
assert!(
|
assert!(
|
||||||
offset_of!(ZSTDMT_tryGetInputRangeResult, bufferCapacity)
|
offset_of!(ZSTDMT_tryGetInputRangeResult, bufferCapacity)
|
||||||
== 2 * size_of::<c_uint>() + size_of::<*mut c_void>()
|
== 2 * size_of::<c_uint>() + size_of::<*mut c_void>()
|
||||||
@@ -1723,11 +1720,8 @@ const _: () = {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
pub type ZSTDMT_inputRangeWaitFn = unsafe extern "C" fn(
|
pub type ZSTDMT_inputRangeWaitFn =
|
||||||
opaque: *mut c_void,
|
unsafe extern "C" fn(opaque: *mut c_void, buffer_start: *mut c_void, buffer_capacity: usize);
|
||||||
buffer_start: *mut c_void,
|
|
||||||
buffer_capacity: usize,
|
|
||||||
);
|
|
||||||
pub type ZSTDMT_inputRangeMovePrefixFn = unsafe extern "C" fn(
|
pub type ZSTDMT_inputRangeMovePrefixFn = unsafe extern "C" fn(
|
||||||
opaque: *mut c_void,
|
opaque: *mut c_void,
|
||||||
destination: *mut c_void,
|
destination: *mut c_void,
|
||||||
@@ -1735,11 +1729,8 @@ pub type ZSTDMT_inputRangeMovePrefixFn = unsafe extern "C" fn(
|
|||||||
size: usize,
|
size: usize,
|
||||||
round_buffer_pos: usize,
|
round_buffer_pos: usize,
|
||||||
);
|
);
|
||||||
pub type ZSTDMT_inputRangePublishBufferFn = unsafe extern "C" fn(
|
pub type ZSTDMT_inputRangePublishBufferFn =
|
||||||
opaque: *mut c_void,
|
unsafe extern "C" fn(opaque: *mut c_void, buffer_start: *mut c_void, buffer_capacity: usize);
|
||||||
buffer_start: *mut c_void,
|
|
||||||
buffer_capacity: usize,
|
|
||||||
);
|
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn commit_input_range_with<W, M, P>(
|
fn commit_input_range_with<W, M, P>(
|
||||||
@@ -9102,11 +9093,7 @@ mod tests {
|
|||||||
assert_eq!(size, prefix.len());
|
assert_eq!(size, prefix.len());
|
||||||
assert_eq!(round_buffer_pos, prefix.len());
|
assert_eq!(round_buffer_pos, prefix.len());
|
||||||
unsafe {
|
unsafe {
|
||||||
ptr::copy_nonoverlapping(
|
ptr::copy_nonoverlapping(source.cast::<u8>(), destination.cast::<u8>(), size);
|
||||||
source.cast::<u8>(),
|
|
||||||
destination.cast::<u8>(),
|
|
||||||
size,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
move_events.borrow_mut().push("move");
|
move_events.borrow_mut().push("move");
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user