This commit is contained in:
dylan_DPC 2020-03-26 23:18:37 +01:00
parent 9b429fd121
commit a9a2a319af

View File

@ -2015,6 +2015,9 @@ fn ok<B, T>(mut f: impl FnMut(B, T) -> B) -> impl FnMut(B, T) -> Result<B, !> {
/// Find the maximum value:
///
/// ```
/// #![feature(iterator_fold_self)]
/// use std::cmp::Ordering;
///
/// fn find_max<I>(iter: I) -> Option<I::Item>
/// where I: Iterator,
/// I::Item: Ord,
@ -2027,9 +2030,9 @@ fn ok<B, T>(mut f: impl FnMut(B, T) -> B) -> impl FnMut(B, T) -> Result<B, !> {
/// })
/// }
/// 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]