diff --git a/pod/src/bytemuck.rs b/pod/src/bytemuck.rs index 744553d2..f50eacc5 100644 --- a/pod/src/bytemuck.rs +++ b/pod/src/bytemuck.rs @@ -4,7 +4,7 @@ use {bytemuck::Pod, solana_program_error::ProgramError}; /// On-chain size of a `Pod` type pub const fn pod_get_packed_len() -> usize { - std::mem::size_of::() + core::mem::size_of::() } /// Convert a `Pod` into a slice of bytes (zero copy) diff --git a/pod/src/error.rs b/pod/src/error.rs index 7e1a4547..19b5bcb4 100644 --- a/pod/src/error.rs +++ b/pod/src/error.rs @@ -1,7 +1,7 @@ //! Error types use { + core::num::TryFromIntError, solana_program_error::{ProgramError, ToStr}, - std::num::TryFromIntError, }; /// Errors that may be returned by the spl-pod library. diff --git a/pod/src/list/list_trait.rs b/pod/src/list/list_trait.rs index c7ebf374..4973e075 100644 --- a/pod/src/list/list_trait.rs +++ b/pod/src/list/list_trait.rs @@ -1,8 +1,8 @@ use { crate::{list::ListView, pod_length::PodLength}, bytemuck::Pod, + core::ops::Deref, solana_program_error::ProgramError, - std::ops::Deref, }; /// A trait to abstract the shared, read-only behavior diff --git a/pod/src/list/list_view.rs b/pod/src/list/list_view.rs index 23a64391..21bae335 100644 --- a/pod/src/list/list_view.rs +++ b/pod/src/list/list_view.rs @@ -11,12 +11,12 @@ use { primitives::PodU32, }, bytemuck::Pod, - solana_program_error::ProgramError, - std::{ + core::{ marker::PhantomData, mem::{align_of, size_of}, ops::Range, }, + solana_program_error::ProgramError, }; /// An API for interpreting a raw buffer (`&[u8]`) as a variable-length collection of Pod elements. diff --git a/pod/src/list/list_view_mut.rs b/pod/src/list/list_view_mut.rs index 4f0ca49f..5a936e7a 100644 --- a/pod/src/list/list_view_mut.rs +++ b/pod/src/list/list_view_mut.rs @@ -5,8 +5,8 @@ use { error::PodSliceError, list::list_trait::List, pod_length::PodLength, primitives::PodU32, }, bytemuck::Pod, + core::ops::{Deref, DerefMut}, solana_program_error::ProgramError, - std::ops::{Deref, DerefMut}, }; #[derive(Debug)] diff --git a/pod/src/list/list_view_read_only.rs b/pod/src/list/list_view_read_only.rs index 6d44379a..211437a8 100644 --- a/pod/src/list/list_view_read_only.rs +++ b/pod/src/list/list_view_read_only.rs @@ -3,7 +3,7 @@ use { crate::{list::list_trait::List, pod_length::PodLength, primitives::PodU32}, bytemuck::Pod, - std::ops::Deref, + core::ops::Deref, }; #[derive(Debug)] @@ -41,7 +41,7 @@ mod tests { primitives::{PodU32, PodU64}, }, bytemuck_derive::{Pod as DerivePod, Zeroable}, - std::mem::size_of, + core::mem::size_of, }; #[repr(C, align(16))] diff --git a/pod/src/optional_keys.rs b/pod/src/optional_keys.rs index 82a0726e..28f6bed0 100644 --- a/pod/src/optional_keys.rs +++ b/pod/src/optional_keys.rs @@ -10,9 +10,9 @@ use { }; #[cfg(feature = "serde-traits")] use { + core::{convert::TryFrom, fmt, str::FromStr}, serde::de::{Error, Unexpected, Visitor}, serde::{Deserialize, Deserializer, Serialize, Serializer}, - std::{convert::TryFrom, fmt, str::FromStr}, }; /// A Pubkey that encodes `None` as all `0`, meant to be usable as a `Pod` type, @@ -293,7 +293,7 @@ mod tests { // `solana-zk-sdk` 2.1. fn elgamal_pubkey_from_bytes(bytes: &[u8]) -> PodElGamalPubkey { let string = BASE64_STANDARD.encode(bytes); - std::str::FromStr::from_str(&string).unwrap() + core::str::FromStr::from_str(&string).unwrap() } #[test] diff --git a/pod/src/primitives.rs b/pod/src/primitives.rs index 23953b2f..03174170 100644 --- a/pod/src/primitives.rs +++ b/pod/src/primitives.rs @@ -297,7 +297,7 @@ mod tests { #[test_case(PodU128::from_primitive(u128::MAX))] fn wincode_roundtrip< T: PartialEq - + std::fmt::Debug + + core::fmt::Debug + for<'de> wincode::SchemaRead<'de, wincode::config::DefaultConfig, Dst = T> + wincode::SchemaWrite, >( diff --git a/pod/src/slice.rs b/pod/src/slice.rs index a5b01e77..8a6c01dc 100644 --- a/pod/src/slice.rs +++ b/pod/src/slice.rs @@ -95,7 +95,7 @@ mod tests { test_pubkey: [u8; 32], } - const LENGTH_SIZE: usize = std::mem::size_of::(); + const LENGTH_SIZE: usize = core::mem::size_of::(); #[test] fn test_pod_slice() { @@ -128,7 +128,7 @@ mod tests { fn test_pod_slice_buffer_too_large() { // Length is 1. We pass one test struct with 6 trailing bytes to // trigger BufferTooLarge. - let data_len = LENGTH_SIZE + std::mem::size_of::() + 6; + let data_len = LENGTH_SIZE + core::mem::size_of::() + 6; let mut pod_slice_bytes = vec![1; data_len]; pod_slice_bytes[0..4].copy_from_slice(&[1, 0, 0, 0]); let err = PodSlice::::unpack(&pod_slice_bytes)