-
-
Notifications
You must be signed in to change notification settings - Fork 117
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
docs: improved the linking inside and outside of the crate #618
Conversation
insta/src/macros.rs
Outdated
/// will be serialized in YAML format. This does mean that unlike the debug | ||
/// snapshot variant the type of the value does not appear in the output. | ||
/// You can however use the `assert_ron_snapshot!` macro to dump out | ||
/// You can however use the [`crate::assert_ron_snapshot!`] macro to dump out |
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.
All these crate
specs are too much structure iff the links work without them. Fine if they're required on balance
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.
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.
Is the feature enabled?
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.
Yes, have just double checked myself. I did activate all features:
cargo doc --all-features --all --keep-going
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 also reproducible via make doc
, aka
RUSTC_BOOTSTRAP=1 RUSTDOCFLAGS="--cfg=docsrs" cargo doc --no-deps --all-features
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.
Weirdly I can't repro this...
edit: I repro with cargo doc
(as well as others), but not cargo doc --all-features
...
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.
Here are details to reproduce :
rustup --version
rustup 1.27.1 (54dd3d00f 2024-04-24)
info: This is the version for the rustup toolchain manager, not the rustc compiler.
info: The currently active `rustc` version is `rustc 1.81.0 (eeb90cda1 2024-09-04)`
git diff | cat
diff --git a/insta/src/macros.rs b/insta/src/macros.rs
index 45434b9..9c69005 100644
--- a/insta/src/macros.rs
+++ b/insta/src/macros.rs
@@ -81,7 +81,7 @@ macro_rules! assert_toml_snapshot {
/// The value needs to implement the [`serde::Serialize`] trait and the snapshot
/// will be serialized in YAML format. This does mean that unlike the debug
/// snapshot variant the type of the value does not appear in the output.
-/// You can however use the [`assert_ron_snapshot!`](crate::assert_ron_snapshot!) macro to dump out
+/// You can however use the [`assert_ron_snapshot!`] macro to dump out
/// the value in [RON](https://github.com/ron-rs/ron/) format which retains some
/// type information for more accurate comparisons.
///
RUSTC_BOOTSTRAP=1 RUSTDOCFLAGS="--cfg=docsrs" cargo doc --no-deps --all-features --keep-going
Checking insta v1.41.0 (/tmp/insta/insta)
Documenting insta v1.41.0 (/tmp/insta/insta)
Documenting cargo-insta v1.41.0 (/tmp/insta/cargo-insta)
warning: unresolved link to `assert_ron_snapshot`
--> insta/src/macros.rs:77:1
|
77 | / /// Asserts a [`serde::Serialize`] snapshot in YAML format.
78 | | ///
79 | | /// **Feature:** `yaml`
80 | | ///
... |
120 | | ///
121 | | /// The snapshot name is optional but can be provided as first argument.
| |________________________________________________________________________^
|
= note: the link appears in this line:
You can however use the [`assert_ron_snapshot!`] macro to dump out
^^^^^^^^^^^^^^^^^^^^^^
= note: no item named `assert_ron_snapshot` in scope
= note: `macro_rules` named `assert_ron_snapshot` exists in this crate, but it is not in scope at this link's location
note: the lint level is defined here
--> insta/src/lib.rs:2:9
|
2 | #![warn(rustdoc::all)]
| ^^^^^^^^^^^^
= note: `#[warn(rustdoc::broken_intra_doc_links)]` implied by `#[warn(rustdoc::all)]`
warning: `insta` (lib doc) generated 1 warning
Finished `dev` profile [unoptimized + debuginfo] target(s) in 1.19s
Generated /tmp/insta/target/doc/cargo_insta/index.html and 1 other file
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.
Ah, sorry, I hadn't realized this was with changed code
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.
Overall great, but I think we should scale it back about 30% — anything that doesn't require crate::
or self::
or std::fmt
, etc could be lighter. Is that reasonable?
Happy to try enabling some of the lints if they are manageable to work with... We can ignore the vendored
path though; that code won't see much development.
Co-authored-by: Maximilian Roos <5635139+max-sixty@users.noreply.github.com>
Just that we are on the same page. I have hidden the For |
Read: Please remove the changes from said code? |
No need to revert! But no need to do any more on it / have strict lints etc. |
Yes! I think the current code is a great balance, thank you! |
Co-authored-by: Frank Elsinga <frank@elsinga.de>
I can't repro the error above re
|
Sorry, that was a botched merge from master. Apparently, the unbalanced backticks part does not properly ignore escaped backticks.. |
As you wish. Definitely worth being liberal on the vendored code... The other lint seems great fwiw, has fixed lots of issues which are now ratcheted in. Will merge! Thank you for these @CommanderStorm |
While browsing the docs on docs.rs, I noticed that there are a few items which are not linked.
This PR tries to improve this situation.
Drawing attention to one thing which might be controversial:
In the current codebase, the usage of
[´foo´](Self::foo)
and[´Self::foo´]
(and related links) are a bit inconsistent. I have changed all to the[´Self::foo´]
format. Please let me know if you prefer the first and I can change them to that format.I have verified this change via adding the following (somewhat agressive) docs-related lints and running
RUSTDOCFLAGS="--cfg=docsrs" cargo +nightly doc --no-deps --all-features
andcargo clippy --all-features --all
.