diff --git a/src/liballoc/collections/vec_deque.rs b/src/liballoc/collections/vec_deque.rs index 05225e5a25b29..d65c24f7350ae 100644 --- a/src/liballoc/collections/vec_deque.rs +++ b/src/liballoc/collections/vec_deque.rs @@ -369,7 +369,7 @@ impl VecDeque { VecDeque::with_capacity(INITIAL_CAPACITY) } - /// Creates an empty `VecDeque` with space for at least `n` elements. + /// Creates an empty `VecDeque` with space for at least `capacity` elements. /// /// # Examples /// @@ -379,10 +379,10 @@ impl VecDeque { /// let vector: VecDeque = VecDeque::with_capacity(10); /// ``` #[stable(feature = "rust1", since = "1.0.0")] - pub fn with_capacity(n: usize) -> VecDeque { + pub fn with_capacity(capacity: usize) -> VecDeque { // +1 since the ringbuffer always leaves one space empty - let cap = cmp::max(n + 1, MINIMUM_CAPACITY + 1).next_power_of_two(); - assert!(cap > n, "capacity overflow"); + let cap = cmp::max(capacity + 1, MINIMUM_CAPACITY + 1).next_power_of_two(); + assert!(cap > capacity, "capacity overflow"); VecDeque { tail: 0, diff --git a/src/librustc_data_structures/bit_set.rs b/src/librustc_data_structures/bit_set.rs index ff7964646d608..ec7ff3bd81397 100644 --- a/src/librustc_data_structures/bit_set.rs +++ b/src/librustc_data_structures/bit_set.rs @@ -607,8 +607,8 @@ impl GrowableBitSet { GrowableBitSet { bit_set: BitSet::new_empty(0) } } - pub fn with_capacity(bits: usize) -> GrowableBitSet { - GrowableBitSet { bit_set: BitSet::new_empty(bits) } + pub fn with_capacity(capacity: usize) -> GrowableBitSet { + GrowableBitSet { bit_set: BitSet::new_empty(capacity) } } /// Returns `true` if the set has changed. diff --git a/src/libstd/io/buffered.rs b/src/libstd/io/buffered.rs index bf406bb9b0ba7..e6c8e26fa92d8 100644 --- a/src/libstd/io/buffered.rs +++ b/src/libstd/io/buffered.rs @@ -92,10 +92,10 @@ impl BufReader { /// } /// ``` #[stable(feature = "rust1", since = "1.0.0")] - pub fn with_capacity(cap: usize, inner: R) -> BufReader { + pub fn with_capacity(capacity: usize, inner: R) -> BufReader { unsafe { - let mut buffer = Vec::with_capacity(cap); - buffer.set_len(cap); + let mut buffer = Vec::with_capacity(capacity); + buffer.set_len(capacity); inner.initializer().initialize(&mut buffer); BufReader { inner, @@ -477,10 +477,10 @@ impl BufWriter { /// let mut buffer = BufWriter::with_capacity(100, stream); /// ``` #[stable(feature = "rust1", since = "1.0.0")] - pub fn with_capacity(cap: usize, inner: W) -> BufWriter { + pub fn with_capacity(capacity: usize, inner: W) -> BufWriter { BufWriter { inner: Some(inner), - buf: Vec::with_capacity(cap), + buf: Vec::with_capacity(capacity), panicked: false, } } @@ -851,9 +851,9 @@ impl LineWriter { /// } /// ``` #[stable(feature = "rust1", since = "1.0.0")] - pub fn with_capacity(cap: usize, inner: W) -> LineWriter { + pub fn with_capacity(capacity: usize, inner: W) -> LineWriter { LineWriter { - inner: BufWriter::with_capacity(cap, inner), + inner: BufWriter::with_capacity(capacity, inner), need_flush: false, } } diff --git a/src/libstd/sys_common/wtf8.rs b/src/libstd/sys_common/wtf8.rs index f17020de44ec5..81e606fc16583 100644 --- a/src/libstd/sys_common/wtf8.rs +++ b/src/libstd/sys_common/wtf8.rs @@ -146,10 +146,10 @@ impl Wtf8Buf { Wtf8Buf { bytes: Vec::new() } } - /// Creates a new, empty WTF-8 string with pre-allocated capacity for `n` bytes. + /// Creates a new, empty WTF-8 string with pre-allocated capacity for `capacity` bytes. #[inline] - pub fn with_capacity(n: usize) -> Wtf8Buf { - Wtf8Buf { bytes: Vec::with_capacity(n) } + pub fn with_capacity(capacity: usize) -> Wtf8Buf { + Wtf8Buf { bytes: Vec::with_capacity(capacity) } } /// Creates a WTF-8 string from a UTF-8 `String`.