Skip to content

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

Closed

Description

@Aatch

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.

Activity

  1. huonw commented on Feb 21, 2015

    @huonw
    Contributor
  2. oli-obk commented on Feb 23, 2015

    @oli-obk
    Contributor

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

  3. Aatch commented on Feb 24, 2015

    @Aatch
    ContributorAuthor

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

  4. aturon commented on Feb 24, 2015

    @aturon
    Contributor

    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.

  5. added
    E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.
    on Feb 24, 2015
  6. aturon commented on Feb 24, 2015

    @aturon
    Contributor

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

  7. pnkfelix commented on Feb 26, 2015

    @pnkfelix
    Contributor

    1.0 beta, P-backcompat-libs.

  8. added this to the 1.0 beta milestone on Feb 26, 2015
  9. added a commit that references this issue on Jun 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions