Skip to content

Commit cfae31d

Browse files
committed
docs(allocator): use allocator as var name in examples (#15781)
Make the vars names in examples for `Vec` methods consistent.
1 parent e9c943f commit cfae31d

File tree

1 file changed

+7
-7
lines changed
  • crates/oxc_allocator/src

1 file changed

+7
-7
lines changed

crates/oxc_allocator/src/vec.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,9 @@ impl<'alloc, T> Vec<'alloc, T> {
7070
/// ```
7171
/// use oxc_allocator::{Allocator, Vec};
7272
///
73-
/// let arena = Allocator::default();
73+
/// let allocator = Allocator::default();
7474
///
75-
/// let mut vec: Vec<i32> = Vec::new_in(&arena);
75+
/// let mut vec: Vec<i32> = Vec::new_in(&allocator);
7676
/// assert!(vec.is_empty());
7777
/// ```
7878
#[inline(always)]
@@ -103,9 +103,9 @@ impl<'alloc, T> Vec<'alloc, T> {
103103
/// ```
104104
/// use oxc_allocator::{Allocator, Vec};
105105
///
106-
/// let arena = Allocator::default();
106+
/// let allocator = Allocator::default();
107107
///
108-
/// let mut vec = Vec::with_capacity_in(10, &arena);
108+
/// let mut vec = Vec::with_capacity_in(10, &allocator);
109109
///
110110
/// // The vector contains no items, even though it has capacity for more
111111
/// assert_eq!(vec.len(), 0);
@@ -125,7 +125,7 @@ impl<'alloc, T> Vec<'alloc, T> {
125125
///
126126
/// // A vector of a zero-sized type will always over-allocate, since no
127127
/// // allocation is necessary
128-
/// let vec_units = Vec::<()>::with_capacity_in(10, &arena);
128+
/// let vec_units = Vec::<()>::with_capacity_in(10, &allocator);
129129
/// assert_eq!(vec_units.capacity(), usize::MAX);
130130
/// ```
131131
#[inline(always)]
@@ -203,9 +203,9 @@ impl<'alloc, T> Vec<'alloc, T> {
203203
/// ```
204204
/// use oxc_allocator::{Allocator, Vec};
205205
///
206-
/// let arena = Allocator::default();
206+
/// let allocator = Allocator::default();
207207
///
208-
/// let mut vec = Vec::from_iter_in([1, 2, 3], &arena);
208+
/// let mut vec = Vec::from_iter_in([1, 2, 3], &allocator);
209209
/// let slice = vec.into_bump_slice();
210210
/// assert_eq!(slice, [1, 2, 3]);
211211
/// ```

0 commit comments

Comments
 (0)