Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 11 additions & 10 deletions library/core/src/iter/traits/iterator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2080,8 +2080,7 @@ pub trait Iterator {
fn try_collect<B>(&mut self) -> ChangeOutputType<Self::Item, B>
where
Self: Sized,
<Self as Iterator>::Item: Try,
<<Self as Iterator>::Item as Try>::Residual: Residual<B>,
Self::Item: Try<Residual: Residual<B>>,
B: FromIterator<<Self::Item as Try>::Output>,
{
try_process(ByRefSized(self), |i| i.collect())
Expand Down Expand Up @@ -2689,12 +2688,13 @@ pub trait Iterator {
#[inline]
#[unstable(feature = "iterator_try_reduce", reason = "new API", issue = "87053")]
#[rustc_do_not_const_check]
fn try_reduce<F, R>(&mut self, f: F) -> ChangeOutputType<R, Option<R::Output>>
fn try_reduce<R>(
&mut self,
f: impl FnMut(Self::Item, Self::Item) -> R,
) -> ChangeOutputType<R, Option<R::Output>>
where
Self: Sized,
F: FnMut(Self::Item, Self::Item) -> R,
R: Try<Output = Self::Item>,
R::Residual: Residual<Option<Self::Item>>,
R: Try<Output = Self::Item, Residual: Residual<Option<Self::Item>>>,
{
let first = match self.next() {
Some(i) => i,
Expand Down Expand Up @@ -2956,12 +2956,13 @@ pub trait Iterator {
#[inline]
#[unstable(feature = "try_find", reason = "new API", issue = "63178")]
#[rustc_do_not_const_check]
fn try_find<F, R>(&mut self, f: F) -> ChangeOutputType<R, Option<Self::Item>>
fn try_find<R>(
&mut self,
f: impl FnMut(&Self::Item) -> R,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, I don't think we have any APIT in traits in library yet?

I do like this structure better, though, so let's do it in nightly and libs-api can always complain later if needed 🙃

) -> ChangeOutputType<R, Option<Self::Item>>
where
Self: Sized,
F: FnMut(&Self::Item) -> R,
R: Try<Output = bool>,
R::Residual: Residual<Option<Self::Item>>,
R: Try<Output = bool, Residual: Residual<Option<Self::Item>>>,
{
#[inline]
fn check<I, V, R>(
Expand Down