-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Suggest adding a semicolon to a closure without block #97371
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
Suggest adding a semicolon to a closure without block #97371
Conversation
This transforms `|| expr` into `|| { expr; }`.
r? @oli-obk (rust-highfive has picked a reviewer for you, use r? to override) |
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.
Just some code golfing, logic is sound.
&self, | ||
err: &mut Diagnostic, | ||
expression: &'tcx hir::Expr<'tcx>, | ||
expected: Ty<'tcx>, | ||
needs_block: bool, |
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.
Not a fan of the bool argument, but I can't come up with anything clearer right 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.
Neither am I :) Maybe an enum will do?
…`suggest_missing_semicolon()`
@bors r+ |
📌 Commit 6afaffb has been approved by |
Rollup of 6 pull requests Successful merges: - rust-lang#97089 (Improve settings theme display) - rust-lang#97229 (Document the current aliasing rules for `Box<T>`.) - rust-lang#97371 (Suggest adding a semicolon to a closure without block) - rust-lang#97455 (Stabilize `toowned_clone_into`) - rust-lang#97565 (Add doc alias `memset` to `write_bytes`) - rust-lang#97569 (Remove `memset` alias from `fill_with`.) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
This transforms
|| expr
into|| { expr; }
.Closes #97359.