std::mem::{size,align}_of -> {size,align}_of (#254)
Some checks failed
Audit / audit (push) Has been cancelled
CI / fmt (push) Has been cancelled
CI / typo (push) Has been cancelled
CI / ci (macos-latest, stable, bash) (push) Has been cancelled
CI / ci (ubuntu-latest, stable, bash) (push) Has been cancelled
CI / ci (windows-latest, stable-x86_64-pc-windows-gnu, msys2 {0}) (push) Has been cancelled
Deny / audit (push) Has been cancelled
Doc / build (push) Has been cancelled
Doc / deploy (push) Has been cancelled

This commit is contained in:
hinto-janai 2024-08-09 19:09:25 -04:00 committed by GitHub
parent bca062d2f5
commit 59adf6dcf8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 6 additions and 11 deletions

View file

@ -70,7 +70,7 @@ pub trait Containerable {
macro_rules! int_container_able { macro_rules! int_container_able {
($int:ty ) => { ($int:ty ) => {
impl Containerable for $int { impl Containerable for $int {
const SIZE: usize = std::mem::size_of::<$int>(); const SIZE: usize = size_of::<$int>();
fn from_bytes(bytes: &[u8]) -> Self { fn from_bytes(bytes: &[u8]) -> Self {
<$int>::from_le_bytes(bytes.try_into().unwrap()) <$int>::from_le_bytes(bytes.try_into().unwrap())

View file

@ -7,7 +7,7 @@ pub fn checked_read_primitive<B: Buf, R: Sized>(
b: &mut B, b: &mut B,
read: impl Fn(&mut B) -> R, read: impl Fn(&mut B) -> R,
) -> Result<R> { ) -> Result<R> {
checked_read(b, read, core::mem::size_of::<R>()) checked_read(b, read, size_of::<R>())
} }
#[inline] #[inline]
@ -25,7 +25,7 @@ pub fn checked_write_primitive<B: BufMut, T: Sized>(
write: impl Fn(&mut B, T), write: impl Fn(&mut B, T),
t: T, t: T,
) -> Result<()> { ) -> Result<()> {
checked_write(b, write, t, core::mem::size_of::<T>()) checked_write(b, write, t, size_of::<T>())
} }
#[inline] #[inline]

View file

@ -121,7 +121,6 @@ pub type UnlockTime = u64;
/// # Size & Alignment /// # Size & Alignment
/// ```rust /// ```rust
/// # use cuprate_blockchain::types::*; /// # use cuprate_blockchain::types::*;
/// # use std::mem::*;
/// assert_eq!(size_of::<PreRctOutputId>(), 16); /// assert_eq!(size_of::<PreRctOutputId>(), 16);
/// assert_eq!(align_of::<PreRctOutputId>(), 8); /// assert_eq!(align_of::<PreRctOutputId>(), 8);
/// ``` /// ```
@ -174,7 +173,6 @@ impl Key for PreRctOutputId {}
/// # Size & Alignment /// # Size & Alignment
/// ```rust /// ```rust
/// # use cuprate_blockchain::types::*; /// # use cuprate_blockchain::types::*;
/// # use std::mem::*;
/// assert_eq!(size_of::<BlockInfo>(), 88); /// assert_eq!(size_of::<BlockInfo>(), 88);
/// assert_eq!(align_of::<BlockInfo>(), 8); /// assert_eq!(align_of::<BlockInfo>(), 8);
/// ``` /// ```
@ -226,7 +224,6 @@ bitflags::bitflags! {
/// # Size & Alignment /// # Size & Alignment
/// ```rust /// ```rust
/// # use cuprate_blockchain::types::*; /// # use cuprate_blockchain::types::*;
/// # use std::mem::*;
/// assert_eq!(size_of::<OutputFlags>(), 4); /// assert_eq!(size_of::<OutputFlags>(), 4);
/// assert_eq!(align_of::<OutputFlags>(), 4); /// assert_eq!(align_of::<OutputFlags>(), 4);
/// ``` /// ```
@ -262,7 +259,6 @@ bitflags::bitflags! {
/// # Size & Alignment /// # Size & Alignment
/// ```rust /// ```rust
/// # use cuprate_blockchain::types::*; /// # use cuprate_blockchain::types::*;
/// # use std::mem::*;
/// assert_eq!(size_of::<Output>(), 48); /// assert_eq!(size_of::<Output>(), 48);
/// assert_eq!(align_of::<Output>(), 8); /// assert_eq!(align_of::<Output>(), 8);
/// ``` /// ```
@ -306,7 +302,6 @@ pub struct Output {
/// # Size & Alignment /// # Size & Alignment
/// ```rust /// ```rust
/// # use cuprate_blockchain::types::*; /// # use cuprate_blockchain::types::*;
/// # use std::mem::*;
/// assert_eq!(size_of::<RctOutput>(), 80); /// assert_eq!(size_of::<RctOutput>(), 80);
/// assert_eq!(align_of::<RctOutput>(), 8); /// assert_eq!(align_of::<RctOutput>(), 8);
/// ``` /// ```

View file

@ -66,8 +66,8 @@ As `ConcreteEnv` is just a re-exposed type which has varying inner types,
it means some properties will change depending on the backend used. it means some properties will change depending on the backend used.
For example: For example:
- [`std::mem::size_of::<ConcreteEnv>`] - [`size_of::<ConcreteEnv>`]
- [`std::mem::align_of::<ConcreteEnv>`] - [`align_of::<ConcreteEnv>`]
Things like these functions are affected by the backend and inner data, Things like these functions are affected by the backend and inner data,
and should not be relied upon. This extends to any `struct/enum` that contains `ConcreteEnv`. and should not be relied upon. This extends to any `struct/enum` that contains `ConcreteEnv`.

View file

@ -109,7 +109,7 @@ impl<T> Storable for T
where where
Self: Pod + Debug, Self: Pod + Debug,
{ {
const BYTE_LENGTH: Option<usize> = Some(std::mem::size_of::<T>()); const BYTE_LENGTH: Option<usize> = Some(size_of::<T>());
#[inline] #[inline]
fn as_bytes(&self) -> &[u8] { fn as_bytes(&self) -> &[u8] {