Skip to content

Commit 4a53456

Browse files
author
Ulrik Sverdrup
committed
collections: Avoid unstable code in examples for Vec
1 parent 4e4374b commit 4a53456

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

src/libcollections/vec.rs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,6 @@ static MAX_MEMORY_SIZE: usize = isize::MAX as usize;
9191
/// # Examples
9292
///
9393
/// ```
94-
/// # #![feature(collections)]
9594
/// let mut vec = Vec::new();
9695
/// vec.push(1);
9796
/// vec.push(2);
@@ -105,9 +104,9 @@ static MAX_MEMORY_SIZE: usize = isize::MAX as usize;
105104
/// vec[0] = 7;
106105
/// assert_eq!(vec[0], 7);
107106
///
108-
/// vec.push_all(&[1, 2, 3]);
107+
/// vec.extend([1, 2, 3].iter().cloned());
109108
///
110-
/// for x in vec.iter() {
109+
/// for x in &vec {
111110
/// println!("{}", x);
112111
/// }
113112
/// assert_eq!(vec, [7, 1, 2, 3]);
@@ -369,9 +368,8 @@ impl<T> Vec<T> {
369368
/// # Examples
370369
///
371370
/// ```
372-
/// # #![feature(collections)]
373371
/// let mut vec = Vec::with_capacity(10);
374-
/// vec.push_all(&[1, 2, 3]);
372+
/// vec.extend([1, 2, 3].iter().cloned());
375373
/// assert_eq!(vec.capacity(), 10);
376374
/// vec.shrink_to_fit();
377375
/// assert!(vec.capacity() >= 3);
@@ -425,7 +423,6 @@ impl<T> Vec<T> {
425423
/// # Examples
426424
///
427425
/// ```
428-
/// # #![feature(collections)]
429426
/// let mut vec = vec![1, 2, 3, 4];
430427
/// vec.truncate(2);
431428
/// assert_eq!(vec, [1, 2]);
@@ -555,7 +552,6 @@ impl<T> Vec<T> {
555552
/// # Examples
556553
///
557554
/// ```
558-
/// # #![feature(collections)]
559555
/// let mut v = vec![1, 2, 3];
560556
/// assert_eq!(v.remove(1), 2);
561557
/// assert_eq!(v, [1, 3]);
@@ -743,7 +739,7 @@ impl<T> Vec<T> {
743739
/// # Examples
744740
///
745741
/// ```
746-
/// # #![feature(collections_drain, collections_range)]
742+
/// # #![feature(collections_drain)]
747743
///
748744
/// // Draining using `..` clears the whole vector.
749745
/// let mut v = vec![1, 2, 3];

0 commit comments

Comments
 (0)