-
Notifications
You must be signed in to change notification settings - Fork 966
Closed
Labels
A-emittersArea: emittersArea: emittersE-help-wantedCall for participation: help is requested to fix this issueCall for participation: help is requested to fix this issuegood first issueIssues up for grabs, also good candidates for new rustfmt contributorsIssues up for grabs, also good candidates for new rustfmt contributors
Description
Rustfmt version: rustfmt 2.0.0-rc.2-nightly (e9b039ea 2020-06-03)
If Rustfmt decides to remove a blank line, the JSON output says that actually nothing needs to change. Trivial repro:
~ cat foo.rs
fn foo() {
let i = 0;
}
~ rustfmt --emit json foo.rs | jq
[
{
"name": "/Users/me/foo.rs",
"mismatches": [
{
"original_begin_line": 2,
"original_end_line": 2,
"expected_begin_line": 2,
"expected_end_line": 2,
"original": "",
"expected": ""
}
]
}
]
It seems fine at removing newlines in other cases:
~ cat foo.rs
fn foo() {
let i =
0;
}
~ rustfmt --emit json foo.rs | jq
[
{
"name": "/Users/timh/foo.rs",
"mismatches": [
{
"original_begin_line": 2,
"original_end_line": 3,
"expected_begin_line": 2,
"expected_end_line": 2,
"original": " let i =\n 0;",
"expected": " let i = 0;"
}
]
}
]
So I think the output should be something like this:
[
{
"name": "/Users/me/foo.rs",
"mismatches": [
{
"original_begin_line": 2,
"original_end_line": 3,
"expected_begin_line": 2,
"expected_end_line": 2,
"original": "\n",
"expected": ""
}
]
}
]
Metadata
Metadata
Assignees
Labels
A-emittersArea: emittersArea: emittersE-help-wantedCall for participation: help is requested to fix this issueCall for participation: help is requested to fix this issuegood first issueIssues up for grabs, also good candidates for new rustfmt contributorsIssues up for grabs, also good candidates for new rustfmt contributors