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

question_mark: avoid incorrect suggestion when ref binding used #14158

Merged
merged 1 commit into from
Mar 16, 2025

Conversation

notriddle
Copy link
Contributor

@notriddle notriddle commented Feb 5, 2025

changelog: [question_mark]: avoid incorrect suggestion when ref binding used

Fixes #13417

@rustbot
Copy link
Collaborator

rustbot commented Feb 5, 2025

r? @Manishearth

rustbot has assigned @Manishearth.
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 Feb 5, 2025
@notriddle notriddle force-pushed the notriddle/question-mark-as-ref branch from 46f9da1 to a0927f9 Compare February 5, 2025 23:05
@Manishearth
Copy link
Member

r? clippy

swamped this week

@rustbot rustbot assigned blyxyas and unassigned Manishearth Feb 5, 2025
@blyxyas
Copy link
Member

blyxyas commented Feb 16, 2025

I'm finding this code seriously hard to read, could you refactor it? If an
external viewer having the context for this contributions finds it hard to
read, I can imagine that someone 3 months from now can find it very very hard

@notriddle
Copy link
Contributor Author

I'm not sure how to refactor this code to be more readable.

But, since this is a corner case and not actually important, I can change it to avoid giving wrong answers by just doing nothing. Skipping the part where it tries to figure out a working fix simplifies it a lot.

@notriddle notriddle force-pushed the notriddle/question-mark-as-ref branch from e0c7376 to 26ff4a7 Compare February 17, 2025 20:38
@notriddle notriddle changed the title question_mark: suggest as_ref/as_mut if ref binding is used question_mark: avoid incorrect suggestion when ref binding used Feb 18, 2025
Copy link
Member

@blyxyas blyxyas left a comment

Choose a reason for hiding this comment

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

I think it's better to do the suggestion even at the cost of a little less maintainability. Could you revert the second commit (I've suggested some renames)

@notriddle notriddle force-pushed the notriddle/question-mark-as-ref branch 3 times, most recently from fab9d27 to 880f1bf Compare March 11, 2025 04:19
Copy link
Member

@blyxyas blyxyas left a comment

Choose a reason for hiding this comment

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

LGTM, thanks! ❤️ Could you squash the commits?

@notriddle notriddle force-pushed the notriddle/question-mark-as-ref branch from 880f1bf to 0e6f7db Compare March 15, 2025 22:58
@notriddle notriddle force-pushed the notriddle/question-mark-as-ref branch from 0e6f7db to 4e9caa3 Compare March 15, 2025 22:59
@notriddle
Copy link
Contributor Author

Sure. It's squashed.

@blyxyas blyxyas added this pull request to the merge queue Mar 16, 2025
Merged via the queue into rust-lang:master with commit 4800557 Mar 16, 2025
11 checks passed
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.

False positive for clippy::question_mark
4 participants