1
Fork 0

Rename .cap() methods to .capacity()

... but leave the old names in there for backwards compatibility.
This commit is contained in:
Matthias Geier 2019-04-27 21:28:40 +02:00
parent c751c7a4f4
commit 0967d28be7
6 changed files with 99 additions and 92 deletions

View file

@ -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
@ -878,7 +878,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);
}
@ -1019,7 +1019,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 {
@ -1750,7 +1750,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),