Skip to content

Commit 163154c

Browse files
committed
chore: fix clippy truncation warnings in upload_gpu_patches
Signed-off-by: Alexander Droste <alexander.droste@protonmail.com>
1 parent 19d1e1b commit 163154c

1 file changed

Lines changed: 8 additions & 7 deletions

File tree

vortex-cuda/src/kernel/patches/types.rs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -221,18 +221,19 @@ pub(crate) fn upload_gpu_patches(
221221
device_patches: &DevicePatches,
222222
ctx: &CudaExecutionCtx,
223223
) -> VortexResult<(BufferHandle, u64)> {
224-
#[expect(clippy::cast_possible_truncation)]
225-
// Zero-initialize to avoid uninitialized padding bytes (e.g. between
226-
// chunk_offset_type and indices) which would be UB when serialized.
224+
// Zero-initialize to avoid uninitialized padding bytes.
227225
let mut gpu_patches: GPUPatches = unsafe { std::mem::zeroed() };
228226
gpu_patches.chunk_offsets = device_patches.chunk_offsets.cuda_device_ptr()? as _;
229227
gpu_patches.chunk_offset_type = ptype_to_chunk_offset_type(device_patches.chunk_offset_ptype)?;
230228
gpu_patches.indices = device_patches.indices.cuda_device_ptr()? as _;
231229
gpu_patches.values = device_patches.values.cuda_device_ptr()? as _;
232-
gpu_patches.offset = device_patches.offset as u32;
233-
gpu_patches.offset_within_chunk = device_patches.offset_within_chunk as u32;
234-
gpu_patches.num_patches = device_patches.num_patches as u32;
235-
gpu_patches.n_chunks = device_patches.n_chunks as u32;
230+
#[expect(clippy::cast_possible_truncation)]
231+
{
232+
gpu_patches.offset = device_patches.offset as u32;
233+
gpu_patches.offset_within_chunk = device_patches.offset_within_chunk as u32;
234+
gpu_patches.num_patches = device_patches.num_patches as u32;
235+
gpu_patches.n_chunks = device_patches.n_chunks as u32;
236+
}
236237

237238
// Serialize the repr(C) struct to bytes and upload to the device.
238239
let bytes = unsafe {

0 commit comments

Comments
 (0)