Skip to content

fix false negative for unnecessary_unwrap #14758

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

Merged
merged 1 commit into from
May 8, 2025

Conversation

relaxcn
Copy link
Contributor

@relaxcn relaxcn commented May 8, 2025

changelog: Fix [unnecessary_unwrap] false negative when any assignment occurs in if branch (regardless of any variable).

Fixes: #14725

@rustbot
Copy link
Collaborator

rustbot commented May 8, 2025

r? @Jarcho

rustbot has assigned @Jarcho.
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 May 8, 2025
Copy link
Contributor

@samueltardieu samueltardieu left a comment

Choose a reason for hiding this comment

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

LGTM

@samueltardieu samueltardieu added this pull request to the merge queue May 8, 2025
Merged via the queue into rust-lang:master with commit d8726ca May 8, 2025
12 of 13 checks passed
@samueltardieu
Copy link
Contributor

samueltardieu commented May 8, 2025

Incidentally, your PR caused #14761 and #14763 (found during review). Thanks!

@relaxcn
Copy link
Contributor Author

relaxcn commented May 9, 2025

Thank you, I didn't notice them because I'm new.

I think if we want to build a mature tool, we must build some top-level interfaces to define lints so that the lint developers could ignore the rustc internal APIs changes.

In another words, I mean 'The Engine'.

If the lint could be written with a human-friendly way(top-level APIs or another descriptive language) provided by 'The Engine', we don't need to modify every lint when the rustc API changes.

In the long run, the benefits of building such an engine far outweigh the benefits of just creating clippy_utils.

@relaxcn relaxcn deleted the fix-14725 branch May 9, 2025 15:58
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.

unnecessary_unwrap doesn't lint following a binding name
4 participants