Skip to content

Accept a set of line ranges to format #434

Closed
@kamalmarhubi

Description

@kamalmarhubi

rustfmt should accept a set of line ranges, and would restrict reformatting to code in those ranges.

Motivation: it should be possible to format new or modified code without needing to format an entire file. This helps both projects adding rustfmt to their process, as well projects—or rustfmt itself—changing style configuration. Keeping formatting changes localized to actual code changes can make code review and history inspection easier.

A way to specify lines would allow formatting a patch by parsing diff output. Examples for other format tools: clang-format-diff, google-java-format-diff.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions