Skip to content

Commit 5f464bb

Browse files
committed
Don't lint about missing code examples in derived traits
Fixes #81775
1 parent e4828d5 commit 5f464bb

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

src/librustdoc/passes/doc_test_lints.rs

+1
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ crate fn should_have_doc_example(cx: &DocContext<'_>, item: &clean::Item) -> boo
9696

9797
if cx.tcx.hir().attrs(hir_id).lists(sym::doc).has_word(sym::hidden)
9898
|| inherits_doc_hidden(cx.tcx, hir_id)
99+
|| cx.tcx.hir().span(hir_id).in_derive_expansion()
99100
{
100101
return false;
101102
}

src/test/rustdoc-ui/lint-missing-doc-code-example.rs

+9
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,15 @@ impl Clone for Struct {
7878
}
7979

8080

81+
82+
/// doc
83+
///
84+
/// ```
85+
/// println!("hello");
86+
/// ```
87+
#[derive(Clone)]
88+
pub struct NiceStruct;
89+
8190
#[doc(hidden)]
8291
pub mod foo {
8392
pub fn bar() {}

0 commit comments

Comments
 (0)