Skip to content

missing_safety_doc warning even on functions internal to crate #4608

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

Closed
tspiteri opened this issue Oct 2, 2019 · 3 comments · Fixed by #4611
Closed

missing_safety_doc warning even on functions internal to crate #4608

tspiteri opened this issue Oct 2, 2019 · 3 comments · Fixed by #4611
Labels
C-enhancement Category: Enhancement of lints, like adding more cases or adding help messages

Comments

@tspiteri
Copy link
Contributor

tspiteri commented Oct 2, 2019

Functions which are public in their module, but inside a private module, are not exposed in the API docs. In fact they do not get a warning with warn(missing_docs). They still get a warning with warn(clippy::missing_safety_doc).

@llogiq
Copy link
Contributor

llogiq commented Oct 2, 2019

Oops. On one hand, the last thing I want is people to learn to delete their docs to silence the lint. On the other hand, where are you going to document the preconditions if not on the module boundary.

I guess the best solution is to split the lint by actual visibility and make the missing_private_safety_doc part lint even when there's no docs at all.

@flip1995 flip1995 added the C-enhancement Category: Enhancement of lints, like adding more cases or adding help messages label Oct 2, 2019
@tspiteri
Copy link
Contributor Author

tspiteri commented Oct 2, 2019

I agree that the lint should be split by visibility, not by existing docs. I mentioned the missing_docs lint to point out that missing_docs itself depends on visibility.

bors added a commit that referenced this issue Oct 3, 2019
account for doc visibility

This fixes #4608.

Also I noticed that the lint failed to look at trait and impl items. There's a small bit of fallout in the code, too, but not enough to warrant its own commit.

changelog: check docs of trait items and impl items, also make `missing_safety_doc` account for visibility
@bors bors closed this as completed in b690cdb Oct 8, 2019
@RustyYato
Copy link

RustyYato commented Jan 20, 2024

Was missing_private_safety_doc ever implemented? It would be very helpful to ensure that non-exposed unsafe functions and traits' preconditions are documented. If it wasn't, I think I can take a stab at implementing it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-enhancement Category: Enhancement of lints, like adding more cases or adding help messages
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants