Document how to "leave" formatting as-is
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 7k
- Forks
- 1.1k
- Avg merge
- 2d 13h
- Merged PRs (30d)
- 24
Description
We should, in some shape or form, document how contributors to the rustfmt codebase can emit formatting for an AST node based on the respective original content in the input file (e.g. context.snippet(span))
As for why: with the move of rustfmt from a submodule to a subtree in rust-lang/rust, it's somewhat common for contributors to r-l/rust to have to apply changes to rustfmt to account for things like AST changes. In general, tool implementation/changes are discouraged from being made in r-l/rust for various reasons (reduced tool test suites in r-l/rust vs tool repo, review complexity/merge elongation for implementation PRs, increased potential for subtree sync conflicts, etc.). Therefore we almost always want those contributors to simply update rustfmt to emit whatever the user originally wrote, instead of implementing full blown formatting rules in r-l/rust.
Obviously we can always provide commentary/suggested changes on these types of PRs with the same info, but I feel like it'd be helpful to have it documented in one place so that we can just link to it
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 documentation file or test is named. Start by locating rustfmt’s contributor documentation and reviewing how context.snippet(span) preserves original AST-node content. Done means adding a linkable explanation for contributors working in rust-lang/rust, including when to emit the input unchanged instead of implementing formatting rules.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100