| Age | Commit message (Collapse) | Author | Lines |
|
Changed all the tests except test_range_step to use Iterator::step_by.
|
|
fix links to "module-level documentation"
see https://github.com/rust-lang/rust/issues/42267
|
|
|
|
This makes the size_hint from things like `take` more precise.
|
|
Override size_hint and propagate ExactSizeIterator for iter::StepBy
Generally useful, but also a prerequisite for moving a bunch of unit tests off `Range*::step_by`.
A small non-breaking subset of https://github.com/rust-lang/rust/pull/42110 (which I closed).
Includes two small documentation changes @ivandardi requested on that PR.
r? @alexcrichton
|
|
Rollup of 7 pull requests
- Successful merges: #42169, #42215, #42216, #42224, #42230, #42236, #42241
- Failed merges:
|
|
Give step_trait a distinct tracking issue from step_by
iterator_step_by has decoupled their futures, so the tracking issue should split.
Old issue: https://github.com/rust-lang/rust/issues/27741
New issue: https://github.com/rust-lang/rust/issues/42168
r? @alexcrichton (another follow-up to closed PR https://github.com/rust-lang/rust/pull/42110#issuecomment-303176049)
|
|
Remove `FusedIterator` implementation of `iter::Scan`
Fixes #41964.
This is a breaking change.
|
|
Make RangeInclusive just a two-field struct
Not being an enum improves ergonomics and consistency, especially since NonEmpty variant wasn't prevented from being empty. It can still be iterable without an extra "done" bit by making the range have !(start <= end), which is even possible without changing the Step trait.
Implements merged https://github.com/rust-lang/rfcs/pull/1980; tracking issue https://github.com/rust-lang/rust/issues/28237.
This is definitely a breaking change to anything consuming `RangeInclusive` directly (not as an Iterator) or constructing it without using the sugar. Is there some change that would make sense before this so compilation failures could be compatibly fixed ahead of time?
r? @aturon (as FCP proposer on the RFC)
|
|
iterator_step_by has decoupled their futures, so the tracking issue should split.
|
|
|
|
Generally useful, but also a prerequisite for moving a bunch of unit tests off Range::step_by.
|
|
Fixes https://github.com/rust-lang/rust/issues/42135
Found while fixing run-pass/range_inclusive test failure.
|
|
Not being an enum improves ergonomics, especially since NonEmpty could be Empty. It can still be iterable without an extra "done" bit by making the range have !(start <= end), which is even possible without changing the Step trait.
Implements RFC 1980
|
|
Correct some stability versions
These were found by running tidy on stable versions of rust and finding
features stabilised with the wrong version numbers.
|
|
These were found by running tidy on stable versions of rust and finding
features stabilised with the wrong version numbers.
|
|
Stabilize step_by by adding it to Iterator (issue #27741)
Inspired by itertools' `take()` method. See issue #27741
|
|
|
|
Fixes #41964.
This is a breaking change.
|
|
|
|
|
|
Step::replace_one should put a one, not a zero (Issue #41492)
Turns out all six of the replace_* impls were backwards.
|
|
Fixes #33269
|
|
Turns out all six of these impls are incorrect.
|
|
|
|
Extend the example a little bit to show behaviour better.
|
|
- Prefer simpler constructs instead of going through &mut I's Iterator
implementation.
|
|
|
|
Fix doc error for ExactSizeIterator
The code example in the trait documentation of ExactSizeIterator
has an incorrect implementation of the len method that does not return
the number of times the example iterator 'Counter' will iterate. This
may confuse readers of the docs as the example code will compile but
doesn't uphold the trait's contract.
This is easily fixed by modifying the implementation of len and changing
the assert statement to actually assert the correct behaviour. I also
slightly modified a code comment to better reflect what the method
returns.
|
|
The code example in the trait documentation of ExactSizeIterator
has an incorrect implementation of the len method that does not return
the number of times the example iterator 'Counter' will iterate. This
may confuse readers of the docs as the example code will compile but
doesn't uphold the trait's contract.
This is easily fixed by modifying the implementation of len and changing
the assert statement to actually assert the correct behaviour. I also
slightly modified a code comment to better reflect what the method
returns.
|
|
|
|
The unstable book, libstd, libcore, and liballoc all needed some
adjustment.
|
|
r=GuillaumeGomez
Remove function invokation parens from documentation links.
This was never established as a convention we should follow in the 'More
API Documentation Conventions' RFC:
https://github.com/rust-lang/rfcs/blob/master/text/1574-more-api-documentation-conventions.md
|
|
This was never established as a convention we should follow in the 'More
API Documentation Conventions' RFC:
https://github.com/rust-lang/rfcs/blob/master/text/1574-more-api-documentation-conventions.md
|
|
|
|
Explain that a None is returned if the iterator is empty.
|
|
|
|
|
|
|
|
The `Iterator.nth()` documentation says "Note that all preceding elements will be consumed". I assumed from that that the preceding elements would be the *only* ones that were consumed, but in fact the returned element is consumed as well.
The way I read the documentation, I assumed that `nth(0)` would not discard anything (as there are 0 preceding elements), so I added a sentence clarifying that it does. I also rephrased it to avoid the stunted "i.e." phrasing.
|
|
Fix a few impl stability attributes
The versions show up in rustdoc.
|
|
branchless .filter(_).count()
I found that the branchless version is only slower if we have little to no branch misses, which usually isn't the case. I notice speedups between -5% (perfect prediction) and 60% (real world data).
|
|
Add Iterator::rfind.
I found it weird that `Iterator` has `rpostition` but not `rfind`. This adds that method.
|
|
This commit updates the version number to 1.17.0 as we're not on that version of
the nightly compiler, and at the same time this updates src/stage0.txt to
bootstrap from freshly minted beta compiler and beta Cargo.
|
|
|
|
|
|
The versions show up in rustdoc.
|
|
|
|
|
|
|