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

Implement List's any function #12132

Closed
wants to merge 1 commit into from
Closed

Implement List's any function #12132

wants to merge 1 commit into from

Conversation

brunoabinader
Copy link
Contributor

This is needed for cases where we only need to know if a list item matches the given predicate (eg. in Servo, we need to know if attributes from different DOM elements are equal).

@alexcrichton
Copy link
Member

Here's some thoughts that I have on this:

  • This should probably have a test checked in
  • There may be a better name because I would expect matches_predicate to apply to the entire list
  • I would expect this to be done with iterators, but it appears that this module is ancient and doesn't even have iterators right now.

It sounds like this module needs to be rewritten completely, but I don't think that should be done as part of this PR. I'd be comfortable with merging if this had a test checked in.

@lilyball
Copy link
Contributor

lilyball commented Feb 9, 2014

I would suggest this function be renamed to .any().

@brunoabinader
Copy link
Contributor Author

Thanks for the review! I've updated the patch with the following:

  • Updated function name to any
  • Added a test

This is needed for cases where we only need to know if a list item
matches the given predicate (eg. in Servo, we need to know if attributes
from different DOM elements are equal).
@brunoabinader
Copy link
Contributor Author

Hi @alexcrichton, I've updated the patch again with a typo fix in the test that appeared in the last minute.

bors added a commit that referenced this pull request Feb 10, 2014
…lexcrichton

This is needed for cases where we only need to know if a list item matches the given predicate (eg. in Servo, we need to know if attributes from different DOM elements are equal).
@bors bors closed this Feb 10, 2014
flip1995 pushed a commit to flip1995/rust that referenced this pull request Jan 25, 2024
…dnet

I'm not on vacation (again)

A few weeks ago I opened rust-lang#12011 removing me from `users_on_vacation`, it got merged. The subtree sync reverted this change (weirdly)

changelog: none

r? `@xFrednet`
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