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

Replace if_chain with let chains #11750

Merged
merged 2 commits into from Nov 10, 2023
Merged

Replace if_chain with let chains #11750

merged 2 commits into from Nov 10, 2023

Conversation

Alexendoo
Copy link
Member

@Alexendoo Alexendoo commented Nov 2, 2023

Closes #9353

Let chains are now supported by rustfmt 🎉

The PR is split into two commits

  1. The result of running if-to-let-chain clippy*/**/*.rs
  2. The manual clean up: fixing some errors/formatting, dogfood lints, removing the if_chain internal lint

r? @flip1995

changelog: none

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Nov 2, 2023
@Alexendoo Alexendoo force-pushed the let-chains branch 2 times, most recently from 9e0f89e to 5445362 Compare November 2, 2023 19:26
@bors
Copy link
Collaborator

bors commented Nov 10, 2023

☔ The latest upstream changes (presumably #11780) made this pull request unmergeable. Please resolve the merge conflicts.

@flip1995
Copy link
Member

I will review this today. No need to rebase before that. Once I'm done reviewing, you can rebase and directly merge :shipit:

Copy link
Member

@flip1995 flip1995 left a comment

Choose a reason for hiding this comment

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

LGTM overall. rg if_chain in the repo still shows a few if_chain usages. But those are in tests and necessary. However, I think once let-chains are stabilized, we can also remove this one special check for if_chain in the index_refutable_slice lint implementation.

The needless_borrow_pat test implements its own if_chain macro for testing. Maybe we can reuse that in index_refutable_slice for now and with that get rid of the if_chain dep in the top level Cargo.toml.

All of this is non-blocking for this PR. Feel free to address it here or we can deal with it in a follow-up PR. r=me after rebase :shipit:

@Alexendoo
Copy link
Member Author

@bors r=flip1995

The if_chain implementation from index_refutable_slice didn't seem to trigger the lint so I've left the if_chain dev dep there for now

@bors
Copy link
Collaborator

bors commented Nov 10, 2023

📌 Commit 13b4bb1 has been approved by flip1995

It is now in the queue for this repository.

@bors
Copy link
Collaborator

bors commented Nov 10, 2023

⌛ Testing commit 13b4bb1 with merge 9a4dd10...

@bors
Copy link
Collaborator

bors commented Nov 10, 2023

☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test
Approved by: flip1995
Pushing 9a4dd10 to master...

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.

Remove all if_chain! macros
5 participants