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

[map_identity]: respect match ergonomics #11792

Merged
merged 1 commit into from
Nov 11, 2023
Merged

Conversation

y21
Copy link
Member

@y21 y21 commented Nov 11, 2023

Fixes #11764

Note: the original tests before this were slightly wrong themselves already and had to be changed. They were calling map on an iterator of &(i32, i32)s, so this PR would stop linting there, but they were meant to test something else unrelated to binding modes, so I just changed them to remove the references so that it iterates over owned values and they all bind by value. This way they continue to test what they checked for before: the identity function for tuple patterns.

changelog: [map_identity]: respect match ergonomics

@rustbot
Copy link
Collaborator

rustbot commented Nov 11, 2023

r? @llogiq

(rustbot has picked a reviewer for you, use r? to override)

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Nov 11, 2023
@llogiq
Copy link
Contributor

llogiq commented Nov 11, 2023

Thank you, that's a solid improvement!

@bors r+

@bors
Copy link
Contributor

bors commented Nov 11, 2023

📌 Commit b2cf8f7 has been approved by llogiq

It is now in the queue for this repository.

@bors
Copy link
Contributor

bors commented Nov 11, 2023

⌛ Testing commit b2cf8f7 with merge d487579...

@bors
Copy link
Contributor

bors commented Nov 11, 2023

☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test
Approved by: llogiq
Pushing d487579 to master...

@bors bors merged commit d487579 into rust-lang:master Nov 11, 2023
4 checks passed
primeos-work added a commit to primeos-work/butido that referenced this pull request Nov 16, 2023
This got detected and "fixed" (improved) by clippy's `get_first` [0]
lint (beta toolchain version 1.75.0-beta.1).

Clippy currently shows two more warnings from the `map_identity` [1]
lint but those are false positives and a fix was already merged [2].

[0]: https://rust-lang.github.io/rust-clippy/master/index.html#/get_first
[1]: https://rust-lang.github.io/rust-clippy/master/index.html#/map_identity
[2]: rust-lang/rust-clippy#11792

Signed-off-by: Michael Weiss <michael.weiss@atos.net>
primeos-work added a commit to primeos-work/butido that referenced this pull request Nov 16, 2023
This got detected and "fixed" (improved) by clippy's `get_first` [0]
lint (beta toolchain version 1.75.0-beta.1).

Clippy currently shows two more warnings from the `map_identity` [1]
lint but those are false positives and a fix was already merged [2].

[0]: https://rust-lang.github.io/rust-clippy/master/index.html#/get_first
[1]: https://rust-lang.github.io/rust-clippy/master/index.html#/map_identity
[2]: rust-lang/rust-clippy#11792

Signed-off-by: Michael Weiss <michael.weiss@atos.net>
zydou pushed a commit to zydou/arti that referenced this pull request Jan 2, 2024
clippy in current stable thinks
  |(a, b)| (a, b)
is always the identity function, but due to match ergonomics, it might
be an implicit copy.

This is fixed in nightly by
  rust-lang/rust-clippy#11792
facebook-github-bot pushed a commit to facebookexperimental/rust-shed that referenced this pull request Jan 24, 2024
Summary:
See rust-lang/rust-clippy#11792

map_identity is causing build failures by taking its suggestion.

Once the fix is in, we can revert the changes to tools/buckconfigs/fbsource-common.bcfg in this diff.

Reviewed By: zertosh

Differential Revision: D53018763

fbshipit-source-id: a393dd9888a1320c19fc10de4b4c1e5d9b15bd43
ammernico pushed a commit to ammernico/butido that referenced this pull request Apr 30, 2024
This got detected and "fixed" (improved) by clippy's `get_first` [0]
lint (beta toolchain version 1.75.0-beta.1).

Clippy currently shows two more warnings from the `map_identity` [1]
lint but those are false positives and a fix was already merged [2].

[0]: https://rust-lang.github.io/rust-clippy/master/index.html#/get_first
[1]: https://rust-lang.github.io/rust-clippy/master/index.html#/map_identity
[2]: rust-lang/rust-clippy#11792

Signed-off-by: Michael Weiss <michael.weiss@atos.net>
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.

map_identity does not consider reference matching ergonomics
4 participants