rust-lang / rust-lang/rustfmt

rustfmt::vertical - pad tables so that elements line up vertically?

Open
#4,710 1 comment 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

#[rustfmt::skip] is used whenever we want rustfmt to not mess up the formatting.
But quite a few times I see this it is for tables / vecs in vecs where we are after padding so that things line up vertically so that the line by line differences are minimised and we can clearly see the differences.
Tabs help but maintaing tables manually is time consuming.

I think an opt in hint to format the item giving preference to vertical similarity would be really cool. I appreciate it's probably hard to do in general but I am sure there are some 80/20 cases that could give us most of the benefit.

Or is there already such a thing and I just didn't know about it?

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

No files, tests, or entry points are named. Start by checking whether rustfmt already has an opt-in vertical-formatting option, then define which table or nested-vector cases are in scope and how aligned output would be verified.

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.