3

Don't lint about missing code examples in derived traits by hnj2 · Pull Request...

 2 years ago
source link: https://github.com/rust-lang/rust/pull/88735
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Copy link

Contributor

hnj2 commented on Sep 7

edited

When the missing_doc_code_examples lint is performed it also requires that derived Trait implementations have a code example for each member etc., which causes undesirable behavior.

Examples

With missing_doc_code_examples enable we are not able to use the Clone derive macro due to the generated code not being documented:

#[deny(rustdoc::missing_doc_code_examples)]

/// docs
/// ```
/// let s = SomeStruct;
/// ```
#[derive(Clone)]
pub struct SomeStruct;

yields:

 Documenting testt v0.1.0 (<redacted>)
error: missing code example in this documentation
 --> src/lib.rs:7:10
  |
7 | #[derive(Clone)]
  |          ^^^^^
  |
note: the lint level is defined here
 --> src/lib.rs:1:8
  |
1 | #[deny(rustdoc::missing_doc_code_examples)]
  |        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: missing code example in this documentation
 --> src/lib.rs:7:10
  |
7 | #[derive(Clone)]
  |          ^^^^^

error: could not document `testt`

Caused by:
  process didn't exit successfully: `rustdoc ...

closes #81775


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK