-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Peel blocks and statements utils #8042
Conversation
r? @xFrednet (rust-highfive has picked a reviewer for you, use r? to override) |
clippy_utils/src/lib.rs
Outdated
/// Ie. `x`, `{ x }` and `{{{{ x }}}}` all give `x`. `{ x; y }` and `{}` return | ||
/// themselves. |
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 implementation will also halt at blocks which contain a single statement. I think it's worth to mention this and provide an example. Also, to make clear what distinguishes this function from the other one. It would also be good to mention that this only peels normal blocks.
Maybe a table or something might be better than a sentence for the examples, even if this is still not perfect.
/// | Input | Output |
/// |-----------------|---------------|
/// | `x` | `x` |
/// | `{ x }` | `x` |
/// | `{{{{ x }}}}` | `x` |
/// | `{}` | `{}` |
/// | `{ y; x }` | `{ y; x }` |
/// | `{ y; }` | `{ y; }` |
/// | `{ {x}; }` | `{ {x}; }` |
/// | `{ unsafe {x} }`| `unsafe {x} ` |
The other changes look good to me, it's nice to remove some duplicate code! Good work 🙃 |
ffb07f0
to
aa440a7
Compare
Rebased, renamed to |
aa440a7
to
22b2200
Compare
☔ The latest upstream changes (presumably #8066) made this pull request unmergeable. Please resolve the merge conflicts. |
2a4ea57
to
551395e
Compare
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, thank you for the changes! I would like to see one small change related to the documentation, then you can r=me
🙃
551395e
to
973ec16
Compare
Thanks for the review! @bors r=xFrednet |
📌 Commit 973ec16 has been approved by |
Peel blocks and statements utils changelog: none * Rename `remove_blocks` to `peel_blocks` * Add `peel_blocks_and_stmts` * Various refactors to use the above utils * The utils also now check `block.rules`
@bors r- |
💔 Test failed - checks-action_test |
973ec16
to
16bbd24
Compare
@bors r+ (sorry, I accidentally had thrown in unrelated commits) |
📌 Commit 16bbd24 has been approved by |
Peel blocks and statements utils changelog: none * Rename `remove_blocks` to `peel_blocks` * Add `peel_blocks_and_stmts` * Various refactors to use the above utils * The utils also now check `block.rules`
@bors r- |
@bors r=xFrednet bah |
📌 Commit 16bbd24 has been approved by |
☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test |
That was a rollercoaster of emotions xD |
changelog: none
remove_blocks
topeel_blocks
peel_blocks_and_stmts
block.rules