about summary refs log tree commit diff
path: root/src/liballoc
diff options
context:
space:
mode:
authorMazdak Farrokhzad <twingoow@gmail.com>2019-10-28 21:36:06 +0100
committerGitHub <noreply@github.com>2019-10-28 21:36:06 +0100
commitcceefd3d98bc2d6e2e1912b63055d3c1b1647a97 (patch)
tree3de4264321adb64b0ffec095bd1eb7165ec82839 /src/liballoc
parent23dbdb46ee3557fbbe0514b3c574870ab92109b1 (diff)
parente2c450b8dacd6edce4bdc66db9da4ddfc81f4dc1 (diff)
downloadrust-cceefd3d98bc2d6e2e1912b63055d3c1b1647a97.tar.gz
rust-cceefd3d98bc2d6e2e1912b63055d3c1b1647a97.zip
Rollup merge of #65887 - lzutao:doc-vec-get, r=rkruppe
doc: mention `get(_mut)` in Vec
Diffstat (limited to 'src/liballoc')
-rw-r--r--src/liballoc/vec.rs6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/liballoc/vec.rs b/src/liballoc/vec.rs
index 5e733fa43d7..5b53a6a2899 100644
--- a/src/liballoc/vec.rs
+++ b/src/liballoc/vec.rs
@@ -154,8 +154,8 @@ use crate::raw_vec::RawVec;
 /// println!("{}", v[6]); // it will panic!
 /// ```
 ///
-/// In conclusion: always check if the index you want to get really exists
-/// before doing it.
+/// Use [`get`] and [`get_mut`] if you want to check whether the index is in
+/// the `Vec`.
 ///
 /// # Slicing
 ///
@@ -277,6 +277,8 @@ use crate::raw_vec::RawVec;
 /// The order has changed in the past and may change again.
 ///
 /// [`vec!`]: ../../std/macro.vec.html
+/// [`get`]: ../../std/vec/struct.Vec.html#method.get
+/// [`get_mut`]: ../../std/vec/struct.Vec.html#method.get_mut
 /// [`Index`]: ../../std/ops/trait.Index.html
 /// [`String`]: ../../std/string/struct.String.html
 /// [`&str`]: ../../std/primitive.str.html