Closed
Description
Summary
Related PR: #12993
For too_long_first_doc_paragraph
in module-level doc, it should suggest to add an empty line with //!
under certain conditions. However, the current implementation will suggest to add ///
only.
The module-level doc is specified because I found this rule not checking crate-level doc, which may be another issue.
Reproducer
I tried this code:
// in lib.rs
pub mod foo;
// in foo.rs
//! A very short summary.
//! A much longer explanation that goes into a lot more detail about
//! how the thing works, possibly with doclinks and so one,
//! and probably spanning a many rows. Blablabla, it needs to be over
//! 200 characters so I needed to write something longeeeeeeer.
I expected to see this happen:
warning: first doc comment paragraph is too long
--> src/foo.rs:1:1
|
1 | / //! A very short summary.
2 | | //! A much longer explanation that goes into a lot more detail about
3 | | //! how the thing works, possibly with doclinks and so one,
4 | | //! and probably spanning a many rows. Blablabla, it needs to be over
5 | | //! 200 characters so I needed to write something longeeeeeeer.
| |_
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#too_long_first_doc_paragraph
= note: `#[warn(clippy::too_long_first_doc_paragraph)]` on by default
help: add an empty line
|
1 ~ //! A very short summary.
2 + //!
|
Instead, this happened:
warning: first doc comment paragraph is too long
--> src/foo.rs:1:1
|
1 | / //! A very short summary.
2 | | //! A much longer explanation that goes into a lot more detail about
3 | | //! how the thing works, possibly with doclinks and so one,
4 | | //! and probably spanning a many rows. Blablabla, it needs to be over
5 | | //! 200 characters so I needed to write something longeeeeeeer.
| |_
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#too_long_first_doc_paragraph
= note: `#[warn(clippy::too_long_first_doc_paragraph)]` on by default
help: add an empty line
|
1 ~ //! A very short summary.
2 + ///
|
Version
rustc 1.82.0-nightly (c6db1ca3c 2024-08-25)
binary: rustc
commit-hash: c6db1ca3c93ad69692a4c4b5542f26fda4bf3aec
commit-date: 2024-08-25
host: x86_64-unknown-linux-gnu
release: 1.82.0-nightly
LLVM version: 19.1.0
Additional Labels
No response