#7112·rustfmt

Tests for --file-lines

Author: ManishearthCreated Sep 9, 2026Updated Sep 11, 2026
LabelsC-discussionA-test-suiteA-test-harness

I think the existing formatting tests can be made to work for testing --file-lines.

Basically, what you can do is run diff between source/target, and identify the source lines that get formatted. Then use --file-lines to:

  • only format those lines, check if it produces something identical to target
  • only format lines that aren't those, check if it produces something identical to source

This may cover many of the cases @randomPoison has been finding.

There may be cleverer ways of doing this that cover more cases