-
Notifications
You must be signed in to change notification settings - Fork 898
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
format_code_in_doc_comments
changes formatting of trailing comments in a list
#5568
Comments
Use the nightly-only rustdoc option `format_code_in_doc_comments`: https://rust-lang.github.io/rustfmt/?version=v1.5.1&search=format_code_in_doc_comments#format_code_in_doc_comments Don't check this option into `rustfmt.toml` because it has some bugs with how it formats comments. See: - rust-lang/rustfmt#5568
@lopopolo thanks for the report. I'm having a hard time figuring out what's going on from the example you posted. Could you please provide a minimal reproducible example without the diff info, thanks! |
Hi @ytmimi, here's a example project that shows the problem. The bad formatting happens in The archive is a git repository with a couple of commits, the last one showing the bad formatting. |
Thanks, but Ideally we'd like to not work with an arbitrary zip. An inline code example would be best if you have time to put a code example together. |
The zip I provided I thought was the minimized example 😅 . It was an empty cargo project with the
|
Thank you. Having the inline code snippet will help us dig into what's happening here |
Here's a slightly smaller code snippet that reproduces the issuse: Input mod libs {
fn mrbgems_sources() {
[
"mrbgems/mruby-compiler/core/codegen.c", // Ruby parser and bytecode generation
"mrbgems/mruby-compiler/core/y.tab.c", // Ruby parser and bytecode generation
"mrbgems/mruby-metaprog/src/metaprog.c", // APIs on Kernel and Module for accessing classes and variables
"mrbgems/mruby-method/src/method.c", // `Method`, `UnboundMethod`, and method APIs on Kernel and Module
"mrbgems/mruby-pack/src/pack.c", // Array#pack and String#unpack
]
}
} output ( mod libs {
fn mrbgems_sources() {
[
"mrbgems/mruby-compiler/core/codegen.c", // Ruby parser and bytecode generation
"mrbgems/mruby-compiler/core/y.tab.c", // Ruby parser and bytecode generation
"mrbgems/mruby-metaprog/src/metaprog.c", // APIs on Kernel and Module for accessing classes and variables
"mrbgems/mruby-method/src/method.c", // `Method`, `UnboundMethod`, and method APIs on Kernel and Module
"mrbgems/mruby-pack/src/pack.c", // Array#pack and String#unpack
]
}
} output ( mod libs {
fn mrbgems_sources() {
[
"mrbgems/mruby-compiler/core/codegen.c", // Ruby parser and bytecode generation
"mrbgems/mruby-compiler/core/y.tab.c", // Ruby parser and bytecode generation
"mrbgems/mruby-metaprog/src/metaprog.c", // APIs on Kernel and Module for accessing classes and variables
"mrbgems/mruby-method/src/method.c", // `Method`, `UnboundMethod`, and method APIs on Kernel and Module
"mrbgems/mruby-pack/src/pack.c", // Array#pack and String#unpack
]
}
} |
Also was looking into this and it seems #5536 resolves this issue |
Is this not, at least in part, related to rustfmt's current behavior of speciously trying to vertically/visually align trailing comments in list contexts (#4108)? I'd have expected this behavior to be reproducible independently of |
#4108 is still reproducible. I think this issue is related, but I think the In the example above we could maintain the alignment by bumping the |
The
format_code_in_doc_comments
option changes the formatting of inline comments that trail each item in a multi-line list to no longer be aligned.Version
Diff
The text was updated successfully, but these errors were encountered: