-
-
Notifications
You must be signed in to change notification settings - Fork 433
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
Rename doc_cfg
to docsrs
and use doc_auto_cfg
#1450
Conversation
/// | ||
/// [`TryCryptoRng`]: crate::TryCryptoRng | ||
/// [`TryRngCore`]: crate::TryRngCore | ||
/// [`CryptoRng`]: crate::CryptoRng |
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've also fixed these doc item links. We probably should setup a CI job to check doc links in a separate PR.
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.
We do have an existing check-doc
job, which should also detect bad in-repo links. Possibly we also need to deny warnings?
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.
Probably, yes.
#[cfg_attr(feature = "serde1", derive(Serialize, Deserialize))] | ||
#[cfg_attr( | ||
feature = "serde1", | ||
serde(bound(serialize = "W: Serialize, W::Sampler: Serialize")) | ||
)] | ||
#[cfg_attr( | ||
feature = "serde1 ", | ||
feature = "serde1", |
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 a typo caught by the unexpected_cfgs
lint.
@@ -17,7 +17,7 @@ rust-version = "1.61" | |||
include = ["src/", "LICENSE-*", "README.md", "CHANGELOG.md", "COPYRIGHT"] | |||
|
|||
[package.metadata.docs.rs] | |||
rustdoc-args = ["--generate-link-to-definition"] | |||
rustdoc-args = ["--cfg docsrs", "--generate-link-to-definition"] |
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.
Configuration option previously was not enabled for rand_distr
.
Cargo.toml
Outdated
all-features = true | ||
rustdoc-args = ["--cfg", "doc_cfg", "-Zunstable-options", "--generate-link-to-definition"] | ||
rustdoc-args = ["--cfg", "docsrs", "-Zunstable-options", "--generate-link-to-definition"] |
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.
Do we still need -Zunstable-options
?
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.
IIRC it was there for --generate-link-to-definition
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.
We then should add it to rand_core
and rand_distr
as well. Although, I am not sure if this feature even works right now. The link in #1327 does not contain any links to definitions anymore.
UPD: Ah, according to this comment this flag is no longer needed. I've generated rand
docs locally and source links were properly generated.
Renaming the configuration option also allows to enable back the
unexpected_cfgs
lint.I've checked generated docs and it does not look like using
doc_auto_cfg
instead of explicitdoc_cfg
s causes any issues. The check was by no means exhaustive, but most cases look perfectly good.