Skip to content

Commit

Permalink
Clarify the flatten specialization comment
Browse files Browse the repository at this point in the history
  • Loading branch information
cuviper committed Feb 17, 2024
1 parent 974bc45 commit c36ae93
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions library/core/src/iter/adapters/flatten.rs
Original file line number Diff line number Diff line change
Expand Up @@ -917,10 +917,10 @@ where
}
}

// Specialization: For iterators that never return more than one item, the `frontiter` and
// Specialization: When the inner iterator `U` never returns more than one item, the `frontiter` and
// `backiter` states are a waste, because they'll always have already consumed their item. So in
// this impl, we completely ignore them and just focus on `self.iter`, and we only call the inner
// `next()` one time.
// `U::next()` one time.
//
// It's mostly fine if we accidentally mix this with the more generic impls, e.g. by forgetting to
// specialize one of the methods. If the other impl did set the front or back, we wouldn't see it
Expand Down

0 comments on commit c36ae93

Please sign in to comment.