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

fix: incorrect suggestions when .then and .then_some is used #12094

Merged
merged 6 commits into from Apr 14, 2024

Conversation

yuxqiu
Copy link
Contributor

@yuxqiu yuxqiu commented Jan 4, 2024

fixes #11910

In the current implementation of search_is_some, if a .is_none call is followed by a .then or .then_some call, the generated ! will incorrectly negate the values returned by the then and .then_some calls. To fix this, we need to add parentheses to the generated suggestions when appropriate.

changelog: [search_is_some]: add parenthesis to suggestions when appropriate

@rustbot
Copy link
Collaborator

rustbot commented Jan 4, 2024

r? @Manishearth

(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, 2024
@yuxqiu yuxqiu force-pushed the search_is_some branch 2 times, most recently from 186c032 to a74b4b9 Compare January 4, 2024 19:41
@bors
Copy link
Collaborator

bors commented Jan 13, 2024

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

@xFrednet
Copy link
Member

xFrednet commented Apr 1, 2024

Manish is currently pretty busy @ARandomDev99, would you mind giving this a prereview?

@xFrednet
Copy link
Member

xFrednet commented Apr 8, 2024

This PR is on my todo list for this week.

@ARandomDev99 thank you for the review ❤️

@xFrednet
Copy link
Member

This implementation looks good to me. I like the idea of @Manishearth to have a general util method for this, but that is out of the scope of this PR IMO. Also, since it has been open for such a long time, I'll merge it as is, since the implementation looks good.

Thank you for the fix! :D


Let's see if the CI still passes.

@bors r=xFrednet,ARandomDev99

@bors
Copy link
Collaborator

bors commented Apr 14, 2024

📌 Commit b89fa53 has been approved by xFrednet,ARandomDev99

It is now in the queue for this repository.

@bors
Copy link
Collaborator

bors commented Apr 14, 2024

⌛ Testing commit b89fa53 with merge 7063e34...

@bors
Copy link
Collaborator

bors commented Apr 14, 2024

☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test
Approved by: xFrednet,ARandomDev99
Pushing 7063e34 to master...

@bors bors merged commit 7063e34 into rust-lang:master Apr 14, 2024
5 checks passed
@yuxqiu yuxqiu deleted the search_is_some branch April 14, 2024 21:02
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.

Clippy fails to auto-fix search_is_some issue when .then_some() is used
7 participants