From 1941ab95643ccc9194fb5b8ec070a3354031c48a Mon Sep 17 00:00:00 2001 From: julio4 <30329843+julio4@users.noreply.github.com> Date: Tue, 14 Jan 2025 11:08:24 +0100 Subject: [PATCH] update doc --- corelib/src/iter/traits/iterator.cairo | 36 +------------------------- 1 file changed, 1 insertion(+), 35 deletions(-) diff --git a/corelib/src/iter/traits/iterator.cairo b/corelib/src/iter/traits/iterator.cairo index 104cbf6a0c5..64338ebbc96 100644 --- a/corelib/src/iter/traits/iterator.cairo +++ b/corelib/src/iter/traits/iterator.cairo @@ -116,7 +116,7 @@ pub trait Iterator { /// let a1 = array![1, 2, 3]; /// let a2 = array![4, 5, 6]; /// - /// let mut iter = a1.into_iter().zip(a2.into_iter()); + /// let mut iter = array![1, 2, 3].into_iter().zip(array![4, 5, 6].into_iter()); /// /// assert_eq!(iter.next(), Option::Some((1, 4))); /// assert_eq!(iter.next(), Option::Some((2, 5))); @@ -124,42 +124,8 @@ pub trait Iterator { /// assert_eq!(iter.next(), Option::None); /// ``` /// - /// Since the argument to `zip()` uses [`IntoIterator`], we can pass - /// anything that can be converted into an [`Iterator`], not just an - /// [`Iterator`] itself. For example: - /// - /// ``` - /// let a1 = array![1, 2, 3]; - /// let a2 = array![4, 5, 6]; - /// - /// let mut iter = a1.into_iter().zip(a2); - /// - /// assert_eq!(iter.next(), Option::Some((1, 4))); - /// assert_eq!(iter.next(), Option::Some((2, 5))); - /// assert_eq!(iter.next(), Option::Some((3, 6))); - /// assert_eq!(iter.next(), Option::None); - /// ``` - /// - /// If both iterators have roughly equivalent syntax, it may be more readable to use [`zip`]: - /// - /// ``` - /// use core::iter::zip; - /// - /// let a = array![1, 2, 3]; - /// let b = array![2, 3, 4]; - /// - /// let mut zipped = zip(a, b); - /// - /// assert_eq!(iter.next(), Option::Some((1, 4))); - /// assert_eq!(iter.next(), Option::Some((2, 5))); - /// assert_eq!(iter.next(), Option::Some((3, 6))); - /// assert_eq!(iter.next(), Option::None); - /// ); - /// ``` - /// /// [`enumerate`]: Iterator::enumerate /// [`next`]: Iterator::next - /// [`zip`]: core::iter::zip #[inline] fn zip //, +IntoIterator >(