about summary refs log tree commit diff
path: root/library/std/src/sys/alloc/unix.rs
diff options
context:
space:
mode:
authorMatthias Krüger <476013+matthiaskrgr@users.noreply.github.com>2025-03-07 10:12:44 +0100
committerGitHub <noreply@github.com>2025-03-07 10:12:44 +0100
commitb8346320717d4080d6fa176b4efbd5b1a642db4a (patch)
tree4e46716aab177407f90ae19f165b4920b4686506 /library/std/src/sys/alloc/unix.rs
parent6e7d1353d1fc203c648d0714d576a1b2be93817c (diff)
parent5dfa2f5fd0d2e1cdf650679d709ae71bbad7d87a (diff)
downloadrust-b8346320717d4080d6fa176b4efbd5b1a642db4a.tar.gz
rust-b8346320717d4080d6fa176b4efbd5b1a642db4a.zip
Rollup merge of #138034 - thaliaarchi:use-prelude-size-of, r=tgross35
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.

try-job: test-various
try-job: x86_64-gnu
try-job: x86_64-msvc-1
Diffstat (limited to 'library/std/src/sys/alloc/unix.rs')
-rw-r--r--library/std/src/sys/alloc/unix.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/library/std/src/sys/alloc/unix.rs b/library/std/src/sys/alloc/unix.rs
index 1af9d766290..a7ac4117ec9 100644
--- a/library/std/src/sys/alloc/unix.rs
+++ b/library/std/src/sys/alloc/unix.rs
@@ -81,7 +81,7 @@ cfg_if::cfg_if! {
             // while others require the alignment to be at least the pointer size (Illumos, macOS).
             // posix_memalign only has one, clear requirement: that the alignment be a multiple of
             // `sizeof(void*)`. Since these are all powers of 2, we can just use max.
-            let align = layout.align().max(crate::mem::size_of::<usize>());
+            let align = layout.align().max(size_of::<usize>());
             let ret = unsafe { libc::posix_memalign(&mut out, align, layout.size()) };
             if ret != 0 { ptr::null_mut() } else { out as *mut u8 }
         }