Skip to content

Conversation

ollie27
Copy link
Contributor

@ollie27 ollie27 commented Nov 19, 2016

The default implementation of last() goes through the entire iterator
but that's not needed here.

The default implementation of last() goes through the entire iterator
but that's not needed here.
@rust-highfive
Copy link
Contributor

r? @aturon

(rust_highfive has picked a reviewer for you, use r? to override)

@bluss
Copy link
Contributor

bluss commented Nov 19, 2016

@bors r+ rollup

Thank you!

@bors
Copy link
Collaborator

bors commented Nov 19, 2016

📌 Commit de2f617 has been approved by bluss

@bluss
Copy link
Contributor

bluss commented Nov 19, 2016

By the way, this applies to char_indices as well. Another commit or another PR is welcome.

The default implementation of last() goes through the entire iterator
but that's not needed here.
@ollie27
Copy link
Contributor Author

ollie27 commented Nov 20, 2016

Good point. I've applied the same to CharIndices.

@bluss
Copy link
Contributor

bluss commented Nov 20, 2016

@bors r+ rollup

@bors
Copy link
Collaborator

bors commented Nov 20, 2016

📌 Commit 9e86e18 has been approved by bluss

GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this pull request Nov 20, 2016
Optimise Chars::last()

The default implementation of last() goes through the entire iterator
but that's not needed here.
bors added a commit that referenced this pull request Nov 20, 2016
Rollup of 8 pull requests

- Successful merges: #37835, #37840, #37841, #37848, #37876, #37880, #37881, #37882
- Failed merges:
@bors bors merged commit 9e86e18 into rust-lang:master Nov 20, 2016
@ollie27 ollie27 deleted the chars_last branch November 20, 2016 20:39
@brson brson added the relnotes Marks issues that should be documented in the release notes of the next release. label Nov 22, 2016
@durka
Copy link
Contributor

durka commented Nov 25, 2016

Shouldn't this apply to any DoubleEndedIterator?

@ollie27
Copy link
Contributor Author

ollie27 commented Nov 25, 2016

Yeah, but I think it might be breaking change to do this for iterators that might have side effects.

@bluss
Copy link
Contributor

bluss commented Nov 25, 2016

Yes. Iterator::last's doc is specific about how it goes about finding the last value (traversing it all).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
relnotes Marks issues that should be documented in the release notes of the next release.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants