Skip to content

Commit cceefd3

Browse files
authored
Rollup merge of #65887 - lzutao:doc-vec-get, r=rkruppe
doc: mention `get(_mut)` in Vec
2 parents 23dbdb4 + e2c450b commit cceefd3

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/liballoc/vec.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -154,8 +154,8 @@ use crate::raw_vec::RawVec;
154154
/// println!("{}", v[6]); // it will panic!
155155
/// ```
156156
///
157-
/// In conclusion: always check if the index you want to get really exists
158-
/// before doing it.
157+
/// Use [`get`] and [`get_mut`] if you want to check whether the index is in
158+
/// the `Vec`.
159159
///
160160
/// # Slicing
161161
///
@@ -277,6 +277,8 @@ use crate::raw_vec::RawVec;
277277
/// The order has changed in the past and may change again.
278278
///
279279
/// [`vec!`]: ../../std/macro.vec.html
280+
/// [`get`]: ../../std/vec/struct.Vec.html#method.get
281+
/// [`get_mut`]: ../../std/vec/struct.Vec.html#method.get_mut
280282
/// [`Index`]: ../../std/ops/trait.Index.html
281283
/// [`String`]: ../../std/string/struct.String.html
282284
/// [`&str`]: ../../std/primitive.str.html

0 commit comments

Comments
 (0)