Skip to content

Conversation

@samueltardieu
Copy link
Member

@samueltardieu samueltardieu commented May 8, 2025

Placeholders are still given for the content of the whole block. However, if the result of the original if let or match expression was assigned, the assignment is reflected in the suggestion.

No-op assignments (let x = x;) are skipped though, unless they contain an explicit type which might help the compiler (let x: u32 = x; is kept).

Closes #362

changelog: [while_let_loop]: include let assignment in suggestion

This is shorter, and also avoids overloading the `peel_blocks()` from
`clippy_utils` with different semantics.
@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
Placeholders are still given for the content of the whole block. However, if the
result of the original `if let` or `match` expression was assigned, the
assignment is reflected in the suggestion.

No-op assignments (`let x = x;`) are skipped though, unless they contain an
explicit type which might help the compiler (`let x: u32 = x;` is kept).
Copy link
Contributor

@Jarcho Jarcho left a comment

Choose a reason for hiding this comment

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

Thank you.

@Jarcho Jarcho added this pull request to the merge queue May 28, 2025
Merged via the queue into rust-lang:master with commit beaf155 May 28, 2025
11 checks passed
@samueltardieu samueltardieu deleted the issue-362 branch May 28, 2025 18:11
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.

while_let_loop fails to account for lifetimes

3 participants