-
Notifications
You must be signed in to change notification settings - Fork 13k
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
Update rustdoc documentation #82690
Merged
+67
−132
Merged
Update rustdoc documentation #82690
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -340,6 +340,30 @@ Some methodology notes about what rustdoc counts in this metric: | |
Public items that are not documented can be seen with the built-in `missing_docs` lint. Private | ||
items that are not documented can be seen with Clippy's `missing_docs_in_private_items` lint. | ||
|
||
## `-w`/`--output-format`: output format | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This isn't strictly an unstable option, but it's useless except on nightly, so I moved it here. |
||
|
||
When using | ||
[`--show-coverage`](https://doc.rust-lang.org/nightly/rustdoc/unstable-features.html#--show-coverage-get-statistics-about-code-documentation-coverage), | ||
passing `--output-format json` will display the coverage information in JSON format. For example, | ||
here is the JSON for a file with one documented item and one undocumented item: | ||
|
||
```rust | ||
/// This item has documentation | ||
pub fn foo() {} | ||
|
||
pub fn no_documentation() {} | ||
``` | ||
|
||
```json | ||
{"no_std.rs":{"total":3,"with_docs":1,"total_examples":3,"with_examples":0}} | ||
``` | ||
|
||
Note that the third item is the crate root, which in this case is undocumented. | ||
|
||
When not using `--show-coverage`, `--output-format json` emits documentation in the experimental | ||
[JSON format](https://github.com/rust-lang/rfcs/pull/2963). `--output-format html` has no effect, | ||
and is also accepted on stable toolchains. | ||
|
||
### `--enable-per-target-ignores`: allow `ignore-foo` style filters for doctests | ||
|
||
Using this flag looks like this: | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Maybe a note on the fact it is very useful when developing the library or binary crate that is being documented, not as a user of said library/binary ? I don't know if that's a good place to put such a tip
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.
Hmm, does that need explanation? It seems pretty self-evident to me.