Avoids recomputing LineEnding.toUnix in Formatter step loop by mirkoalicastro · Pull Request #2934 · diffplug/spotless (original) (raw)

@mirkoalicastro mirkoalicastro commented

May 17, 2026

Copy link Copy Markdown

Contributor

In the core format loop, when a formatting step changes a file's content, the code used to normalize line endings to Unix twice in a row on the same content: once to compare, then again one more time to store. The loop runs once per step, per file. toUnix scans the whole file. This PR fixes it to reuse the first result instead of computing it a second time, with no changes in the behavior.