Long statements continues on its own line
Open
Nobody has claimed this yet.
A-call-chains
I-poor-formatting
- Dominant language
- Rust
- Stars
- 7k
- Forks
- 1.1k
- Avg merge
- 2d 13h
- Merged PRs (30d)
- 24
Description
I tried to format this code:
fn main() {
let visual_studio_path = {
let vswhere_stdout = String::from_utf8(vswhere_output.stdout)
.expect("vswhere output is not valid UTF-8");
String::from(vswhere_stdout.trim())
};
}
What I expect:
fn main() {
let visual_studio_path = {
let vswhere_stdout = String::from_utf8(vswhere_output.stdout)
.expect("vswhere output is not valid UTF-8");
String::from(vswhere_stdout.trim())
};
}
What I got:
fn main() {
let visual_studio_path = {
let vswhere_stdout =
String::from_utf8(vswhere_output.stdout).expect("vswhere output is not valid UTF-8");
String::from(vswhere_stdout.trim())
};
}
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
Start with the linked Rust Playground reproduction and compare rustfmt's output with the expected formatting for the chained call. Trace the formatter behavior responsible for placing the long statement continuation on its own line; done means the reproduction matches the expected indentation without regressing related formatting.
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
- 38/100