Skip to content

rustfmt: Enable error_on_line_overflow#4680

Merged
divergentdave merged 1 commit into
mainfrom
david/unstick-rustfmt
Jun 29, 2026
Merged

rustfmt: Enable error_on_line_overflow#4680
divergentdave merged 1 commit into
mainfrom
david/unstick-rustfmt

Conversation

@divergentdave

Copy link
Copy Markdown
Collaborator

This enables error_on_line_overflow, which makes rustfmt throw an error on long lines it can't reformat, with exceptions for long strings and comments. I manually reformatted or rewrote code to fix the issues this found. This resulted in some other automatic formatting changes shaking out from running rustfmt again. The issues broke down as follows:

  • Long lines in macro calls. These do not get reformatted because each macro makes its own DSL.
  • A combination of long method names and turbofishes. In these cases I wrapped the turbofish across multiple lines. This transformation isn't typically performed by rustfmt AFAIK, but we do so frequently throughout the codebase.
  • Long string literals. While a line with a long string literal itself doesn't result in an error being raised, it can prevent rustfmt from reformatting nearby code with long lines. I fixed these cases by extracting a variable or adding an escaped newline.
  • Long patterns. I turned one long if-let into a match, thus moving the pattern onto a second line. I added some intermediate variables or renamed a variable in cases where a tuple destructuring got too long.

@divergentdave divergentdave requested a review from a team as a code owner June 29, 2026 20:23
@divergentdave divergentdave merged commit b871286 into main Jun 29, 2026
9 checks passed
@divergentdave divergentdave deleted the david/unstick-rustfmt branch June 29, 2026 23:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants