Rustfmt removes all indentation from the `where` clause here, making it inconsistent with the function header
Open
A-whitespace
I-poor-formatting
- Dominant language
- Rust
- Stars
- 7k
- Forks
- 1.1k
- Avg merge
- 2d 13h
- Merged PRs (30d)
- 24
Description
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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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