summary refs log tree commit diff
path: root/library/alloc/src/vec
diff options
context:
space:
mode:
authorYuki Okushi <jtitor@2k36.org>2021-06-06 19:11:19 +0900
committerGitHub <noreply@github.com>2021-06-06 19:11:19 +0900
commitf923f73b9aa80e94565d333f9d1ee6e3c60e83d2 (patch)
tree34a86495b5b488fc92903e6bb487fe1246b3e5e0 /library/alloc/src/vec
parent679a1d1ac1918e1a44ca71bbb352aeffe5380402 (diff)
parent507d97b26efc002129e5ba084f4361d7fde636ff (diff)
downloadrust-f923f73b9aa80e94565d333f9d1ee6e3c60e83d2.tar.gz
rust-f923f73b9aa80e94565d333f9d1ee6e3c60e83d2.zip
Rollup merge of #85930 - mominul:array_into_iter, r=m-ou-se
Update standard library for IntoIterator implementation of arrays

This PR partially resolves issue #84513 of updating the standard library part.

I haven't found any remaining doctest examples which are using iterators over e.g. &i32 instead of just i32 in the standard library. Can anyone point me to them if there's remaining any?

Thanks!

r? ```@m-ou-se```
Diffstat (limited to 'library/alloc/src/vec')
-rw-r--r--library/alloc/src/vec/mod.rs8
-rw-r--r--library/alloc/src/vec/splice.rs2
2 files changed, 5 insertions, 5 deletions
diff --git a/library/alloc/src/vec/mod.rs b/library/alloc/src/vec/mod.rs
index 105c60e7bf0..4a1d564e2ab 100644
--- a/library/alloc/src/vec/mod.rs
+++ b/library/alloc/src/vec/mod.rs
@@ -921,7 +921,7 @@ impl<T, A: Allocator> Vec<T, A> {
     ///
     /// ```
     /// let mut vec = Vec::with_capacity(10);
-    /// vec.extend([1, 2, 3].iter().cloned());
+    /// vec.extend([1, 2, 3]);
     /// assert_eq!(vec.capacity(), 10);
     /// vec.shrink_to_fit();
     /// assert!(vec.capacity() >= 3);
@@ -950,7 +950,7 @@ impl<T, A: Allocator> Vec<T, A> {
     /// ```
     /// #![feature(shrink_to)]
     /// let mut vec = Vec::with_capacity(10);
-    /// vec.extend([1, 2, 3].iter().cloned());
+    /// vec.extend([1, 2, 3]);
     /// assert_eq!(vec.capacity(), 10);
     /// vec.shrink_to(4);
     /// assert!(vec.capacity() >= 4);
@@ -984,7 +984,7 @@ impl<T, A: Allocator> Vec<T, A> {
     ///
     /// ```
     /// let mut vec = Vec::with_capacity(10);
-    /// vec.extend([1, 2, 3].iter().cloned());
+    /// vec.extend([1, 2, 3]);
     ///
     /// assert_eq!(vec.capacity(), 10);
     /// let slice = vec.into_boxed_slice();
@@ -2586,7 +2586,7 @@ impl<T, A: Allocator> Vec<T, A> {
     /// ```
     /// let mut v = vec![1, 2, 3];
     /// let new = [7, 8];
-    /// let u: Vec<_> = v.splice(..2, new.iter().cloned()).collect();
+    /// let u: Vec<_> = v.splice(..2, new).collect();
     /// assert_eq!(v, &[7, 8, 3]);
     /// assert_eq!(u, &[1, 2]);
     /// ```
diff --git a/library/alloc/src/vec/splice.rs b/library/alloc/src/vec/splice.rs
index 0a27b5b62ec..bad765c7f51 100644
--- a/library/alloc/src/vec/splice.rs
+++ b/library/alloc/src/vec/splice.rs
@@ -14,7 +14,7 @@ use super::{Drain, Vec};
 /// ```
 /// let mut v = vec![0, 1, 2];
 /// let new = [7, 8];
-/// let iter: std::vec::Splice<_> = v.splice(1.., new.iter().cloned());
+/// let iter: std::vec::Splice<_> = v.splice(1.., new);
 /// ```
 #[derive(Debug)]
 #[stable(feature = "vec_splice", since = "1.21.0")]