mirror of
https://github.com/rust-lang/rust.git
synced 2026-04-27 18:57:42 +03:00
core: lift FIXME comment from option.rs to iter::try_process
This FIXME is relevant not only to Option but other similar cases that use iter::try_process(). The referenced issue 11084 was closed in 2021, and the related PR 59605 was not merged due to inconclusive results.
This commit is contained in:
@@ -155,6 +155,9 @@ pub(crate) fn try_process<I, T, R, F, U>(iter: I, mut f: F) -> ChangeOutputType<
|
||||
for<'a> F: FnMut(GenericShunt<'a, I, R>) -> U,
|
||||
R: Residual<U>,
|
||||
{
|
||||
// FIXME(#11084): we might be able to get rid of GenericShunt in favor of
|
||||
// Iterator::scan, as performance should be comparable
|
||||
|
||||
let mut residual = None;
|
||||
let shunt = GenericShunt { iter, residual: &mut residual };
|
||||
let value = f(shunt);
|
||||
|
||||
@@ -2758,9 +2758,6 @@ impl<A, V: FromIterator<A>> FromIterator<Option<A>> for Option<V> {
|
||||
/// so the final value of `shared` is 6 (= `3 + 2 + 1`), not 16.
|
||||
#[inline]
|
||||
fn from_iter<I: IntoIterator<Item = Option<A>>>(iter: I) -> Option<V> {
|
||||
// FIXME(#11084): This could be replaced with Iterator::scan when this
|
||||
// performance bug is closed.
|
||||
|
||||
iter::try_process(iter.into_iter(), |i| i.collect())
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user