rust-clippy/tests/ui/doc/doc_lazy_blank_line.rs
Michael Howell 6de87829da doc_lazy_continuation: blank comment line for gap
This change addresses cases where doc comments are separated
by blank lines, comments, or non-doc-comment attributes,
like this:

```rust
/// - first line
// not part of doc comment
/// second line
```

Before this commit, Clippy gave a pedantically-correct
warning about how you needed to indent the second line.
This is unlikely to be what the user intends, and has
been described as a "false positive" (since Clippy is
warning you about a highly unintuitive behavior that
Rustdoc actually has, we definitely want it to output
*something*, but the suggestion to indent was poor).

https://github.com/rust-lang/rust-clippy/issues/12917
2024-06-27 17:09:54 -07:00

43 lines
915 B
Rust

// https://github.com/rust-lang/rust-clippy/issues/12917
#![warn(clippy::doc_lazy_continuation)]
/// This is a constant.
///
/// The meaning of which should not be explained.
pub const A: i32 = 42;
/// This is another constant, no longer used.
///
/// This block of documentation has a long
/// explanation and derivation to explain
/// why it is what it is, and how it's used.
///
/// It is left here for historical reasons, and
/// for reference.
///
/// Reasons it's great:
/// - First reason
/// - Second reason
//pub const B: i32 = 1337;
/// This is yet another constant.
///
/// This has a similar fate as `B`.
///
/// Reasons it's useful:
/// 1. First reason
/// 2. Second reason
//pub const C: i32 = 8008;
/// This is still in use.
pub const D: i32 = 20;
/// > blockquote code path
/// bottom text
pub const E: i32 = 20;
/// > blockquote code path
#[repr(C)]
/// bottom text
pub struct Foo(i32);