[unnecessary_safety_comment] Some fixes regarding comments above attributes#15678
[unnecessary_safety_comment] Some fixes regarding comments above attributes#15678blyxyas merged 1 commit intorust-lang:masterfrom
unnecessary_safety_comment] Some fixes regarding comments above attributes#15678Conversation
|
Lintcheck changes for 9cc0291
This comment will be updated if you push new changes |
|
I checked all the removed/added lints and they all make sense to me
|
|
rustbot has assigned @samueltardieu. Use |
unnecessary_safety_comment] Considering comments above attributes for itemsunnecessary_safety_comment] Some fixes regarding comments above attributes
|
r? blyxyas Being that this is R4L-oriented, I'll give it priority |
We totally should! could you add that case? (It should be simple) |
There was a problem hiding this comment.
Great patch, but I have one request.
It's a bit hard to distinguish why you're being prompted to remove a SAFETY comment from an unsafe function without extra help. What about not linting when that SAFETY comment comes from a doc-comment, as it will be rendered as useful information for consumers?
Also, if it's not a doc-comment, we can suggest to make it into a doc comment (/// # Safety)
| Some((start + (text.len() - trimmed.len()), trimmed)) | ||
| }) | ||
| .filter(|(_, text)| !text.is_empty()); | ||
| .filter(|(_, text)| !(text.is_empty() || (accept_comment_above_attributes && is_attribute(text)))); |
There was a problem hiding this comment.
I really like how you managed to do a solution so elegant.
There was a problem hiding this comment.
Thanks! I really appreciate it
This comment has been minimized.
This comment has been minimized.
90eee6e to
05d5c5d
Compare
|
Hey, thanks for the review! I tried to reach a (useful) middle grounds, if there's a
I modified what position is used for the lint, so I don't need to find the position of Anyways, I think this lint deserves a bigger refactor (I'd like to work on it, but have no time right now). #15755 and #clippy > broken lint: `undocumented_unsafe_blocks` Let me know what you think @rustbot ready |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
@rustbot ready |
improve coverage Considering comments above attributes for items Fixed the ICE and safety comments between attributes - No longer using attr.span() - ignoring attributes manually Improve error messages on unsafe fns
|
This PR was rebased onto a different master commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
|
Squashed and rebased! |
The way clippy checked for SAFETY comments above attributes was wrong:
This PR tries to fix this by delegating the skipping of attributes to the function analyzing the source code itself.
changelog: [
unnecessary_safety_comment]: Taking into account comments above attributes for itemsFixes #14555
Fixes #15684
Fixes #15754