From fb80d834e4d13f2b2f61ee5b5833091387865577 Mon Sep 17 00:00:00 2001 From: Denys Zadorozhnyi Date: Tue, 13 Aug 2024 12:47:04 +0300 Subject: [PATCH] fix clippy warnings --- sdk/stdlib-sys/src/intrinsics/felt.rs | 8 +++++--- sdk/stdlib-sys/src/stdlib/crypto/hashes.rs | 4 ++-- sdk/stdlib-sys/src/stdlib/mem.rs | 2 +- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/sdk/stdlib-sys/src/intrinsics/felt.rs b/sdk/stdlib-sys/src/intrinsics/felt.rs index 51fa936d0..632eec144 100644 --- a/sdk/stdlib-sys/src/intrinsics/felt.rs +++ b/sdk/stdlib-sys/src/intrinsics/felt.rs @@ -1,3 +1,5 @@ +#![allow(clippy::transmute_int_to_float)] + use core::ops::{Add, AddAssign, Div, DivAssign, Mul, MulAssign, Neg, Sub, SubAssign}; #[link(wasm_import_module = "miden:stdlib/intrinsics_felt")] @@ -139,19 +141,19 @@ impl From for u64 { impl From for Felt { fn from(value: u32) -> Self { - Self(unsafe { core::mem::transmute(value) }) + Self(unsafe { core::mem::transmute::(value) }) } } impl From for Felt { fn from(value: u16) -> Self { - Self(unsafe { core::mem::transmute(value as u32) }) + Self(unsafe { core::mem::transmute::(value as u32) }) } } impl From for Felt { fn from(value: u8) -> Self { - Self(unsafe { core::mem::transmute(value as u32) }) + Self(unsafe { core::mem::transmute::(value as u32) }) } } diff --git a/sdk/stdlib-sys/src/stdlib/crypto/hashes.rs b/sdk/stdlib-sys/src/stdlib/crypto/hashes.rs index 3f257335e..e223a62c5 100644 --- a/sdk/stdlib-sys/src/stdlib/crypto/hashes.rs +++ b/sdk/stdlib-sys/src/stdlib/crypto/hashes.rs @@ -102,7 +102,7 @@ fn hash_1to1( input: [u8; 32], extern_hash_1to1: unsafe extern "C" fn(u32, u32, u32, u32, u32, u32, u32, u32, *mut u8), ) -> [u8; 32] { - let input = unsafe { core::mem::transmute::<_, [u32; 8]>(input) }; + let input = unsafe { core::mem::transmute::<[u8; 32], [u32; 8]>(input) }; unsafe { let mut ret_area = ::core::mem::MaybeUninit::<[u8; 32]>::uninit(); let ptr = ret_area.as_mut_ptr() as *mut u8; @@ -137,7 +137,7 @@ fn hash_2to1( *mut u8, ), ) -> [u8; 32] { - let input = unsafe { core::mem::transmute::<_, [u32; 16]>(input) }; + let input = unsafe { core::mem::transmute::<[u8; 64], [u32; 16]>(input) }; unsafe { let mut ret_area = ::core::mem::MaybeUninit::<[u8; 32]>::uninit(); let ptr = ret_area.as_mut_ptr() as *mut u8; diff --git a/sdk/stdlib-sys/src/stdlib/mem.rs b/sdk/stdlib-sys/src/stdlib/mem.rs index b4fd44cdc..aedb437b7 100644 --- a/sdk/stdlib-sys/src/stdlib/mem.rs +++ b/sdk/stdlib-sys/src/stdlib/mem.rs @@ -91,7 +91,7 @@ pub fn pipe_double_words_to_memory(num_words: Felt) -> (Word, Vec) { } let num_words_in_felts = num_words.as_u64() as usize * 4; - let mut buf: Vec = Vec::with_capacity(num_words_in_felts as usize); + let mut buf: Vec = Vec::with_capacity(num_words_in_felts); let write_ptr = buf.as_mut_ptr(); let end_ptr = unsafe { write_ptr.add(num_words_in_felts) }; // Place for returned C, B, A, write_ptr