From 773997b9789c8499b234f15ab56a7eac415fcc9f Mon Sep 17 00:00:00 2001 From: itsjunetime Date: Wed, 16 Oct 2024 14:19:34 -0600 Subject: [PATCH] Switch back to casting metadata to *const u8 for c_char = i8 platforms --- arrow-schema/src/ffi.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/arrow-schema/src/ffi.rs b/arrow-schema/src/ffi.rs index 80b23e593421..70650d769cf6 100644 --- a/arrow-schema/src/ffi.rs +++ b/arrow-schema/src/ffi.rs @@ -336,7 +336,12 @@ impl FFI_ArrowSchema { Ok(HashMap::new()) } else { let mut pos = 0; - let buffer: *const u8 = self.metadata; + + // On some platforms, c_char = u8, and on some, c_char = i8. Where c_char = u8, clippy + // wants to complain that we're casting to the same type, but if we remove the cast, + // this will fail to compile on the other platforms. So we must allow it. + #[allow(clippy::unnecessary_cast)] + let buffer: *const u8 = self.metadata as *const u8; fn next_four_bytes(buffer: *const u8, pos: &mut isize) -> [u8; 4] { let out = unsafe {