Add multiple_unsafe_ops_per_block lint#10206
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.
👋
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.
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.
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