-
Notifications
You must be signed in to change notification settings - Fork 998
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
chore: enforce unreachable_pub
lint
#3735
Conversation
I am in favor of this. |
Another data point for this: #3741 |
3a18948
to
498b1c4
Compare
@mxinden: Here is the initial version of enforcing this lint. I've applied most of the fixes with a script. Some of the What is a bit surprising but also great is that fact that we seemed to correctly export all structs and not miss anything that is actually unreachable. |
90b45d5
to
456f9f7
Compare
I am also adding the script I used to fix the warnings. I imagine once we remove some deprecations and / or add new modules, it might come in handy again. Please don't judge me for my poor Python skills 🙈 |
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.
Thank you!
The `unreachable_pub` lint makes us aware of uses of `pub` that are not actually reachable from the crate root. This is considered good because it means reading a `pub` somewhere means it is actually public API. Some of our crates are quite large and keeping their entire API surface in your head is difficult. We should strive for most items being `pub(crate)`. This lint helps us enforce that. Pull-Request: libp2p#3735.
Description
The
unreachable_pub
lint makes us aware of uses ofpub
that are not actually reachable from the crate root. This is considered good because it means reading apub
somewhere means it is actually public API. Some of our crates are quite large and keeping their entire API surface in your head is difficult.We should strive for most items being
pub(crate)
. This lint helps us enforce that.Notes & open questions
Draft because not yet complete. There is a lot of code to go through so I think we want some kind of automation to do this for us.Change checklist