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

Abierto
#7,262 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
3/5
Tiempo estimado
1-2 días
Aptitud para principiantes
63/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
rust
Área
tooling

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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
Lenguaje dominante
Rust
Estrellas
7.1k
Forks
1.2k
Merge medio
1 d 4 h
PR fusionados (30 d)
20

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de rust-lang/rustfmt

Todos los issues de rust-lang/rustfmt

Issues similares

Más issues de Rust

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.