Skip to content

Conversation

@rwardd
Copy link
Contributor

@rwardd rwardd commented Dec 22, 2025

If two if arms contain only a single if {..} else {..} statement, don't suggest a collapse as this can lead to less readable code.

Fixes #4971

changelog: [collapsible_else_if]: prevent emitting lint when the all if arms contain only an if {..} else {..} expression.

…y an `if {..} else {..}` expression

If two `if` arms contain only a single `if {..} else {..}` statement,
don't suggest a collapse as this can lead to less readable code.
@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Dec 22, 2025
@rustbot
Copy link
Collaborator

rustbot commented Dec 22, 2025

r? @dswij

rustbot has assigned @dswij.
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

Copy link
Member

@dswij dswij left a comment

Choose a reason for hiding this comment

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

@github-actions
Copy link

Lintcheck changes for 646f583

Lint Added Removed Changed
clippy::collapsible_else_if 0 7 1

This comment will be updated if you push new changes

@dswij dswij added this pull request to the merge queue Dec 23, 2025
Merged via the queue into rust-lang:master with commit 615ac5d Dec 23, 2025
13 of 16 checks passed
@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Dec 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improper error about else if collapse.

3 participants