Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Related to #755
MapForGrouping
is only internally used byGroupingMapBy
and it only callsfor_each
on it (which in turn rely onfold
). So I allow the clippy lintmissing_trait_methods
because specialize other methods is simply useless. (In case we run clippy with warning it.)I could replace
next
body byunreachable!()
and it would still work fine.Anyway, it will disappear from test coverage now that we have one (see here).
I previously wandered how to test and benchmark this:
fold
specialization through someinto_grouping_map_by
benchmark but I simply don't think it's worth the time: no doubtadapted_iterator.map.fold
is faster than the defaultfold
callingnext
repeatedly. We just don't know how much faster.Note that all
GroupingMapBy
methods ultimately rely on thisfold
so this specialization will improve performance for all its methods.