-
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
Uplift undocumented_unsafe_blocks
to pedantic
#11162
Comments
I think that if this is uplifted, |
Stuff like the winapi as well would likely be very unnecessary as a good portion of it can be utilized somewhat care-free (despite being unsafe). You'd have to document each and every call, which would likely just be noise. I'm definitely for making the 2 config options true by default though 👍 |
I do get that the comparison isn't exactly apples to apples - but Clippy of course has a ton of lints that are dedicated to easier development and maintenance. Not that that alone is the strongest justification, but even a simple comment like
Great! I can submit a PR for this later |
If a codebase did it from the get go then yeah it would help a ton, but I feel like applying this retroactively to any codebase that bulk-enables the
I agree with this :) |
Yeah, and having a comment gives extra information: if there is no comment, a reader doesn't know if it is because it was supposedly "trivial" or because it was missing (and thus there may be other requirements). Thus always having comments, even if they just say it is a FFI call (or similar), can be helpful. That is why we want to always have a comment in the kernel.
Those can be useful! For instance, in the kernel, we had some
Wrong (and outdated) comments are, indeed, always a problem, but it seems orthogonal. And if it is a Having said that, I agree with the problem of adding things like this to groups that people may be already using. In fact, relatedly, we wanted to perhaps stop using groups so that (by the time we stop pinning the compiler version) we can guarantee new Clippy versions do not break the kernel builds (since we do |
In cases where the lint's usage is enforced I feel like simply having a warning (i.e., not adding
I disagree, as I was bringing up that they would be hastily added without much forethought, which is not a good combo with
It's probably just easier to |
That is fine too. In the kernel we can't really do that because warnings are to be fixed (i.e. the ones enabled by default) and writing the
That is up to the review/quality process of the project in particular. But, again, I agree putting something like this in "pedantic" is a fairly big hammer. Perhaps it should be done, but it is something that should be discussed widely, I would assume.
What we do in compile testing is to make warnings be errors (in Rust with Having said that, if we can make something |
Oh, Jon Gjengset also asked about this at RustNationUK at the start of the year. I think this is a good idea. Please open an issue about it. |
Done! #11227 |
…r=Centri3 Change defaults of `accept-comment-above-statement` and `accept-comment-above-attributes` This patch sets the two configuration options for `undocumented_unsafe_blocks` to `true` by default: these are `accept-comment-above-statement` and `accept-comment-above-attributes`. Having these values `false` by default prevents what many users would consider clean code, e.g. placing the `// SAFETY:` comment above a single-line functino call, rather than directly next to the argument. This was originally discussed in #11162 changelog: [`undocumented_unsafe_blocks`]: set `accept-comment-above-statement` and `accept-comment-above-attributes` to `true` by default.
…r=Centri3 Change defaults of `accept-comment-above-statement` and `accept-comment-above-attributes` This patch sets the two configuration options for `undocumented_unsafe_blocks` to `true` by default: these are `accept-comment-above-statement` and `accept-comment-above-attributes`. Having these values `false` by default prevents what many users would consider clean code, e.g. placing the `// SAFETY:` comment above a single-line functino call, rather than directly next to the argument. This was originally discussed in #11162 changelog: [`undocumented_unsafe_blocks`]: set `accept-comment-above-statement` and `accept-comment-above-attributes` to `true` by default.
Description
missing_safety_doc
is warn by default, I think it makes sense to have its counterpartundocumented_unsafe_blocks
at least be in pedantic. The other doc related lints likemissing_panic_docs
are in pedantic, so it seems to be a suitible place.@rustbot label +A-category
The text was updated successfully, but these errors were encountered: