rust-lang / rust-lang/rustfmt

Optional left offset for lifetime (on generic parameters)

Open
#3,291 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

(Sorry if I'm mistaken on the current features, but)
this is a suggestion for lifetime name alignment.

Today:

impl<
    'fofofofo,
    'barbarbarbar,
    FoFoFoFo,
    BarBarBar,
>

How a 1-char left offset would look like (only 3-spaces before the tick '):

impl<
   'fofofofo,
   'barbarbarbar,
    FoFoFoFo,
    BarBarBar,
>

I believe one could read more easily with this visual change, which is very subjective.
This would be slightly similar how some LaTeX configurations (with microtype) would right-offset some marker characters (such as periods . or hyphens -) that would be the last character on a right margin.

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 locating rustfmt's handling of lifetime names in generic parameter lists; no implementation file or test is identified in the issue. Compare the current and proposed formatting examples, then determine whether the alignment can be specified and tested consistently. Done means an agreed behavior with formatting tests covering the optional one-character left offset.

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
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.