diff --git a/clippy_lints/src/doc/too_long_first_doc_paragraph.rs b/clippy_lints/src/doc/too_long_first_doc_paragraph.rs index 9e7166111141..0165d24c7df2 100644 --- a/clippy_lints/src/doc/too_long_first_doc_paragraph.rs +++ b/clippy_lints/src/doc/too_long_first_doc_paragraph.rs @@ -85,10 +85,11 @@ pub(super) fn check( let Some(comment_form) = first.get(..3) else { return; }; + diag.span_suggestion( new_span, "add an empty line", - format!("{snippet}{comment_form}\n"), + format!("{snippet}{comment_form}{snippet}"), Applicability::MachineApplicable, ); } diff --git a/tests/ui/too_long_first_doc_paragraph_module_level.fixed b/tests/ui/too_long_first_doc_paragraph_module_level.fixed index 41ce507d33d1..5fa3a8c73ceb 100644 --- a/tests/ui/too_long_first_doc_paragraph_module_level.fixed +++ b/tests/ui/too_long_first_doc_paragraph_module_level.fixed @@ -4,7 +4,7 @@ pub mod foo { // in foo.rs //! A very short summary. //! -//! A much longer explanation that goes into a lot more detail about + //! 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. diff --git a/tests/ui/too_long_first_doc_paragraph_module_level.stderr b/tests/ui/too_long_first_doc_paragraph_module_level.stderr index fd75611e6ff2..26759939881e 100644 --- a/tests/ui/too_long_first_doc_paragraph_module_level.stderr +++ b/tests/ui/too_long_first_doc_paragraph_module_level.stderr @@ -14,6 +14,7 @@ help: add an empty line | LL ~ //! A very short summary. LL + //! +LL ~ //! A much longer explanation that goes into a lot more detail about | error: aborting due to 1 previous error