Skip to content

Fix Iterator::fuse example #17557

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

Merged
merged 1 commit into from
Sep 29, 2014
Merged

Fix Iterator::fuse example #17557

merged 1 commit into from
Sep 29, 2014

Conversation

sfackler
Copy link
Member

The for loop would always exaust the iterator previously, which seems
like behavior that was not intended. It's still kind of a weird
function.

The for loop would *always* exaust the iterator previously, which seems
like behavior that was not intended. It's still kind of a weird
function.
@bluss
Copy link
Member

bluss commented Sep 26, 2014

You're changing the behavior of the function. Instead of summing all ints <= 5, it now sums until the first x > 5. It's just an example so it doesn't matter though..

@sfackler
Copy link
Member Author

@bluss the point is that the old version had no reason to use fuse at all. The iterator will always be exhausted at the end of iteration so the addition of 1000 might as well be made unconditional.

@bluss
Copy link
Member

bluss commented Sep 26, 2014

Oh, I'm a bit slow. I understand now.

alexcrichton added a commit to alexcrichton/rust that referenced this pull request Sep 29, 2014
@bors bors merged commit a4844a6 into rust-lang:master Sep 29, 2014
@sfackler sfackler deleted the fuse-example branch November 26, 2016 05:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants