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

Make the iter_kv_map lint handle ref/mut annotations. #10159

Merged
merged 2 commits into from
Jan 4, 2023

Conversation

khuey
Copy link
Contributor

@khuey khuey commented Jan 4, 2023

For the degenerate (map(|(k, _)| k)/map(|(_, v)| v)) cases a mut annotation is superfluous and a ref annotation won't compile, so no additional handling is required. For cases where the map call must be preserved ref/mut annotations should also be presereved so that the map body continues to work as expected.

Please write a short comment explaining your change (or "none" for internal only changes)

changelog: [iter_kv_map]: handle ref/mut annotations

For the degenerate (`map(|(k, _)| k)`/`map(|(_, v)| v)`) cases a mut annotation is superfluous and a ref annotation won't compile, so no additional handling is required. For cases where the `map` call must be preserved ref/mut annotations should also be presereved so that the map body continues to work as expected.
@rustbot
Copy link
Collaborator

rustbot commented Jan 4, 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 Jan 4, 2023
Copy link
Contributor

@llogiq llogiq left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! I just have one very minor niggle, otherwise this looks good to merge.

clippy_lints/src/methods/iter_kv_map.rs Outdated Show resolved Hide resolved
@khuey
Copy link
Contributor Author

khuey commented Jan 4, 2023

Done.

@llogiq
Copy link
Contributor

llogiq commented Jan 4, 2023

Thank you!

@bors r+

@bors
Copy link
Collaborator

bors commented Jan 4, 2023

📌 Commit 755ae3f has been approved by llogiq

It is now in the queue for this repository.

@bors
Copy link
Collaborator

bors commented Jan 4, 2023

⌛ Testing commit 755ae3f with merge d5d8ef1...

@bors
Copy link
Collaborator

bors commented Jan 4, 2023

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

@bors bors merged commit d5d8ef1 into rust-lang:master Jan 4, 2023
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.

None yet

4 participants