Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimise Chars::last() #37882

Merged
merged 2 commits into from
Nov 20, 2016
Merged

Optimise Chars::last() #37882

merged 2 commits into from
Nov 20, 2016

Conversation

ollie27
Copy link
Member

@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
Collaborator

r? @aturon

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

@bluss
Copy link
Member

bluss commented Nov 19, 2016

@bors r+ rollup

Thank you!

@bors
Copy link
Contributor

bors commented Nov 19, 2016

📌 Commit de2f617 has been approved by bluss

@bluss
Copy link
Member

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
Member Author

ollie27 commented Nov 20, 2016

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

@bluss
Copy link
Member

bluss commented Nov 20, 2016

@bors r+ rollup

@bors
Copy link
Contributor

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
Member 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
Member

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