about summary refs log tree commit diff
path: root/library/core/src/slice/rotate.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/core/src/slice/rotate.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/core/src/slice/rotate.rs')
-rw-r--r--library/core/src/slice/rotate.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/library/core/src/slice/rotate.rs b/library/core/src/slice/rotate.rs
index 5d5ee4c7b62..80178f297ea 100644
--- a/library/core/src/slice/rotate.rs
+++ b/library/core/src/slice/rotate.rs
@@ -1,4 +1,4 @@
-use crate::mem::{self, MaybeUninit, SizedTypeProperties};
+use crate::mem::{MaybeUninit, SizedTypeProperties};
 use crate::{cmp, ptr};
 
 type BufType = [usize; 32];
@@ -21,12 +21,12 @@ pub(super) unsafe fn ptr_rotate<T>(left: usize, mid: *mut T, right: usize) {
     }
     // `T` is not a zero-sized type, so it's okay to divide by its size.
     if !cfg!(feature = "optimize_for_size")
-        && cmp::min(left, right) <= mem::size_of::<BufType>() / mem::size_of::<T>()
+        && cmp::min(left, right) <= size_of::<BufType>() / size_of::<T>()
     {
         // SAFETY: guaranteed by the caller
         unsafe { ptr_rotate_memmove(left, mid, right) };
     } else if !cfg!(feature = "optimize_for_size")
-        && ((left + right < 24) || (mem::size_of::<T>() > mem::size_of::<[usize; 4]>()))
+        && ((left + right < 24) || (size_of::<T>() > size_of::<[usize; 4]>()))
     {
         // SAFETY: guaranteed by the caller
         unsafe { ptr_rotate_gcd(left, mid, right) }