rust-lang / rust-lang/rustfmt

function return type exceeds max width without wrapping

Open
#6,521 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

I-max-width
Dominant language
Rust
Stars
7k
Forks
1.1k
Avg merge
2d 13h
Merged PRs (30d)
24

Description

rustfmt 1.8.0-stable 2025-03-15 4eb161250e does not reformat the following input, violating the default max_width of 100 characters:

mod tests {
    // 100 characters is ··································································· here: |
    fn a_very_long_function_name_such_as_sometimes_found_in_descriptive_test_fn() -> CustomResultType
    {
        todo!()
    }
}

playground

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the Rust snippet from the issue with rustfmt 1.8.0 and the default max_width of 100, using the linked Playground example if helpful. Trace how this function signature is formatted and verify that the return type is wrapped so the output respects the configured width.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.