Closed
Description
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
.