-
Notifications
You must be signed in to change notification settings - Fork 963
Open
Labels
A-commentsArea: commentsArea: commentsC-bugCategory: this is a bug; use also I-* labels for specific bug kinds, e.g. I-non-idempotency or I-ICECategory: this is a bug; use also I-* labels for specific bug kinds, e.g. I-non-idempotency or I-ICEI-trailing-whitespaceIssue: internal error; left behind trailing whitespaceIssue: internal error; left behind trailing whitespaceS-has-mcveStatus: a Minimal Complete and Verifiable Example has been found for this issueStatus: a Minimal Complete and Verifiable Example has been found for this issue
Description
Notice the mixed tabs and spaces, mixed brace styling, internal error message.
Input:
pub fn create_thing() -> Thing
{
Thing
{
#[attribute]
//this comment's presence breaks rustfmt
field: 1,
}
}Output (rustfmt fmt_bug.rs):
error[internal]: left behind trailing whitespace
--> fmt_bug.rs:6:6:1
|
6 |
|
|
warning: rustfmt has failed to format. See previous 1 errors.
pub fn create_thing() -> Thing {
Thing
{
#[attribute]
//this comment's presence breaks rustfmt
field: 1,
}
}Expected:
pub fn create_thing() -> Thing {
Thing {
#[attribute]
//this comment's presence breaks rustfmt
field: 1,
}
}Removing the empty line with whitespace fixes the error message, but the output is still malformed in the same way:
Input:
pub fn create_thing() -> Thing
{
Thing
{
#[attribute]
//this comment's presence breaks rustfmt
field: 1,
}
}Output:
pub fn create_thing() -> Thing {
Thing
{
#[attribute]
//this comment's presence breaks rustfmt
field: 1,
}
}With the comment removed, braces are correctly relocated and the empty line is collapsed.
Input:
pub fn create_thing() -> Thing
{
Thing
{
#[attribute]
field: 1,
}
}Output:
pub fn create_thing() -> Thing {
Thing {
#[attribute]
field: 1,
}
}Metadata
Metadata
Assignees
Labels
A-commentsArea: commentsArea: commentsC-bugCategory: this is a bug; use also I-* labels for specific bug kinds, e.g. I-non-idempotency or I-ICECategory: this is a bug; use also I-* labels for specific bug kinds, e.g. I-non-idempotency or I-ICEI-trailing-whitespaceIssue: internal error; left behind trailing whitespaceIssue: internal error; left behind trailing whitespaceS-has-mcveStatus: a Minimal Complete and Verifiable Example has been found for this issueStatus: a Minimal Complete and Verifiable Example has been found for this issue