rust-lang / rust-lang/rustfmt

Compressed chains/fn calls

Open
#4,146 5 comments 7 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

This may be hard to get right, but, in general, I tend to prefer putting two or three things in a fn call instead of putting each on its own line. This prevents things from getting needlessly absurdly vertical, eg this in today's rustfmt:

+                                               return_monitor_err!(
+                                                       self,
+                                                       e,
+                                                       channel_state,
+                                                       chan,
+                                                       order,
+                                                       revoke_and_ack.is_some(),
+                                                       commitment_update.is_some()
+                                               );

could be

+                                               return_monitor_err!(
+                                                       self, e, channel_state,
+                                                       chan, order,
+                                                       revoke_and_ack.is_some(),
+                                                       commitment_update.is_some()
+                                               );

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

The issue provides a rustfmt example of a macro call that should be packed into fewer lines. Start by examining how rustfmt decides line breaks for chained or multi-argument calls, then compare current output with the proposed grouping. Done means the behavior is implemented with focused coverage for the example and existing formatting remains stable.

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
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.