Skip to content
Merged
Show file tree
Hide file tree
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
3 changes: 1 addition & 2 deletions src/librustdoc/passes/check_doc_test_visibility.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,7 @@ pub(crate) fn should_have_doc_example(cx: &DocContext<'_>, item: &clean::Item) -
| clean::ProvidedAssocConstItem(..)
| clean::ImplAssocConstItem(..)
| clean::RequiredAssocTypeItem(..)
// check for trait impl
| clean::ImplItem(box clean::Impl { trait_: Some(_), .. })
| clean::ImplItem(_)
)
{
return false;
Expand Down
6 changes: 5 additions & 1 deletion tests/rustdoc-ui/lints/lint-missing-doc-code-example.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,11 @@ impl Clone for Struct {
}
}


impl Struct { // No doc or code example and it's fine!
pub fn bar() {}
//~^ ERROR missing code example in this documentation
//~| ERROR missing documentation for an associated function
}

/// doc
///
Expand Down
20 changes: 19 additions & 1 deletion tests/rustdoc-ui/lints/lint-missing-doc-code-example.stderr
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
error: missing documentation for an associated function
--> $DIR/lint-missing-doc-code-example.rs:82:5
|
LL | pub fn bar() {}
| ^^^^^^^^^^^^
|
note: the lint level is defined here
--> $DIR/lint-missing-doc-code-example.rs:2:9
|
LL | #![deny(missing_docs)]
| ^^^^^^^^^^^^

error: missing code example in this documentation
--> $DIR/lint-missing-doc-code-example.rs:38:3
|
Expand Down Expand Up @@ -28,5 +40,11 @@ error: missing code example in this documentation
LL | /// Doc
| ^^^^^^^

error: aborting due to 4 previous errors
error: missing code example in this documentation
--> $DIR/lint-missing-doc-code-example.rs:82:5
|
LL | pub fn bar() {}
| ^^^^^^^^^^^^^^^

error: aborting due to 6 previous errors

Loading