Skip to content

is_expr_identity_of_pat: simplify using (unordered_)over #15450

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ada4a
Copy link
Contributor

@ada4a ada4a commented Aug 10, 2025

This makes the last arm significantly shorter, but marginally shortens the other ones as well

  • I first removed the length comparisons from the match guards since they were already present in (unordered_)over, but then brought them back since they are quite a helpful "guard clause"
  • It's a bit unfortunate that the Slice/Array arm can't use over as well, which creates some asymmetry, but changing the signature of over to accept arbitrary iterators felt like too much to me, especially because we'd lose the ability to compare the lengths of the two inputs (which could've been mitigated by ExactLenIterator::len, but that method is still unstable AFAIR)

One other option would be to only use unordered_over in the last arm, and not over, but I think over is not that bad..

changelog: none

@rustbot
Copy link
Collaborator

rustbot commented Aug 10, 2025

r? @Alexendoo

rustbot has assigned @Alexendoo.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Aug 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants