rust-lang / rustfmt

Format Rust code
https://rust-lang.github.io/rustfmt/
Apache License 2.0
6.06k stars 892 forks source link

With wrap_comments = true, rustfmt removes significant empty doc lines #5073

Open jplatte opened 3 years ago

jplatte commented 3 years ago

axum contains the following pattern (here):

//! Text
//!
#![doc = include_str!("something.md")]
//!
//! More text

With wrap_comments = true, rustfmt currently removes the //! line before the #![doc] attribute, merging two paragraphs if something.md also starts with regular text (not a heading or sth. like that).

msrd0 commented 2 years ago

The same happens when setting format_code_in_doc_comments = true, even if wrap_comments is left at its default value.

dhardy commented 2 years ago

Another example, affected when format_code_in_doc_comments = true:

/// Filter: target contains self (case-insensitive string match)
///
// Note: the implemented method of caseless matching is not unicode compliant,

The blank line gets removed.