]> git.lizzy.rs Git - rust.git/commitdiff
doc: `Iterator::partition` use partial type hints
authorGentoli <gentoli@live.com>
Mon, 3 Jan 2022 11:25:42 +0000 (06:25 -0500)
committerGentoli <gentoli@live.com>
Sun, 6 Mar 2022 00:40:40 +0000 (19:40 -0500)
library/core/src/iter/traits/iterator.rs

index 5a361edecd9c00298e95a3d91446d73a241a8f4d..f5c0a3b5cd849b0b3c71bf2652bb3aec3be9733d 100644 (file)
@@ -1877,9 +1877,9 @@ fn try_collect<B>(&mut self) -> ChangeOutputType<Self::Item, B>
     /// ```
     /// let a = [1, 2, 3];
     ///
-    /// let (even, odd): (Vec<i32>, Vec<i32>) = a
-    ///     .iter()
-    ///     .partition(|&n| n % 2 == 0);
+    /// let (even, odd): (Vec<_>, Vec<_>) = a
+    ///     .into_iter()
+    ///     .partition(|n| n % 2 == 0);
     ///
     /// assert_eq!(even, vec![2]);
     /// assert_eq!(odd, vec![1, 3]);