Add flatten() free function and fix flatten tests #266
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.
This restores our travis to working order by not using
.flatten()
directly, since it is now incompatible with Rust nightly.We introduce a free function
flatten
— similar to many otherIntoIterator
-enabled free functions we already have: https://docs.rs/itertools/0.7.6/itertools/#functionsThe benefit of
flatten
as a free function is that we can support it from Rust 1.12.0 (version req right now) and for all the forseeable future. In a future version of itertools, this free function will be "upgraded" to use the std.flatten()
iterator. The free function will remain while we will removeItertools::flatten
(unless std removes their version) in a future version.Users that have compatibility problems with
Itertools::flatten
and its clash withIterator::flatten
, they can either useuse itertools::Itertools; Itertools::flatten(
expression)
oruse itertools::flatten; flatten(
expression)
.