@@ -514,9 +514,12 @@ pub trait Iterator {
514514 /// assert_eq!((2, 'o'), enumerate[2]);
515515 /// assert_eq!((2, 'o'), zipper[2]);
516516 /// ```
517+ ///
517518 /// If both iterators have roughly equivalent syntax, it may me more readable to use [`zip`]:
519+ ///
518520 /// ```
519- /// # use std::iter::zip;
521+ /// use std::iter::zip;
522+ ///
520523 /// let a = [1, 2, 3];
521524 /// let b = [2, 3, 4];
522525 ///
@@ -529,20 +532,22 @@ pub trait Iterator {
529532 /// assert_eq!(zipped.next(), Some((6, 8)));
530533 /// assert_eq!(zipped.next(), None);
531534 /// ```
535+ ///
532536 /// compared to:
533- /// ```
534- /// let a = [1, 2, 3];
535- /// let b = [2, 3, 4];
536537 ///
538+ /// ```
539+ /// # let a = [1, 2, 3];
540+ /// # let b = [2, 3, 4];
541+ /// #
537542 /// let mut zipped = a
538543 /// .into_iter()
539544 /// .map(|x| x * 2)
540545 /// .skip(1)
541546 /// .zip(b.into_iter().map(|x| x * 2).skip(1));
542- ///
543- /// assert_eq!(zipped.next(), Some((4, 6)));
544- /// assert_eq!(zipped.next(), Some((6, 8)));
545- /// assert_eq!(zipped.next(), None);
547+ /// #
548+ /// # assert_eq!(zipped.next(), Some((4, 6)));
549+ /// # assert_eq!(zipped.next(), Some((6, 8)));
550+ /// # assert_eq!(zipped.next(), None);
546551 /// ```
547552 ///
548553 /// [`enumerate`]: Iterator::enumerate
0 commit comments