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

@rust-highfive rust-highfive commented Nov 19, 2016

r? @aturon

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

@bluss
Copy link
Member

@bluss bluss commented Nov 19, 2016

@bors r+ rollup

Thank you!

@bors
Copy link
Contributor

@bors bors commented Nov 19, 2016

📌 Commit de2f617 has been approved by bluss

@bluss
Copy link
Member

@bluss 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 ollie27 commented Nov 20, 2016

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

@bluss
Copy link
Member

@bluss bluss commented Nov 20, 2016

@bors r+ rollup

@bors
Copy link
Contributor

@bors bors commented Nov 20, 2016

📌 Commit 9e86e18 has been approved by bluss

GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this issue 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 issue 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
1 check passed
@ollie27 ollie27 deleted the chars_last branch Nov 20, 2016
@brson brson added the relnotes label Nov 22, 2016
@durka
Copy link
Contributor

@durka durka commented Nov 25, 2016

Shouldn't this apply to any DoubleEndedIterator?

@ollie27
Copy link
Member Author

@ollie27 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 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
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

7 participants