rust/tests/ui/doc/doc_lazy_blockquote.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

48 lines
953 B
Rust

#![warn(clippy::doc_lazy_continuation)]
/// > blockquote with
/// lazy continuation
//~^ ERROR: doc quote line without `>` marker
fn first() {}
/// > blockquote with no
/// > lazy continuation
fn first_nowarn() {}
/// > blockquote with no
///
/// lazy continuation
fn two_nowarn() {}
/// > nest here
/// >
/// > > nest here
/// > lazy continuation
//~^ ERROR: doc quote line without `>` marker
fn two() {}
/// > nest here
/// >
/// > > nest here
/// lazy continuation
//~^ ERROR: doc quote line without `>` marker
fn three() {}
/// > * > nest here
/// lazy continuation
//~^ ERROR: doc quote line without `>` marker
fn four() {}
/// > * > nest here
/// lazy continuation
//~^ ERROR: doc quote line without `>` marker
fn four_point_1() {}
/// * > nest here lazy continuation
fn five() {}
/// 1. > nest here
/// lazy continuation (this results in strange indentation, but still works)
//~^ ERROR: doc quote line without `>` marker
fn six() {}