rust-lang / rust-lang/rustfmt

Rustfmt removes all indentation from the `where` clause here, making it inconsistent with the function header

Open
#5,407 6 comments 1 reaction 0 assignees View on GitHub

@davidBar-On is already working on this.

Since Jun 28, 2022.

  • #5411 by @davidBar-On — open
A-whitespace I-poor-formatting
Dominant language
Rust
Stars
7k
Forks
1.1k
Avg merge
2d 13h
Merged PRs (30d)
24

Description

https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=f049e90069a93ab8471f51e0a4f27db5

mod inner {
    fn foo() -> String
    where { // running rustfmt removes all whitespace at the start of the line
        String::new()
    }
}

cc @davidBar-On

Originally posted by @jyn514 in https://github.com/rust-lang/rustfmt/issues/4689#issuecomment-1162404085

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

Reproduce the formatting behavior using the Rust Playground link and the nested where clause example in the issue. Inspect the linked pull request for the current implementation and tests; done means rustfmt no longer removes the indentation and the existing 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
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.