about summary refs log tree commit diff
path: root/src/liballoc/vec.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2019-07-25 18:45:42 +0000
committerbors <bors@rust-lang.org>2019-07-25 18:45:42 +0000
commit890881f8f4c77e8670d4b32104c0325fcfefc90f (patch)
tree234d6f9b06ed04e6759da3a876f0f0fa281a9b70 /src/liballoc/vec.rs
parenteedf6ce4ef54bb03818ab21d714f1b9f13a6b31c (diff)
parentabe3bdf257f50b583cd7dea91e33424f700fb0c2 (diff)
downloadrust-890881f8f4c77e8670d4b32104c0325fcfefc90f.tar.gz
rust-890881f8f4c77e8670d4b32104c0325fcfefc90f.zip
Auto merge of #60340 - mgeier:cap-vs-capacity, r=alexcrichton
Rename .cap() methods to .capacity()

As mentioned in #60316, there are a few `.cap()` methods, which seem out-of-place because such methods are called `.capacity()` in the rest of the code.

This PR renames them to `.capacity()` but leaves `RawVec::cap()` in there for backwards compatibility.

I didn't try to mark the old version as "deprecated", because I guess this would cause too much noise.
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 173946b312a..c076584cc38 100644
--- a/src/liballoc/vec.rs
+++ b/src/liballoc/vec.rs
@@ -432,7 +432,7 @@ impl<T> Vec<T> {
     #[inline]
     #[stable(feature = "rust1", since = "1.0.0")]
     pub fn capacity(&self) -> usize {
-        self.buf.cap()
+        self.buf.capacity()
     }
 
     /// Reserves capacity for at least `additional` more elements to be inserted
@@ -947,7 +947,7 @@ impl<T> Vec<T> {
         assert!(index <= len);
 
         // space for the new element
-        if len == self.buf.cap() {
+        if len == self.buf.capacity() {
             self.reserve(1);
         }
 
@@ -1098,7 +1098,7 @@ impl<T> Vec<T> {
     pub fn push(&mut self, value: T) {
         // This will panic or abort if we would allocate > isize::MAX bytes
         // or if the length increment would overflow for zero-sized types.
-        if self.len == self.buf.cap() {
+        if self.len == self.buf.capacity() {
             self.reserve(1);
         }
         unsafe {
@@ -1858,7 +1858,7 @@ impl<T> IntoIterator for Vec<T> {
             } else {
                 begin.add(self.len()) as *const T
             };
-            let cap = self.buf.cap();
+            let cap = self.buf.capacity();
             mem::forget(self);
             IntoIter {
                 buf: NonNull::new_unchecked(begin),