-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Add multiple_unsafe_ops_per_block lint
#10206
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
|
r? @Alexendoo (rustbot has picked a reviewer for you, use r? to override) |
|
@rustbot label: +A-lint, +L-restriction |
Alexendoo
left a comment
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.
👋
Thanks for the PR! It's looking good
bb5cfee to
6d6d5a4
Compare
one_unsafe_op_per_block lintmultiple_unsafe_ops_per_block lint
|
Thanks for the review, @Alexendoo! I've addressed the comments, can you review it again please? |
| ) { | ||
| let expr = expr.peel_drop_temps(); | ||
|
|
||
| for_each_expr_with_closures(cx, expr, |expr| { |
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.
You can pass the Block in here directly, letting you remove the collect_block function
| for_each_expr_with_closures(cx, expr, |expr| { | |
| for_each_expr_with_closures(cx, block, |expr| { |
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.
Can't take Block directly here, as I still have one recursive call at the bottom, but I figured I can take impl Visitable, so that works. Thanks for the comment!
6d6d5a4 to
875e36f
Compare
|
@Alexendoo can you look again please? I think it should be good now |
|
Yep looks great thanks @bors r+ |
|
☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test |
Adds a lint, which restricts an
unsafeblock to only one unsafe operation.Closes #10064
changelog: New lint: [
multiple_unsafe_ops_per_block]#10206