rustfmt formats non-rust code in doc comments
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 7k
- Forks
- 1.1k
- Avg merge
- 2d 13h
- Merged PRs (30d)
- 24
Description
Config
hard_tabs = true
Setting format_code_in_doc_comments = true does not change the behaviour of rustfmt for this input code.
Input
/*!
```yaml
foo:
bar:
rustfmt: "don't touch this"
```
*/
fn main() {
println!("Hello, world!");
}
Output
cargo +nightly fmt changes the indentation in front of the rustfmt: "don't touch this" line from 4 spaces to one tab. However, that code block specifies yaml as the language and should therefore not be touched by rustfmt.
Meta
- rustfmt version:
rustfmt 1.4.36-nightly (7de6968 2021-02-07) - From where did you install rustfmt?: rustup
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No source file or test is named. Start by running the provided reproducer with cargo +nightly fmt, hard_tabs = true, and format_code_in_doc_comments = true; compare the YAML block and Rust code with the reported output. Done means Rust code is formatted while the YAML block remains unchanged.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 35/100