rust-lang / rust-lang/rustfmt

Only put spaces around ranges when start and end is specified

Open
#3,832 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

The spaces_around_ranges option currently only accepts a bool: All ranges will be either surrounded with spaces or not. I'd prefer to have a setting that lets me express "put spaces only around ranges that have start and end specified", such as a .. b but not foo[start..] or bar[..end].

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 tracing the spaces_around_ranges option through rustfmt's configuration and range-formatting logic. Identify the existing tests for spaced ranges, then add coverage for ranges with both bounds versus open-ended ranges; done means the new setting formats only fully bounded ranges with spaces.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.