From 02a7f01c17a68f035524b2ffc34283ddcd0e8441 Mon Sep 17 00:00:00 2001 From: bluurryy <164359728+bluurryy@users.noreply.github.com> Date: Thu, 22 Aug 2024 14:29:21 +0200 Subject: [PATCH] doc: nits and fixes part two --- src/chunk_raw.rs | 14 +++++++------- src/lib.rs | 14 +++++++------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/chunk_raw.rs b/src/chunk_raw.rs index b5e7536..eefcaac 100644 --- a/src/chunk_raw.rs +++ b/src/chunk_raw.rs @@ -60,7 +60,7 @@ impl RawChunk { // The chunk size must always be a multiple of `CHUNK_ALIGN_MIN`. // We use optimizations in `alloc` that require this. - // `ChunkSize::allocate` must have already trimmed the allocates size to a multiple of `CHUNK_ALIGN_MIN` + // `ChunkSize::allocate` must have already trimmed the allocation size to a multiple of `CHUNK_ALIGN_MIN` debug_assert!(size % CHUNK_ALIGN_MIN == 0); let header = unsafe { @@ -154,8 +154,8 @@ impl RawChunk { if IS_CONST_ALIGN && layout.align() <= MIN_ALIGN { // alignment is already sufficient } else { - // Aligning an address that is smaller or equal to `range.end` with an alignment - // that is smaller or equal to `CHUNK_ALIGN_MIN` can not exceed `range.end` and + // Aligning an address that is `<= range.end` with an alignment + // that is `<= CHUNK_ALIGN_MIN` can not exceed `range.end` and // can not overflow as `range.end` is always aligned to `CHUNK_ALIGN_MIN` start = up_align_usize_unchecked(start, layout.align()); } @@ -401,8 +401,8 @@ impl RawChunk { if IS_CONST_ALIGN && layout.align() <= CHUNK_ALIGN_MIN { // SAFETY: - // Aligning an address that is smaller or equal to `range.end` with an alignment - // that is smaller or equal to `CHUNK_ALIGN_MIN` can not exceed `range.end` and + // Aligning an address that is `<= range.end` with an alignment + // that is `<= CHUNK_ALIGN_MIN` can not exceed `range.end` and // can not overflow start = unsafe { up_align_nonzero_unchecked(start, layout.align()) } } else { @@ -470,8 +470,8 @@ impl RawChunk { let mut pos = nonnull::addr(self.pos()).get(); if UP { - // Aligning an address that is smaller or equal to `range.end` with an alignment - // that is smaller or equal to `CHUNK_ALIGN_MIN` can not exceed `range.end` and + // Aligning an address that is `<= range.end` with an alignment + // that is `<= CHUNK_ALIGN_MIN` can not exceed `range.end` and // can not overflow as `range.end` is always aligned to `CHUNK_ALIGN_MIN`. pos = up_align_usize_unchecked(pos, ALIGN); } else { diff --git a/src/lib.rs b/src/lib.rs index 491cb79..12d454a 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -213,7 +213,7 @@ //! * **`alloc`** — Adds `Global` as the default allocator, `BumpBox::into_box` and some interactions with `alloc` collections. //! * **`serde`** — Adds `Serialize` implementations for `BumpBox`, strings and vectors, and `DeserializeSeed` for strings and vectors. //! * **`zerocopy`** — Adds `alloc_zeroed(_slice)`, `init_zeroed`, `resize_zeroed` and `extend_zeroed`. -//! +//! //! ### Nightly features //! * **`nightly-allocator-api`** — Enables `allocator-api2`'s `nightly` feature which makes it reexport the nightly allocator api instead of its own implementation. //! With this you can bump allocate collections from the standard library. @@ -1507,9 +1507,9 @@ define_alloc_methods! { /// assert_eq!(slice, [1, 2, 3]); /// ``` impl - /// For better performance prefer [`alloc_iter_exact`](Bump::alloc_iter_exact) or [alloc_iter_mut](Bump::alloc_iter_mut)([_rev](Bump::alloc_iter_mut_rev)). + /// For better performance prefer [`alloc_iter_exact`](Bump::alloc_iter_exact) or [alloc_iter_mut](Bump::alloc_iter_mut). for pub fn alloc_iter - /// For better performance prefer [`try_alloc_iter_exact`](Bump::try_alloc_iter_exact) or [try_alloc_iter_mut](Bump::try_alloc_iter_mut)([_rev](Bump::try_alloc_iter_mut_rev)). + /// For better performance prefer [`try_alloc_iter_exact`](Bump::try_alloc_iter_exact) or [try_alloc_iter_mut](Bump::try_alloc_iter_mut). for pub fn try_alloc_iter fn generic_alloc_iter<{T}>(&self, iter: impl IntoIterator) -> BumpBox<[T]> | BumpBox<'a, [T]> { let iter = iter.into_iter(); @@ -1574,11 +1574,11 @@ define_alloc_methods! { impl /// Unlike [`alloc_iter`](Bump::alloc_iter), this function requires a mutable `Bump(Scope)`. /// - /// When bumping downwards, prefer [`alloc_iter_mut_rev`](Bump::alloc_iter_mut_rev) or [`alloc_iter_exact`](Bump::alloc_iter_exact) to avoid having to internally move the slice after creation. + /// When bumping downwards, prefer [`alloc_iter_mut_rev`](Bump::alloc_iter_mut_rev) or [`alloc_iter_exact`](Bump::alloc_iter_exact) to avoid a shift of the slice. for pub fn alloc_iter_mut /// Unlike [`try_alloc_iter`](Bump::try_alloc_iter), this function requires a mutable `Bump(Scope)`. /// - /// When bumping downwards, prefer [`try_alloc_iter_mut_rev`](Bump::try_alloc_iter_mut_rev) or [`try_alloc_iter_exact`](Bump::try_alloc_iter_exact) to avoid having to internally move the slice after creation. + /// When bumping downwards, prefer [`try_alloc_iter_mut_rev`](Bump::try_alloc_iter_mut_rev) or [`try_alloc_iter_exact`](Bump::try_alloc_iter_exact) to avoid a shift of the slice. for pub fn try_alloc_iter_mut fn generic_alloc_iter_mut<{T}>(&mut self, iter: impl IntoIterator) -> BumpBox<[T]> | BumpBox<'a, [T]> { let iter = iter.into_iter(); @@ -1596,7 +1596,7 @@ define_alloc_methods! { /// Allocate elements of an iterator into a slice in reverse order. impl /// - /// When bumping upwards, prefer [`alloc_iter_mut`](Self::alloc_iter_mut) or [`alloc_iter_exact`](Self::alloc_iter_exact) tto avoid having to internally move the slice after creation. + /// When bumping upwards, prefer [`alloc_iter_mut`](Self::alloc_iter_mut) or [`alloc_iter_exact`](Self::alloc_iter_exact) to avoid a shift of the slice. do examples /// ``` /// # use bump_scope::Bump; @@ -1607,7 +1607,7 @@ define_alloc_methods! { /// ``` for pub fn alloc_iter_mut_rev /// - /// When bumping upwards, prefer [`try_alloc_iter_mut`](Self::try_alloc_iter_mut) or [`try_alloc_iter_exact`](Self::try_alloc_iter_exact) to avoid having to internally move the slice after creation. + /// When bumping upwards, prefer [`try_alloc_iter_mut`](Self::try_alloc_iter_mut) or [`try_alloc_iter_exact`](Self::try_alloc_iter_exact) to avoid a shift of the slice. for pub fn try_alloc_iter_mut_rev fn generic_alloc_iter_mut_rev<{T}>(&mut self, iter: impl IntoIterator) -> BumpBox<[T]> | BumpBox<'a, [T]> { let iter = iter.into_iter();