Skip to content

Document how to "leave" formatting as-is #5770

Open
@calebcartwright

Description

@calebcartwright

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions