-
Notifications
You must be signed in to change notification settings - Fork 984
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
.github/workflows: Deny cargo doc warnings in CI #2936
Conversation
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.
Thanks for working on this!
One question.
swarm/src/lib.rs
Outdated
@@ -51,7 +51,7 @@ | |||
//! The [`ConnectionHandler`] trait defines how each active connection to a | |||
//! remote should behave: how to handle incoming substreams, which protocols | |||
//! are supported, when to open a new outbound substream, etc. | |||
//! | |||
#![allow(rustdoc::private_intra_doc_links)] |
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.
I am not sure if it makes sense to allow this. Do the offending links work on docs.rs
? Because if not, then there isn't really much of a point I think.
I'd be in favor of rewriting the docs instead.
@mxinden Thoughts?
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.
I'd be in favor of rewriting the docs instead.
I would be in favor of this as well.
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.
The links show up in docs.rs
, though the links do not work because the connection
and connection/pool
modules are private, so completely agree on the doc rewrite (assuming making connection
and connection/pool
public isn't a good option). Links to the offending documentation:
- https://github.com/libp2p/rust-libp2p/blob/master/swarm/src/dial_opts.rs#L124-L129
- https://github.com/libp2p/rust-libp2p/blob/master/swarm/src/dial_opts.rs#L198-L203
- https://github.com/libp2p/rust-libp2p/blob/master/swarm/src/lib.rs#L1371-L1377
I can lift the doc comments from the referenced functions and replace the private links with them, though this is not DRY, so it adds to the doc-update burden. Thoughts @thomaseizinger ?
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.
I'd suggest we simply remove the docs from the non-public items and put them on the public ones. In other words, inline the documentation we are currently referring to and deleting it from there!
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.
This is done, though I left the documentation in the private functions alone as it looked out of place with the other items documented. It may be out of scope for this PR, but it's worth considering changing ///
to //
documentation in private items.
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.
Thanks @ddimaria for the help here.
swarm/src/lib.rs
Outdated
@@ -51,7 +51,7 @@ | |||
//! The [`ConnectionHandler`] trait defines how each active connection to a | |||
//! remote should behave: how to handle incoming substreams, which protocols | |||
//! are supported, when to open a new outbound substream, etc. | |||
//! | |||
#![allow(rustdoc::private_intra_doc_links)] |
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.
I'd be in favor of rewriting the docs instead.
I would be in favor of this as well.
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.
Awesome, thank you!
Thank you @thomaseizinger! Do you need to approve the workflow (first time contributor)?
|
Description
Links to any relevant issues
Fixes #2914
Open Questions
I'm assuming that it's OK to document private items as it was already specified in the
RUSTDOCFLAGS
--document-private-items
directive. Warnings are still generated with this turned on. To turn off the warnings (inswarm
), I added#![allow(rustdoc::private_intra_doc_links)]
tolib.rs
.Change checklist