rust-lang / rust-lang/rustfmt

Spaces arround equal signs are not added consitently

Open
#6,661 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

I discovered an inconsistent behavior of rustfmt (1.8.0-stable (29483883ee 2025-08-04) used via cargo fmt) at spaces around =:

This line gets fixed

    #[arg(short='f', long)]

into

    #[arg(short = 'f', long)]

(see cli.rs in that commit).

But on the other hand the first line of this situation a few lines above, does not get spaces around the =:

    #[arg(short='d', long="ignore-hidden", action = clap::ArgAction::SetFalse, help=
    "Ignore hidden files and directories (starting with a dot). Default is not to ignore them, \
    except for the .git directory with the meta data of a git repository.")]

(I fixed some of that situations by hand with another commit.)

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 reported attribute-formatting examples with the stated rustfmt 1.8.0 version via cargo fmt. Compare the handling of spaces around = in the two snippets and identify the relevant rustfmt formatting path; done means both forms are formatted consistently and the behavior is covered by a regression test.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.