diff options
| author | bors <bors@rust-lang.org> | 2017-02-26 20:36:10 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2017-02-26 20:36:10 +0000 |
| commit | 60a0edc6c223a19d5288c90b0e7fbc85d6701ddc (patch) | |
| tree | 402c8f3d69b9df5458d2cdcd150e58fc255212da | |
| parent | 44e9e0a6cf2188c404b9420d49de05fa29f3ea19 (diff) | |
| parent | 4be5783748b1c84ca11a22c2a9a0d1cdab10a8e7 (diff) | |
| download | rust-60a0edc6c223a19d5288c90b0e7fbc85d6701ddc.tar.gz rust-60a0edc6c223a19d5288c90b0e7fbc85d6701ddc.zip | |
Auto merge of #39738 - keeperofdakeys:vec-docs, r=GuillaumeGomez
Add notes about capacity effects to Vec::truncate() Add notes about the effects of Vec::truncate() and Vec::clear() on the capacity of a vector.
| -rw-r--r-- | src/libcollections/string.rs | 3 | ||||
| -rw-r--r-- | src/libcollections/vec.rs | 6 |
2 files changed, 9 insertions, 0 deletions
diff --git a/src/libcollections/string.rs b/src/libcollections/string.rs index 10bc5ab88c9..6839b698a56 100644 --- a/src/libcollections/string.rs +++ b/src/libcollections/string.rs @@ -999,6 +999,9 @@ impl String { /// If `new_len` is greater than the string's current length, this has no /// effect. /// + /// Note that this method has no effect on the allocated capacity + /// of the string + /// /// # Panics /// /// Panics if `new_len` does not lie on a [`char`] boundary. diff --git a/src/libcollections/vec.rs b/src/libcollections/vec.rs index bc7f562452d..3134e3c2ce1 100644 --- a/src/libcollections/vec.rs +++ b/src/libcollections/vec.rs @@ -548,6 +548,9 @@ impl<T> Vec<T> { /// The [`drain`] method can emulate `truncate`, but causes the excess /// elements to be returned instead of dropped. /// + /// Note that this method has no effect on the allocated capacity + /// of the vector. + /// /// # Examples /// /// Truncating a five element vector to two elements: @@ -1092,6 +1095,9 @@ impl<T> Vec<T> { /// Clears the vector, removing all values. /// + /// Note that this method has no effect on the allocated capacity + /// of the vector. + /// /// # Examples /// /// ``` |
