Skip to content

Conversation

@Alexendoo
Copy link
Member

Looks like a good number of people disagree with this lint so it shouldn't be on by default

Fixes #16209

changelog: [collapsible_else_if]: move to pedantic

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Dec 10, 2025
@rustbot
Copy link
Collaborator

rustbot commented Dec 10, 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

@github-actions
Copy link

Lintcheck changes for 69db816

Lint Added Removed Changed
clippy::collapsible_else_if 0 0 10

This comment will be updated if you push new changes

@Jarcho
Copy link
Contributor

Jarcho commented Dec 10, 2025

cc @rust-lang/clippy if anyone has something to add. I personally have no objection.

@scottmcm
Copy link
Member

As someone who doesn't like this lint, 👍

But also, to try to be constructive about it, I think there are also ways it could be made warn-by-default again. For example, suppose the situation is just

if cond1 {
    ... body with no blocks
} else {
    if cond2 {
        ... body with no blocks ...
    }
}

then that one I could agree with linting on more aggressively.

More abstractly, I dislike this lint when doing what it suggests loses consistency between the blocks, but if they're both simple there's no consistency to lose and it'd be better to reduce the indentation. (That gives me another possible phrasing, which I haven't thought through but might work: this lint is good when it reduces total indentation, but if the if is already more or just-as indented, then unindenting the else doesn't really make a material difference.)

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.

Consider demoting collapsible_else_if out of the default lint group

4 participants