about summary refs log tree commit diff
path: root/library/core/src/alloc
diff options
context:
space:
mode:
Diffstat (limited to 'library/core/src/alloc')
-rw-r--r--library/core/src/alloc/global.rs11
-rw-r--r--library/core/src/alloc/layout.rs8
-rw-r--r--library/core/src/alloc/mod.rs2
3 files changed, 8 insertions, 13 deletions
diff --git a/library/core/src/alloc/global.rs b/library/core/src/alloc/global.rs
index 8df3ace54ff..a6f799c4a7d 100644
--- a/library/core/src/alloc/global.rs
+++ b/library/core/src/alloc/global.rs
@@ -1,6 +1,5 @@
 use crate::alloc::Layout;
-use crate::cmp;
-use crate::ptr;
+use crate::{cmp, ptr};
 
 /// A memory allocator that can be registered as the standard library’s default
 /// through the `#[global_allocator]` attribute.
@@ -118,7 +117,7 @@ use crate::ptr;
 ///   having side effects.
 #[stable(feature = "global_alloc", since = "1.28.0")]
 pub unsafe trait GlobalAlloc {
-    /// Allocate memory as described by the given `layout`.
+    /// Allocates memory as described by the given `layout`.
     ///
     /// Returns a pointer to newly-allocated memory,
     /// or null to indicate allocation failure.
@@ -153,7 +152,7 @@ pub unsafe trait GlobalAlloc {
     #[stable(feature = "global_alloc", since = "1.28.0")]
     unsafe fn alloc(&self, layout: Layout) -> *mut u8;
 
-    /// Deallocate the block of memory at the given `ptr` pointer with the given `layout`.
+    /// Deallocates the block of memory at the given `ptr` pointer with the given `layout`.
     ///
     /// # Safety
     ///
@@ -200,7 +199,7 @@ pub unsafe trait GlobalAlloc {
         ptr
     }
 
-    /// Shrink or grow a block of memory to the given `new_size` in bytes.
+    /// Shrinks or grows a block of memory to the given `new_size` in bytes.
     /// The block is described by the given `ptr` pointer and `layout`.
     ///
     /// If this returns a non-null pointer, then ownership of the memory block
@@ -232,7 +231,7 @@ pub unsafe trait GlobalAlloc {
     /// * `new_size` must be greater than zero.
     ///
     /// * `new_size`, when rounded up to the nearest multiple of `layout.align()`,
-    ///   must not overflow isize (i.e., the rounded value must be less than or
+    ///   must not overflow `isize` (i.e., the rounded value must be less than or
     ///   equal to `isize::MAX`).
     ///
     /// (Extension subtraits might provide more specific bounds on
diff --git a/library/core/src/alloc/layout.rs b/library/core/src/alloc/layout.rs
index e96a41422a2..549a4bc6727 100644
--- a/library/core/src/alloc/layout.rs
+++ b/library/core/src/alloc/layout.rs
@@ -4,11 +4,9 @@
 // collections, resulting in having to optimize down excess IR multiple times.
 // Your performance intuition is useless. Run perf.
 
-use crate::cmp;
 use crate::error::Error;
-use crate::fmt;
-use crate::mem;
 use crate::ptr::{Alignment, NonNull};
+use crate::{cmp, fmt, mem};
 
 // While this function is used in one place and its implementation
 // could be inlined, the previous attempts to do so made rustc
@@ -26,7 +24,7 @@ const fn size_align<T>() -> (usize, usize) {
 /// You build a `Layout` up as an input to give to an allocator.
 ///
 /// All layouts have an associated size and a power-of-two alignment. The size, when rounded up to
-/// the nearest multiple of `align`, does not overflow isize (i.e., the rounded value will always be
+/// the nearest multiple of `align`, does not overflow `isize` (i.e., the rounded value will always be
 /// less than or equal to `isize::MAX`).
 ///
 /// (Note that layouts are *not* required to have non-zero size,
@@ -61,7 +59,7 @@ impl Layout {
     /// * `align` must be a power of two,
     ///
     /// * `size`, when rounded up to the nearest multiple of `align`,
-    ///    must not overflow isize (i.e., the rounded value must be
+    ///    must not overflow `isize` (i.e., the rounded value must be
     ///    less than or equal to `isize::MAX`).
     #[stable(feature = "alloc_layout", since = "1.28.0")]
     #[rustc_const_stable(feature = "const_alloc_layout_size_align", since = "1.50.0")]
diff --git a/library/core/src/alloc/mod.rs b/library/core/src/alloc/mod.rs
index 1c8e6676544..aa841db045c 100644
--- a/library/core/src/alloc/mod.rs
+++ b/library/core/src/alloc/mod.rs
@@ -17,10 +17,8 @@ pub use self::layout::Layout;
 )]
 #[allow(deprecated, deprecated_in_future)]
 pub use self::layout::LayoutErr;
-
 #[stable(feature = "alloc_layout_error", since = "1.50.0")]
 pub use self::layout::LayoutError;
-
 use crate::error::Error;
 use crate::fmt;
 use crate::ptr::{self, NonNull};