Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions src/doc/rustdoc/src/lints.md
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,16 @@ To fix the lint, you need to add a code example into the documentation block:
pub fn no_code_example() {}
```

This lint is not emitted on the following items:

* Impl blocks
* Enum variants
* Struct/union fields
* (associated) Type aliases
* Statics/constants
* Modules
* Foreign items (functions, statics, types, etc)
Comment on lines +195 to +201
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* Impl blocks
* Enum variants
* Struct/union fields
* (associated) Type aliases
* Statics/constants
* Modules
* Foreign items (functions, statics, types, etc)
* Impl blocks (both trait and inherent)
* Enum variants
* Struct/union fields
* Type aliases, including associated types
* Statics/constants
* Modules (including the top-level module of a crate)
* Foreign items (functions, statics, types, etc)

I think this improves clarity a bit.

Additionally, by "Foreign items", do you mean inlined cross-crate reexports, or items from an extern block? The term is used a bit inconsistently within rustdoc.

Rationale for rewording My biggest concerns are making it clear that top-level docs are module docs, and the use of parenthesis that, while standard, may not be immediately intuitive to all readers.


## `private_doc_tests`

This lint is **allowed by default**. It detects documentation tests when they
Expand Down
Loading