Skip to content

Inconsistency in IteratorExt::all and ::any #22617

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

Closed
Aatch opened this issue Feb 21, 2015 · 6 comments · Fixed by #22795
Closed

Inconsistency in IteratorExt::all and ::any #22617

Aatch opened this issue Feb 21, 2015 · 6 comments · Fixed by #22795
Labels
E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.
Milestone

Comments

@Aatch
Copy link
Contributor

Aatch commented Feb 21, 2015

One of the methods takes &mut self, the other takes self, which is strange, since they are almost exactly the same code.

I'm guessing that IteratorExt::all should take &mut self, like any does.

@huonw
Copy link
Member

huonw commented Feb 21, 2015

cc @aturon

@oli-obk
Copy link
Contributor

oli-obk commented Feb 23, 2015

isn't this because all consumes the iterator completely and any only up to the first occurrence?

@Aatch
Copy link
Contributor Author

Aatch commented Feb 24, 2015

@oli-obk both iterators behave the same way, all stops at the first false value, any stops at the first true value.

@aturon
Copy link
Member

aturon commented Feb 24, 2015

Thanks for the report, @Aatch. This was a mistake, and both should take &mut self precisely to clarify the consumption semantics.

This should be a trivial fix.

@aturon aturon added the E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. label Feb 24, 2015
@aturon
Copy link
Member

aturon commented Feb 24, 2015

(Should be flagged 1.0-beta P-backcompat-libs)

alexcrichton added a commit to alexcrichton/rust that referenced this issue Feb 25, 2015
Keeps the method consistent with `Iterator::any`.

Closes rust-lang#22617
[breaking-change]
steveklabnik added a commit to steveklabnik/rust that referenced this issue Feb 26, 2015
Keeps the method consistent with `Iterator::any`.

Closes rust-lang#22617
[breaking-change]
@pnkfelix
Copy link
Member

1.0 beta, P-backcompat-libs.

@pnkfelix pnkfelix added this to the 1.0 beta milestone Feb 26, 2015
Manishearth added a commit to Manishearth/rust that referenced this issue Feb 27, 2015
 Keeps the method consistent with `Iterator::any`.

Closes rust-lang#22617
[breaking-change]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants