Rename Iterator::fold_first to reduce.
This commit is contained in:
parent
e708cbd91c
commit
5c056ed2f5
2 changed files with 5 additions and 5 deletions
|
@ -358,7 +358,7 @@ impl GenericArgs<'_> {
|
||||||
.iter()
|
.iter()
|
||||||
.filter(|arg| !arg.is_synthetic())
|
.filter(|arg| !arg.is_synthetic())
|
||||||
.map(|arg| arg.span())
|
.map(|arg| arg.span())
|
||||||
.fold_first(|span1, span2| span1.to(span2))
|
.reduce(|span1, span2| span1.to(span2))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns span encompassing arguments and their surrounding `<>` or `()`
|
/// Returns span encompassing arguments and their surrounding `<>` or `()`
|
||||||
|
|
|
@ -2138,7 +2138,7 @@ pub trait Iterator {
|
||||||
/// where I: Iterator,
|
/// where I: Iterator,
|
||||||
/// I::Item: Ord,
|
/// I::Item: Ord,
|
||||||
/// {
|
/// {
|
||||||
/// iter.fold_first(|a, b| {
|
/// iter.reduce(|a, b| {
|
||||||
/// if a >= b { a } else { b }
|
/// if a >= b { a } else { b }
|
||||||
/// })
|
/// })
|
||||||
/// }
|
/// }
|
||||||
|
@ -2150,7 +2150,7 @@ pub trait Iterator {
|
||||||
/// ```
|
/// ```
|
||||||
#[inline]
|
#[inline]
|
||||||
#[unstable(feature = "iterator_fold_self", issue = "68125")]
|
#[unstable(feature = "iterator_fold_self", issue = "68125")]
|
||||||
fn fold_first<F>(mut self, f: F) -> Option<Self::Item>
|
fn reduce<F>(mut self, f: F) -> Option<Self::Item>
|
||||||
where
|
where
|
||||||
Self: Sized,
|
Self: Sized,
|
||||||
F: FnMut(Self::Item, Self::Item) -> Self::Item,
|
F: FnMut(Self::Item, Self::Item) -> Self::Item,
|
||||||
|
@ -2647,7 +2647,7 @@ pub trait Iterator {
|
||||||
move |x, y| cmp::max_by(x, y, &mut compare)
|
move |x, y| cmp::max_by(x, y, &mut compare)
|
||||||
}
|
}
|
||||||
|
|
||||||
self.fold_first(fold(compare))
|
self.reduce(fold(compare))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns the element that gives the minimum value from the
|
/// Returns the element that gives the minimum value from the
|
||||||
|
@ -2707,7 +2707,7 @@ pub trait Iterator {
|
||||||
move |x, y| cmp::min_by(x, y, &mut compare)
|
move |x, y| cmp::min_by(x, y, &mut compare)
|
||||||
}
|
}
|
||||||
|
|
||||||
self.fold_first(fold(compare))
|
self.reduce(fold(compare))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Reverses an iterator's direction.
|
/// Reverses an iterator's direction.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue