about summary refs log tree commit diff
path: root/library/alloc/src/string.rs
diff options
context:
space:
mode:
authorThalia Archibald <thalia@archibald.dev>2025-03-04 20:28:38 -0800
committerThalia Archibald <thalia@archibald.dev>2025-03-06 20:20:38 -0800
commit988eb1997014987caad878699ee1e7c000214508 (patch)
tree18f3a0bc36f4f660467f921878f917b36f13c8d0 /library/alloc/src/string.rs
parent08db600e8e276b548e986abe7239c2a85d2f425f (diff)
downloadrust-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/alloc/src/string.rs')
-rw-r--r--library/alloc/src/string.rs6
1 files changed, 2 insertions, 4 deletions
diff --git a/library/alloc/src/string.rs b/library/alloc/src/string.rs
index f10ef1fca13..679c8eb12b4 100644
--- a/library/alloc/src/string.rs
+++ b/library/alloc/src/string.rs
@@ -119,8 +119,6 @@ use crate::vec::{self, Vec};
 /// the same `char`s:
 ///
 /// ```
-/// use std::mem;
-///
 /// // `s` is ASCII which represents each `char` as one byte
 /// let s = "hello";
 /// assert_eq!(s.len(), 5);
@@ -128,7 +126,7 @@ use crate::vec::{self, Vec};
 /// // A `char` array with the same contents would be longer because
 /// // every `char` is four bytes
 /// let s = ['h', 'e', 'l', 'l', 'o'];
-/// let size: usize = s.into_iter().map(|c| mem::size_of_val(&c)).sum();
+/// let size: usize = s.into_iter().map(|c| size_of_val(&c)).sum();
 /// assert_eq!(size, 20);
 ///
 /// // However, for non-ASCII strings, the difference will be smaller
@@ -137,7 +135,7 @@ use crate::vec::{self, Vec};
 /// assert_eq!(s.len(), 20);
 ///
 /// let s = ['💖', '💖', '💖', '💖', '💖'];
-/// let size: usize = s.into_iter().map(|c| mem::size_of_val(&c)).sum();
+/// let size: usize = s.into_iter().map(|c| size_of_val(&c)).sum();
 /// assert_eq!(size, 20);
 /// ```
 ///