-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Fix collapsible_if
FP on block stmt before expr
#14730
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
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. |
There was a problem hiding this 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() => {
This comment has been minimized.
This comment has been minimized.
Thanks. Im changing it back now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks
Same as: #14733 (comment) The likelihood of a beta backport right after the release increases. |
…ppy#14730) Closes rust-lang/rust-clippy#14722 changelog: [`collapsible_if`] fix FP on block stmt before expr
[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
[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
[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
Closes #14722
changelog: [
collapsible_if
] fix FP on block stmt before expr