From a9a2a319afbeb7e2a54f343a9360bd9bc4863b4f Mon Sep 17 00:00:00 2001 From: dylan_DPC Date: Thu, 26 Mar 2020 23:18:37 +0100 Subject: [PATCH] fix docs --- src/libcore/iter/traits/iterator.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/libcore/iter/traits/iterator.rs b/src/libcore/iter/traits/iterator.rs index c066d535f24..853059f98a6 100644 --- a/src/libcore/iter/traits/iterator.rs +++ b/src/libcore/iter/traits/iterator.rs @@ -2015,6 +2015,9 @@ fn ok(mut f: impl FnMut(B, T) -> B) -> impl FnMut(B, T) -> Result { /// Find the maximum value: /// /// ``` + /// #![feature(iterator_fold_self)] + /// use std::cmp::Ordering; + /// /// fn find_max(iter: I) -> Option /// where I: Iterator, /// I::Item: Ord, @@ -2027,9 +2030,9 @@ fn ok(mut f: impl FnMut(B, T) -> B) -> impl FnMut(B, T) -> Result { /// }) /// } /// let a = [10, 20, 5, -23, 0]; - /// let b = []; + /// let b: [u32; 0] = []; /// - /// assert_eq!(find_max(a.iter()), Some(20)); + /// assert_eq!(find_max(a.iter()), Some(&20)); /// assert_eq!(find_max(b.iter()), None); /// ``` #[inline]