[meta] Apply clippy suggestions

This commit is contained in:
2026-04-15 15:51:42 +08:00
parent e6112d764d
commit 1ffb807fe8
2 changed files with 6 additions and 5 deletions

View File

@@ -210,11 +210,11 @@ impl Image {
self.data.write({
// This leaks the memory, but ...
let mut temp_vec: mem::ManuallyDrop<Vec<u32>> =
mem::ManuallyDrop::new(Vec::with_capacity(final_len / header_alignment as usize));
let (ptr, _, cap) =
Vec::<u32>::with_capacity(final_len / header_alignment as usize).into_raw_parts();
// This new vector picks up the memory.
// The new vector is responsible to free the memory instead.
unsafe { Vec::from_raw_parts(temp_vec.as_mut_ptr().cast(), final_len, final_len) }
unsafe { Vec::from_raw_parts(ptr.cast(), final_len, cap * size_of::<u32>()) }
});
let owned_buffer = unsafe { self.data.assume_init_mut() };

View File

@@ -666,8 +666,9 @@ where
};
match value {
BasicTypeEnum::ArrayType(ty) => try_fold_basic_type(new_init, &ty.get_element_type(), f),
BasicTypeEnum::FloatType(_) | BasicTypeEnum::IntType(_) => ControlFlow::Continue(new_init),
BasicTypeEnum::PointerType(_) => ControlFlow::Continue(new_init),
BasicTypeEnum::FloatType(_) | BasicTypeEnum::IntType(_) | BasicTypeEnum::PointerType(_) => {
ControlFlow::Continue(new_init)
}
BasicTypeEnum::StructType(ty) => {
// fold all fields of the struct
ty.get_field_types()