rustfmt removes trailing line after Markdown list in doc comments

オープン
#7,274 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
70/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
rust
領域
tooling

調査の方向性

Start by reproducing the issue with the provided Rust example and rustfmt +nightly --config wrap_comments=true, then locate the comment-formatting logic that distinguishes doc comments from regular comments. Check the formatter’s existing comment and doc-comment tests. The work is done when the selected behavior is consistent and the example is covered by a regression test.

索引モデルが issue の本文から書いたものです。

説明

C-bug needs-triage

When a doc comment ends with a markdown list, rustfmt won't let it end with a blank line, which I'd like to do for visual separation. However, it is inconsistent about this: it applies to doc comments, but not regular comments.

Input:

/// A function that fits three criteria:
///
/// * Does A really well.
/// * Does B okay, I guess.
/// * Does C not very well at all.
///
pub fn foo() {
    // Three notes about the implementation we need:
    //
    // * A
    // * B
    // * C
    //
    todo!()
}
> rustfmt +nightly --version
rustfmt 1.12.0-nightly (6181cc4f07 2026-11-28)

> cat foo.rs | rustfmt +nightly --config wrap_comments=true

In the output, the doc comment has been messed with, but not the normal comment:

/// A function that fits three criteria:
///
/// * Does A really well.
/// * Does B okay, I guess.
/// * Does C not very well at all.
pub fn foo() {
    // Three notes about the implementation we need:
    //
    // * A
    // * B
    // * C
    //
    todo!()
}

I would prefer that the doc comment be left alone, but they should at least be consistent one way or another.

主要言語
Rust
スター
7.1k
フォーク
1.2k
平均マージ
1日 4時間
マージ済み PR(30日)
20

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

rust-lang/rustfmt のほかの issue

rust-lang/rustfmt の issue をすべて見る

似ている issue

Rust の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。