diff options
| author | Thalia Archibald <thalia@archibald.dev> | 2025-03-04 20:28:38 -0800 |
|---|---|---|
| committer | Thalia Archibald <thalia@archibald.dev> | 2025-03-06 20:20:38 -0800 |
| commit | 988eb1997014987caad878699ee1e7c000214508 (patch) | |
| tree | 18f3a0bc36f4f660467f921878f917b36f13c8d0 /library/core/src/alloc/layout.rs | |
| parent | 08db600e8e276b548e986abe7239c2a85d2f425f (diff) | |
| download | rust-988eb1997014987caad878699ee1e7c000214508.tar.gz rust-988eb1997014987caad878699ee1e7c000214508.zip | |
library: Use size_of from the prelude instead of imported
Use `std::mem::{size_of, size_of_val, align_of, align_of_val}` from the
prelude instead of importing or qualifying them.
These functions were added to all preludes in Rust 1.80.
Diffstat (limited to 'library/core/src/alloc/layout.rs')
| -rw-r--r-- | library/core/src/alloc/layout.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/library/core/src/alloc/layout.rs b/library/core/src/alloc/layout.rs index 17f4d68867e..1595a3af883 100644 --- a/library/core/src/alloc/layout.rs +++ b/library/core/src/alloc/layout.rs @@ -17,7 +17,7 @@ use crate::{assert_unsafe_precondition, fmt, mem}; // * https://github.com/rust-lang/rust/pull/72189 // * https://github.com/rust-lang/rust/pull/79827 const fn size_align<T>() -> (usize, usize) { - (mem::size_of::<T>(), mem::align_of::<T>()) + (size_of::<T>(), align_of::<T>()) } /// Layout of a block of memory. @@ -182,7 +182,7 @@ impl Layout { #[must_use] #[inline] pub const fn for_value<T: ?Sized>(t: &T) -> Self { - let (size, align) = (mem::size_of_val(t), mem::align_of_val(t)); + let (size, align) = (size_of_val(t), align_of_val(t)); // SAFETY: see rationale in `new` for why this is using the unsafe variant unsafe { Layout::from_size_align_unchecked(size, align) } } |
