about summary refs log tree commit diff
path: root/library/alloc/src/vec/mod.rs
diff options
context:
space:
mode:
authorManish Goregaokar <manishsmail@gmail.com>2021-10-03 23:13:22 -0700
committerGitHub <noreply@github.com>2021-10-03 23:13:22 -0700
commitd236c04bbfe23580d99134381f01045129acfd62 (patch)
tree3b0ec68fe688cee371a7ade4e2325478a8fe4a1a /library/alloc/src/vec/mod.rs
parentc167eeedf416061eb5875b22c5038b5ae818da7c (diff)
parente8e7f6e05cf664fe748caf0198983f72248489b4 (diff)
downloadrust-d236c04bbfe23580d99134381f01045129acfd62.tar.gz
rust-d236c04bbfe23580d99134381f01045129acfd62.zip
Rollup merge of #89401 - owengage:master, r=joshtriplett
Add truncate note to Vec::resize

A very minor addition to the `Vec::resize` documentation to point out the `truncate` method.
When I was searching for something matching `truncate` I managed to miss it, along with some colleagues. We later found it by chance. We did find `resize` however, so I was hoping to point it out in the documentation.
Diffstat (limited to 'library/alloc/src/vec/mod.rs')
-rw-r--r--library/alloc/src/vec/mod.rs1
1 files changed, 1 insertions, 0 deletions
diff --git a/library/alloc/src/vec/mod.rs b/library/alloc/src/vec/mod.rs
index ec7490328b2..320347e58e1 100644
--- a/library/alloc/src/vec/mod.rs
+++ b/library/alloc/src/vec/mod.rs
@@ -2137,6 +2137,7 @@ impl<T: Clone, A: Allocator> Vec<T, A> {
     /// in order to be able to clone the passed value.
     /// If you need more flexibility (or want to rely on [`Default`] instead of
     /// [`Clone`]), use [`Vec::resize_with`].
+    /// If you only need to resize to a smaller size, use [`Vec::truncate`].
     ///
     /// # Examples
     ///