rustfmt insists on making comment lines too long for lists containing URLs

Đang mở
#7,262 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
63/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
rust
Lĩnh vực
tooling

Hướng nghiên cứu

The comment-rewrapping logic lives in src/comment.rs in the rustfmt source; start by grepping there for wrap_comments and comment_width to find where a line is split into words. Reproduce with the echo ... | rustfmt +nightly --config wrap_comments=true,max_width=40,comment_width=40 command in the report, then check whether URL tokens are treated as unbreakable and whether the list-item indent is reapplied after the URL. Done means both examples keep the line under comment_width and a regression test under tests/ covers the idempotent case.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

A-markdown C-bug UO-comment_width UO-wrap_comments

When a Markdown list within a comment contains a too-long line that also contains a URL, rustfmt won't wrap it:

> rustfmt +nightly --version
rustfmt 1.12.0-nightly (bdf712ee87 2026-11-21)

> echo '// * Lorem ipsum dolor sit amet http://google.com' | rustfmt +nightly --config wrap_comments=true,max_width=40,comment_width=40
// * Lorem ipsum dolor sit amet http://google.com

Worse, when you wrap it manually to fix the long line, rustfmt will undo your work and make it too long again:

> echo '// * Lorem ipsum dolor sit amet
//   http://google.com' | rustfmt +nightly --config wrap_comments=true,max_width=40,comment_width=40
// * Lorem ipsum dolor sit amet http://google.com
Ngôn ngữ chính
Rust
Star
7.1k
Fork
1.2k
Merge trung bình
1 ngày 4 giờ
Pull request đã merge (30 ngày)
20

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của rust-lang/rustfmt

Tất cả issue của rust-lang/rustfmt

Issue tương tự

Thêm issue về Rust

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.