-
Notifications
You must be signed in to change notification settings - Fork 1.7k
fix undocumented-unsafe-blocks
false positive
#9648
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? @giraffate (rust-highfive has picked a reviewer for you, use r? to override) |
ad8055f
to
6754ed8
Compare
I now no longer look at blocks. This would of course still allow e.g. |
6754ed8
to
f955e9c
Compare
Ping @giraffate Or @Jarcho do you want to take over the review? |
I guess I can take over. I'm still not sure about walking up expressions in general. Method and let chains can result in some pretty crazy expressions. Clippy in particular is pretty bad about having 40-50 line let chains, although I assume that's unusual in other projects. I think the best plan here would be to fix the current regression by only walking up a single level if the parent is a let statement (and in the same |
f955e9c
to
7cf0059
Compare
@Jarcho Ok, this now only looks one parent upwards. r? |
That comment was meant for Jarcho, not Rustbot. But nice error 😉. |
@@ -490,4 +490,20 @@ unsafe impl CrateRoot for () {} | |||
// SAFETY: ok | |||
unsafe impl CrateRoot for (i32) {} | |||
|
|||
fn issue_9142() { | |||
// SAFETY: ok | |||
let _ = unsafe {}; |
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 you change this to be on two lines. e.g.
// SAFETY: ok
let _ =
unsafe {}
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.
Ah, rustfmt pulled this together.
7cf0059
to
e19fe89
Compare
All looks good now. Thank you. @bors r+ |
☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test |
This fixes #9142 by iterating over the parent nodes as long as within a block, expression, statement, local, const or static.
changelog: none