Skip to content

Commit 87568a1

Browse files
committed
docs(allocator): reformat docs (#8615)
Make formatting of doc comments in `oxc_allocator` consistent.
1 parent d9f5e7f commit 87568a1

File tree

5 files changed

+9
-19
lines changed

5 files changed

+9
-19
lines changed

crates/oxc_allocator/src/boxed.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ use crate::Allocator;
1919

2020
/// A `Box` without [`Drop`], which stores its data in the arena allocator.
2121
///
22-
/// ## No `Drop`s
22+
/// # No `Drop`s
2323
///
2424
/// Objects allocated into Oxc memory arenas are never [`Dropped`](Drop). Memory is released in bulk
2525
/// when the allocator is dropped, without dropping the individual objects in the arena.
@@ -35,7 +35,7 @@ impl<T> Box<'_, T> {
3535
/// Take ownership of the value stored in this [`Box`], consuming the box in
3636
/// the process.
3737
///
38-
/// ## Example
38+
/// # Examples
3939
/// ```
4040
/// use oxc_allocator::{Allocator, Box};
4141
///
@@ -64,7 +64,7 @@ impl<T> Box<'_, T> {
6464
/// Put a `value` into a memory arena and get back a [`Box`] with ownership
6565
/// to the allocation.
6666
///
67-
/// ## Example
67+
/// # Examples
6868
/// ```
6969
/// use oxc_allocator::{Allocator, Box};
7070
///

crates/oxc_allocator/src/hash_map.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ type FxHashMap<'alloc, K, V> = hashbrown::HashMap<K, V, FxBuildHasher, &'alloc B
3636
/// All APIs are the same, except create a [`HashMap`] with
3737
/// either [`new_in`](HashMap::new_in) or [`with_capacity_in`](HashMap::with_capacity_in).
3838
///
39-
/// ## No `Drop`s
39+
/// # No `Drop`s
4040
///
4141
/// Objects allocated into Oxc memory arenas are never [`Dropped`](Drop). Memory is released in bulk
4242
/// when the allocator is dropped, without dropping the individual objects in the arena.

crates/oxc_allocator/src/lib.rs

+3-4
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ impl Allocator {
9494
/// # Panics
9595
/// Panics if reserving space for `T` fails.
9696
///
97-
/// # Example
97+
/// # Examples
9898
/// ```
9999
/// use oxc_allocator::Allocator;
100100
///
@@ -120,7 +120,7 @@ impl Allocator {
120120
/// # Panics
121121
/// Panics if reserving space for the string fails.
122122
///
123-
/// # Example
123+
/// # Examples
124124
/// ```
125125
/// use oxc_allocator::Allocator;
126126
/// let allocator = Allocator::default();
@@ -145,8 +145,7 @@ impl Allocator {
145145
/// If this arena has allocated multiple chunks to bump allocate into, then the excess chunks
146146
/// are returned to the global allocator.
147147
///
148-
/// ## Example
149-
///
148+
/// # Examples
150149
/// ```
151150
/// use oxc_allocator::Allocator;
152151
///

crates/oxc_allocator/src/string.rs

+1-6
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ impl<'alloc> String<'alloc> {
6363
/// Construct a new [`String`] from a string slice.
6464
///
6565
/// # Examples
66-
///
6766
/// ```
6867
/// use oxc_allocator::{Allocator, String};
6968
///
@@ -126,9 +125,6 @@ impl<'alloc> String<'alloc> {
126125
/// nothing else uses the pointer after calling this function.
127126
///
128127
/// # Examples
129-
///
130-
/// Basic usage:
131-
///
132128
/// ```
133129
/// use std::mem;
134130
/// use oxc_allocator::{Allocator, String};
@@ -163,8 +159,7 @@ impl<'alloc> String<'alloc> {
163159
/// Convert this `String<'alloc>` into an `&'alloc str`. This is analogous to
164160
/// [`std::string::String::into_boxed_str`].
165161
///
166-
/// # Example
167-
///
162+
/// # Examples
168163
/// ```
169164
/// use oxc_allocator::{Allocator, String};
170165
///

crates/oxc_allocator/src/vec.rs

+1-5
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ use crate::{Allocator, Box};
2424

2525
/// A `Vec` without [`Drop`], which stores its data in the arena allocator.
2626
///
27-
/// ## No `Drop`s
27+
/// # No `Drop`s
2828
///
2929
/// Objects allocated into Oxc memory arenas are never [`Dropped`](Drop). Memory is released in bulk
3030
/// when the allocator is dropped, without dropping the individual objects in the arena.
@@ -48,7 +48,6 @@ impl<'alloc, T> Vec<'alloc, T> {
4848
/// The vector will not allocate until elements are pushed onto it.
4949
///
5050
/// # Examples
51-
///
5251
/// ```
5352
/// use oxc_allocator::{Allocator, Vec};
5453
///
@@ -84,7 +83,6 @@ impl<'alloc, T> Vec<'alloc, T> {
8483
/// Panics if the new capacity exceeds `isize::MAX` bytes.
8584
///
8685
/// # Examples
87-
///
8886
/// ```
8987
/// use oxc_allocator::{Allocator, Vec};
9088
///
@@ -147,7 +145,6 @@ impl<'alloc, T> Vec<'alloc, T> {
147145
/// on stack and then copying to arena.
148146
///
149147
/// # Examples
150-
///
151148
/// ```
152149
/// use oxc_allocator::{Allocator, Vec};
153150
///
@@ -178,7 +175,6 @@ impl<'alloc, T> Vec<'alloc, T> {
178175
/// The excess memory will be leaked in the arena (i.e. not reused by another allocation).
179176
///
180177
/// # Examples
181-
///
182178
/// ```
183179
/// use oxc_allocator::{Allocator, Vec};
184180
///

0 commit comments

Comments
 (0)