Skip to content

style: reformat comments for the current nightly rustfmt - #584

Merged
hogan-yuan merged 1 commit into
mainfrom
fix/rustfmt-nightly-comment-reflow
Sep 1, 2026
Merged

style: reformat comments for the current nightly rustfmt#584
hogan-yuan merged 1 commit into
mainfrom
fix/rustfmt-nightly-comment-reflow

Conversation

@hogan-yuan

Copy link
Copy Markdown
Member

问题

main 的 check-format CI 失败(#582 合并后触发的那次跑):

Diff in java/crates/macros/src/lib.rs:129
Diff in java/src/error.rs:90 ...

根因

  • check-format job 用 未固定版本的 nightly(toolchain: nightly)跑 cargo fmt --all -- --check;
  • .rustfmt.toml 开了 unstable 的 wrap_comments = true,其注释折行算法在近期 nightly 里变了;
  • 之前用旧 nightly 格式化过的注释,在新 nightly 下不再满足 --check

#582 无关(#582 只改了一个 .java 文件,cargo fmt 不处理 Java)—— 只是 #582 那次 push 触发了用新 nightly 的检查。

修复

用当前 nightly(rustfmt 1.10.0-nightly, 2026-08-30)重排受影响文件的注释。纯注释/空白,无任何代码逻辑改动(已核对:非注释改动行为空)。

验证

本地 cargo +nightly fmt --all -- --checkexit 0、无 diff

备注:根因是 CI 用漂移的 nightly + unstable wrap_comments,以后 nightly 再变还会复发。若要彻底稳定,可考虑在 CI 固定 nightly 日期(如 toolchain: nightly-2026-08-30)——本 PR 未做此改动,留给维护者决定。

🤖 Generated with Claude Code

The check-format CI job runs `cargo fmt --all -- --check` on an unpinned
nightly toolchain, and .rustfmt.toml enables the unstable `wrap_comments`
option — whose line-wrapping algorithm changed in a recent nightly. Files
formatted under the older nightly no longer pass the check. Reflow the
affected comments with the current nightly (rustfmt 1.10.0-nightly,
2026-08-30). Comment/whitespace only — no code changes.

`cargo fmt --all -- --check` now passes clean.
@hogan-yuan
hogan-yuan merged commit f31ce22 into main Sep 1, 2026
56 checks passed
@hogan-yuan
hogan-yuan deleted the fix/rustfmt-nightly-comment-reflow branch September 1, 2026 03:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant