Skip to content

Commit

Permalink
docs(allocator): reformat docs
Browse files Browse the repository at this point in the history
  • Loading branch information
overlookmotel committed Jan 20, 2025
1 parent d9f5e7f commit e544783
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 19 deletions.
6 changes: 3 additions & 3 deletions crates/oxc_allocator/src/boxed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ use crate::Allocator;

/// A `Box` without [`Drop`], which stores its data in the arena allocator.
///
/// ## No `Drop`s
/// # No `Drop`s
///
/// Objects allocated into Oxc memory arenas are never [`Dropped`](Drop). Memory is released in bulk
/// when the allocator is dropped, without dropping the individual objects in the arena.
Expand All @@ -35,7 +35,7 @@ impl<T> Box<'_, T> {
/// Take ownership of the value stored in this [`Box`], consuming the box in
/// the process.
///
/// ## Example
/// # Examples
/// ```
/// use oxc_allocator::{Allocator, Box};
///
Expand Down Expand Up @@ -64,7 +64,7 @@ impl<T> Box<'_, T> {
/// Put a `value` into a memory arena and get back a [`Box`] with ownership
/// to the allocation.
///
/// ## Example
/// # Examples
/// ```
/// use oxc_allocator::{Allocator, Box};
///
Expand Down
2 changes: 1 addition & 1 deletion crates/oxc_allocator/src/hash_map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ type FxHashMap<'alloc, K, V> = hashbrown::HashMap<K, V, FxBuildHasher, &'alloc B
/// All APIs are the same, except create a [`HashMap`] with
/// either [`new_in`](HashMap::new_in) or [`with_capacity_in`](HashMap::with_capacity_in).
///
/// ## No `Drop`s
/// # No `Drop`s
///
/// Objects allocated into Oxc memory arenas are never [`Dropped`](Drop). Memory is released in bulk
/// when the allocator is dropped, without dropping the individual objects in the arena.
Expand Down
7 changes: 3 additions & 4 deletions crates/oxc_allocator/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ impl Allocator {
/// # Panics
/// Panics if reserving space for `T` fails.
///
/// # Example
/// # Examples
/// ```
/// use oxc_allocator::Allocator;
///
Expand All @@ -120,7 +120,7 @@ impl Allocator {
/// # Panics
/// Panics if reserving space for the string fails.
///
/// # Example
/// # Examples
/// ```
/// use oxc_allocator::Allocator;
/// let allocator = Allocator::default();
Expand All @@ -145,8 +145,7 @@ impl Allocator {
/// If this arena has allocated multiple chunks to bump allocate into, then the excess chunks
/// are returned to the global allocator.
///
/// ## Example
///
/// # Examples
/// ```
/// use oxc_allocator::Allocator;
///
Expand Down
7 changes: 1 addition & 6 deletions crates/oxc_allocator/src/string.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ impl<'alloc> String<'alloc> {
/// Construct a new [`String`] from a string slice.
///
/// # Examples
///
/// ```
/// use oxc_allocator::{Allocator, String};
///
Expand Down Expand Up @@ -126,9 +125,6 @@ impl<'alloc> String<'alloc> {
/// nothing else uses the pointer after calling this function.
///
/// # Examples
///
/// Basic usage:
///
/// ```
/// use std::mem;
/// use oxc_allocator::{Allocator, String};
Expand Down Expand Up @@ -163,8 +159,7 @@ impl<'alloc> String<'alloc> {
/// Convert this `String<'alloc>` into an `&'alloc str`. This is analogous to
/// [`std::string::String::into_boxed_str`].
///
/// # Example
///
/// # Examples
/// ```
/// use oxc_allocator::{Allocator, String};
///
Expand Down
6 changes: 1 addition & 5 deletions crates/oxc_allocator/src/vec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ use crate::{Allocator, Box};

/// A `Vec` without [`Drop`], which stores its data in the arena allocator.
///
/// ## No `Drop`s
/// # No `Drop`s
///
/// Objects allocated into Oxc memory arenas are never [`Dropped`](Drop). Memory is released in bulk
/// when the allocator is dropped, without dropping the individual objects in the arena.
Expand All @@ -48,7 +48,6 @@ impl<'alloc, T> Vec<'alloc, T> {
/// The vector will not allocate until elements are pushed onto it.
///
/// # Examples
///
/// ```
/// use oxc_allocator::{Allocator, Vec};
///
Expand Down Expand Up @@ -84,7 +83,6 @@ impl<'alloc, T> Vec<'alloc, T> {
/// Panics if the new capacity exceeds `isize::MAX` bytes.
///
/// # Examples
///
/// ```
/// use oxc_allocator::{Allocator, Vec};
///
Expand Down Expand Up @@ -147,7 +145,6 @@ impl<'alloc, T> Vec<'alloc, T> {
/// on stack and then copying to arena.
///
/// # Examples
///
/// ```
/// use oxc_allocator::{Allocator, Vec};
///
Expand Down Expand Up @@ -178,7 +175,6 @@ impl<'alloc, T> Vec<'alloc, T> {
/// The excess memory will be leaked in the arena (i.e. not reused by another allocation).
///
/// # Examples
///
/// ```
/// use oxc_allocator::{Allocator, Vec};
///
Expand Down

0 comments on commit e544783

Please sign in to comment.