rust-lang / rust-lang/rustfmt

Feature request: control maximum line length with `fn_params_layout = "Tall"`?

Open
#5,773 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

C-feature-request P-low
Dominant language
Rust
Stars
7k
Forks
1.1k
Avg merge
2d 13h
Merged PRs (30d)
24

Description

It would be useful if there were some knobs to turn with fn_params_layout = "Tall"; e.g.

  • Can the maximum line length before vertical alignment is used be configured? If so, it seems like that's not documented in https://rust-lang.github.io/rustfmt/?version=master&search=#fn_params_layout.

  • Could this also be controlled based on the number of parameters the function receives? For example, I'd prefer "Compressed" formatting for functions taking 1 or 2 arguments, but "Vertical" alignment otherwise. This might be irrespective of how long the actual function signature is with those arguments.

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 reading the fn_params_layout documentation and its current behavior in rustfmt. Determine whether configurable line length and parameter-count-based layouts are supported or require a new design. Done would require an agreed configuration behavior, implementation scope, and corresponding documentation or tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.