Skip to content

Commit

Permalink
Don't lint about missing code examples in derived traits
Browse files Browse the repository at this point in the history
Fixes #81775
  • Loading branch information
hnj2 committed Sep 16, 2021
1 parent e4828d5 commit 5f464bb
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/librustdoc/passes/doc_test_lints.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ crate fn should_have_doc_example(cx: &DocContext<'_>, item: &clean::Item) -> boo

if cx.tcx.hir().attrs(hir_id).lists(sym::doc).has_word(sym::hidden)
|| inherits_doc_hidden(cx.tcx, hir_id)
|| cx.tcx.hir().span(hir_id).in_derive_expansion()
{
return false;
}
Expand Down
9 changes: 9 additions & 0 deletions src/test/rustdoc-ui/lint-missing-doc-code-example.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,15 @@ impl Clone for Struct {
}



/// doc
///
/// ```
/// println!("hello");
/// ```
#[derive(Clone)]
pub struct NiceStruct;

#[doc(hidden)]
pub mod foo {
pub fn bar() {}
Expand Down

0 comments on commit 5f464bb

Please sign in to comment.