about summary refs log tree commit diff
path: root/src/liballoc/vec.rs
diff options
context:
space:
mode:
authorNicholas Nethercote <nnethercote@mozilla.com>2020-05-20 20:45:05 +1000
committerNicholas Nethercote <nnethercote@mozilla.com>2020-06-09 07:55:35 +1000
commitc9cbe7e7eb37ec06a9c76a6b9ca4d342ff5a1128 (patch)
tree2ddc496c603292895b104ebdfc8f62895491e8f9 /src/liballoc/vec.rs
parentcb8bc8e05dbb96069d6c66145ac2f37cb16a618d (diff)
downloadrust-c9cbe7e7eb37ec06a9c76a6b9ca4d342ff5a1128.tar.gz
rust-c9cbe7e7eb37ec06a9c76a6b9ca4d342ff5a1128.zip
Rename some identifiers in `RawVec` and `libarena`.
- Use `len` more consistently for the number of elements in a vector,
  because that's the usual name.
- Use `additional` more consistently for the number of elements we want
  to add, because that's what `Vec::reserve()` uses.
- Use `cap` consistently rather than `capacity`.
- Plus a few other tweaks.

This increases consistency and conciseness.
Diffstat (limited to 'src/liballoc/vec.rs')
-rw-r--r--src/liballoc/vec.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/liballoc/vec.rs b/src/liballoc/vec.rs
index af943ecfd48..2226737757b 100644
--- a/src/liballoc/vec.rs
+++ b/src/liballoc/vec.rs
@@ -2977,12 +2977,12 @@ impl<T> Drain<'_, T> {
     }
 
     /// Makes room for inserting more elements before the tail.
-    unsafe fn move_tail(&mut self, extra_capacity: usize) {
+    unsafe fn move_tail(&mut self, additional: usize) {
         let vec = self.vec.as_mut();
-        let used_capacity = self.tail_start + self.tail_len;
-        vec.buf.reserve(used_capacity, extra_capacity);
+        let len = self.tail_start + self.tail_len;
+        vec.buf.reserve(len, additional);
 
-        let new_tail_start = self.tail_start + extra_capacity;
+        let new_tail_start = self.tail_start + additional;
         let src = vec.as_ptr().add(self.tail_start);
         let dst = vec.as_mut_ptr().add(new_tail_start);
         ptr::copy(src, dst, self.tail_len);