Skip to content

Conversation

profetia
Copy link
Contributor

@profetia profetia commented May 3, 2025

Closes #14722

changelog: [collapsible_if] fix FP on block stmt before expr

@rustbot
Copy link
Collaborator

rustbot commented May 3, 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

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label May 3, 2025
@Alexendoo
Copy link
Member

Nominating this to be in the same release as #14481 if needed

@Alexendoo Alexendoo added the beta-nominated Nominated for backporting to the compiler in the beta channel. label May 3, 2025
@samueltardieu
Copy link
Member

Nominating this to be in the same release as #14481 if needed

Thanks, this was indeed introduced (and not caught by existing checks) during the conversion into a late lint.

@samueltardieu
Copy link
Member

r? @samueltardieu

@rustbot rustbot assigned samueltardieu and unassigned dswij May 5, 2025
Copy link
Member

@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.

The fix looks complicated. It looks like there is a guard missing in expr_block(), adding it may be enough to fix the problem and would greatly simplify this PR:

     match block.stmts {
         [] => block.expr,
-        [stmt] => {
+        [stmt] if block.expr.is_none() => {

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action from the author. (Use `@rustbot ready` to update this status) and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties labels May 5, 2025
@rustbot

This comment has been minimized.

@profetia
Copy link
Contributor Author

profetia commented May 6, 2025

Thanks. Im changing it back now.

Copy link
Member

@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, thanks

@samueltardieu samueltardieu added this pull request to the merge queue May 6, 2025
Merged via the queue into rust-lang:master with commit 7fdded3 May 6, 2025
11 checks passed
@flip1995
Copy link
Member

flip1995 commented May 8, 2025

Same as: #14733 (comment)

The likelihood of a beta backport right after the release increases.

@flip1995 flip1995 added beta-accepted Accepted for backporting to the compiler in the beta channel. and removed beta-nominated Nominated for backporting to the compiler in the beta channel. labels Jun 19, 2025
@flip1995
Copy link
Member

rust-lang/rust#142725

cuviper pushed a commit to cuviper/rust that referenced this pull request Jun 20, 2025
…ppy#14730)

Closes rust-lang/rust-clippy#14722

changelog: [`collapsible_if`] fix FP on block stmt before expr
bors added a commit to rust-lang/rust that referenced this pull request Jun 20, 2025
[beta] backports

- Make the assertion in `Ident::new` debug-only. #140880
- Avoid creating an empty identifer in `Symbol::to_ident_string`. #141318
- Backport rust-lang/stdarch#1818 for 1.88 #142694
- [beta] Clippy backport #142725
    - ICE:
        - rust-lang/rust-clippy#14776
    - Lint contradictions:
        - rust-lang/rust-clippy#14703
        - rust-lang/rust-clippy#14810
    - Smaller (in LoC changes) fixes:
        - rust-lang/rust-clippy#14733
        - rust-lang/rust-clippy#14730

r? cuviper
rust-bors bot added a commit to rust-lang/rust that referenced this pull request Jun 20, 2025
[beta] backports

- Make the assertion in `Ident::new` debug-only. #140880
- Avoid creating an empty identifer in `Symbol::to_ident_string`. #141318
- Backport rust-lang/stdarch#1818 for 1.88 #142694
- [beta] Clippy backport #142725
    - ICE:
        - rust-lang/rust-clippy#14776
    - Lint contradictions:
        - rust-lang/rust-clippy#14703
        - rust-lang/rust-clippy#14810
    - Smaller (in LoC changes) fixes:
        - rust-lang/rust-clippy#14733
        - rust-lang/rust-clippy#14730

r? cuviper

try-job: x86_64-msvc-ext2
bors added a commit to rust-lang/rust that referenced this pull request Jun 21, 2025
[beta] backports

- Make the assertion in `Ident::new` debug-only. #140880
- Avoid creating an empty identifer in `Symbol::to_ident_string`. #141318
- Backport rust-lang/stdarch#1818 for 1.88 #142694
- [beta] Clippy backport #142725
    - ICE:
        - rust-lang/rust-clippy#14776
    - Lint contradictions:
        - rust-lang/rust-clippy#14703
        - rust-lang/rust-clippy#14810
    - Smaller (in LoC changes) fixes:
        - rust-lang/rust-clippy#14733
        - rust-lang/rust-clippy#14730
-  [win][ci] Update LLVM toolchain used to build LLVM to 20 #140757

r? cuviper
@flip1995 flip1995 removed the beta-accepted Accepted for backporting to the compiler in the beta channel. label Jun 26, 2025
@profetia profetia deleted the issue14722 branch September 12, 2025 01:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-author Status: This is awaiting some action from the author. (Use `@rustbot ready` to update this status)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

collapsible_else_if lint false positive
6 participants