Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pod/src/bytemuck.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<T: Pod>() -> usize {
std::mem::size_of::<T>()
core::mem::size_of::<T>()
}

/// Convert a `Pod` into a slice of bytes (zero copy)
Expand Down
2 changes: 1 addition & 1 deletion pod/src/error.rs
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
2 changes: 1 addition & 1 deletion pod/src/list/list_trait.rs
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 2 additions & 2 deletions pod/src/list/list_view.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion pod/src/list/list_view_mut.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down
4 changes: 2 additions & 2 deletions pod/src/list/list_view_read_only.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down Expand Up @@ -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))]
Expand Down
4 changes: 2 additions & 2 deletions pod/src/optional_keys.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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]
Expand Down
2 changes: 1 addition & 1 deletion pod/src/primitives.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<wincode::config::DefaultConfig, Src = T>,
>(
Expand Down
4 changes: 2 additions & 2 deletions pod/src/slice.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ mod tests {
test_pubkey: [u8; 32],
}

const LENGTH_SIZE: usize = std::mem::size_of::<PodU32>();
const LENGTH_SIZE: usize = core::mem::size_of::<PodU32>();

#[test]
fn test_pod_slice() {
Expand Down Expand Up @@ -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::<TestStruct>() + 6;
let data_len = LENGTH_SIZE + core::mem::size_of::<TestStruct>() + 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::<TestStruct>::unpack(&pod_slice_bytes)
Expand Down
Loading