Skip to content

fix suggestion for assignments have enclosing parentheses under needless_late_init - #14169

Merged
y21 merged 1 commit into
rust-lang:masterfrom
lapla-cogito:issue_9895
Mar 19, 2025
Merged

y21 merged 1 commit into
rust-lang:masterfrom
lapla-cogito:issue_9895

Conversation

@lapla-cogito

Copy link
Copy Markdown
Contributor

fixes #9895

changelog: [needless_late_init]: correct suggestion when assignments have enclosing parentheses

@rustbot

rustbot commented Feb 7, 2025

Copy link
Copy Markdown
Collaborator

r? @y21

rustbot has assigned @y21.
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 7, 2025

fn issue9895() {
let r;
(r = 5);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

These patterns can also be ignored, but I thought it wouldn't be a problem to remove the enclosing parentheses here, since an assignment returns the unit value.

@lapla-cogito

Copy link
Copy Markdown
Contributor Author

Rebased to address the recent changes in error annotation.

Comment thread clippy_lints/src/needless_late_init.rs Resolved
Comment thread clippy_lints/src/needless_late_init.rs Resolved
@lapla-cogito
lapla-cogito force-pushed the issue_9895 branch 3 times, most recently from c618387 to 62c41e2 Compare February 22, 2025 15:58
@lapla-cogito

Copy link
Copy Markdown
Contributor Author

@y21 Could you take a look at this when you have some time?

@y21 y21 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM, sorry for the wait!

@y21
y21 added this pull request to the merge queue Mar 19, 2025
Merged via the queue into rust-lang:master with commit 221ae5f Mar 19, 2025
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.

FP needless-late-init: assignment inside brace expr

3 participants